我创建了一个新项目,在启动它时添加了依赖项,运行build_runner构建:
/C:/Users/Michael/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-1.6.0/lib/src/error/best_practices_verifier.dart:1600:40: Error: Getter not found: 'topLevelVariable'.
return kinds.contains(TargetKind.topLevelVariable);
^^^^^^^^^^^^^^^^
/C:/Users/Michael/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-1.6.0/lib/src/error/best_practices_verifier.dart:2024:23: Error: Getter not found: 'topLevelVariable'.
case TargetKind.topLevelVariable:
^^^^^^^^^^^^^^^^
/C:/Users/Michael/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-1.6.0/lib/src/error/best_practices_verifier.dart:2024:23: Error: Type 'dynamic' of the case expression is not a subtype of type 'TargetKind' of this switch
expression.
- 'TargetKind' is from 'package:meta/meta_meta.dart' ('/C:/Users/Michael/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/meta-1.3.0/lib/meta_meta.dart').
case TargetKind.topLevelVariable:
^
/C:/Users/Michael/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-1.6.0/lib/src/error/best_practices_verifier.dart:2001:13: Context: The switch expression is here.
switch (this) {
^
pub finished with exit code 1我已经阅读了堆栈溢出的所有内容,但我还没有找到解决方案。有什么想法吗?
发布于 2021-05-26 11:21:19
指定分析器版本
analyzer: 1.5.0警告:不要使用最新版本,因为它依赖于meta包,就像flutter_test一样--在这里您不能指定版本
https://stackoverflow.com/questions/67703707
复制相似问题