我的vs代码出现了一个“获取包裹”按钮,我错误地按了它。
现在,即使我的包被固定(特别是一个)在某个版本上,它总是尝试使用最新版本运行项目,这给我带来了如下错误:
/C:/Users/j/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/serverpod_serialization-0.9.20/lib/src/serialization.dart:21:11: Context: 'SerializableEntity.toJson' is defined here.
请注意,它引用了< code > server pod _ serialization-0 . 9 . 20
我所有的serverpod
东西都固定在^0.9.8
我尝试过这样的东西:如何从flutter中移除或识别未使用的包以减少项目的规模?
清除pubspek. lock文件、.pub-cache文件夹、flutter净
flutter pub get
一切。我的项目中的任何文件都没有引用0.9.20
,所有pubspec.yaml文件都将其固定:
dependencies:
serverpod_client: ^0.9.8
那么,颤振从哪里得到0.9.20?或者更重要的是,我怎么才能把一切都弄清楚?
奇怪的是,如果我重新克隆它并运行<code>dart-pub-get</code>,然后查看它创建的pubspok.lock
serverpod_client:
dependency: "direct main"
description:
name: serverpod_client
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.20"
尽管 Pubspec.yaml 清楚地将其固定在 0.9.8
,但这告诉我问题不在于项目或存储库或缓存,而是在我的实际颤振安装中,但不知何故......颤动的缓存?
下面是该错误的扩展版本:
Launching lib\main.dart on sdk gphone x86 in debug mode...
lib\main.dart:1
: Error: Type 'ServerpodClientErrorCallback' not found.
../…/protocol/client.dart:72
ServerpodClientErrorCallback? errorHandler,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
: Error: The non-abstract class 'Consent' is missing implementations for these members:
package:ravencoin_back/…/protocol/consent_class.dart:14
- SerializableEntity.toJson
Try to either
- provide an implementation,
- inherit an implementation from a superclass or mixin,
- mark the class as abstract, or
- provide a 'noSuchMethod' implementation.
class Consent extends SerializableEntity {
^^^^^^^
/C:/Users/j/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/serverpod_serialization-0.9.20/lib/src/serialization.dart:21:11: Context: 'SerializableEntity.toJson' is defined here.
dynamic toJson();
^^^^^^
: Error: The non-abstract class 'ConsentDocument' is missing implementations for these members:
package:ravencoin_back/…/protocol/consent_document_class.dart:14
- SerializableEntity.toJson
Try to either
- provide an implementation,
- inherit an implementation from a superclass or mixin,
- mark the class as abstract, or
- provide a 'noSuchMethod' implementation.
在要清理缓存的终端中运行< code>dart pub cache clean来清理项目构建中的包,< code>flutter clean
更多信息:https://dart.dev/tools/pub/cmd/pub-cache