gpt4 book ai didi

flutter - flutter pub run build_runner build 时出错

转载 作者:行者123 更新时间:2023-12-03 23:58:05 24 4
gpt4 key购买 nike

我在运行 flutter pub run build_runner build 时遇到了这个问题。我尝试过类似 flutter clean、flutter pub-cache repair、flutter pub get 等解决方案。在 pubspec 上添加了 Mockito、HTTP 和 build_runner 等依赖项,flutter pub get 也成功运行。

Failed to precompile build_runner:build_runner:
../../snap/flutter/common/flutter/.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);
^^^^^^^^^^^^^^^^
../../snap/flutter/common/flutter/.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:
^^^^^^^^^^^^^^^^
../../snap/flutter/common/flutter/.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' ('../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.3.0/lib/meta_meta.dart').
case TargetKind.topLevelVariable:
^
../../snap/flutter/common/flutter/.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

最佳答案

添加分析器 https://pub.dev/packages/analyzer pubspec yaml 的开发依赖项中的依赖项 1.5.0 对我有用

 dev_dependencies:
analyzer: 1.5.0

关于flutter - flutter pub run build_runner build 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67700083/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com