简体   繁体   English

flutter pub run build_runner 构建不工作

[英]flutter pub run build_runner build not working

when running flutter pub run build_runner build I get this error.运行 flutter pub run build_runner build 时出现此错误。

Failed to build build_runner:build_runner:
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.41.2/lib/src/error/best_practices_verifier.dart:258:50: Error: The property 'displayString' is defined in multiple extensions for 'TargetKind' and neither is more specific.
 - 'TargetKind' is from 'package:meta/meta_meta.dart' ('../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.7.0/lib/meta_meta.dart').
Try using an explicit extension application of the wanted extension or hiding unwanted extensions from scope.
        var kindNames = kinds.map((kind) => kind.displayString).toList()
                                                 ^^^^^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.41.2/lib/src/error/best_practices_verifier.dart:1950:14: Context: This is one of the extension members.
  String get displayString {
             ^^^^^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.7.0/lib/meta_meta.dart:91:14: Context: This is one of the extension members.
  String get displayString {
             ^^^^^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.41.2/lib/src/error/best_practices_verifier.dart:260:36: Error: The getter 'commaSeparatedWithOr' isn't defined for the class 'List<dynamic>'.
 - 'List' is from 'dart:core'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'commaSeparatedWithOr'.
        var validKinds = kindNames.commaSeparatedWithOr;

This issue is related to outdated dependencies most likely, I had a similar one just today.这个问题很可能与过时的依赖项有关,我今天也遇到过类似的问题。

Run flutter pub upgrade and it should work!运行flutter pub upgrade ,它应该可以工作!

Those who are experiencing this problem, just overwrite the "meta" dependency.那些遇到这个问题的人,只需覆盖"meta"依赖项即可。

just add these lines to pubspec.yaml只需将这些行添加到 pubspec.yaml

dependency_overrides:
meta: 1.6.0

This might solve your issue, and there is well discussed github discussion https://github.com/dart-lang/sdk/issues/46687这可能会解决您的问题,并且有很好的讨论 github 讨论https://github.com/dart-lang/sdk/issues/46687

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 flutter pub run build_runner 卡住了 - flutter pub run build_runner stuck flutter 运行 pub 运行 build_runner 构建失败 - flutter run pub run build_runner build failed flutter pub run build_runner 构建失败 - flutter pub run build_runner build failed $ flutter pub run build_runner 在项目中构建 hive 没有响应 - $ flutter pub run build_runner build in project with hive not responding flutter pub run build_runner build 上的错误 - Error on flutter pub run build_runner build 如何使用 class 的“flutter pub run build_runner build”在 Flutter 中有字段时间戳? - How to “flutter pub run build_runner build” with the class has field Timestamp in Flutter? flutter pub run build_runner build --delete-conflicting-outputs 在 github 操作中运行失败 - flutter pub run build_runner build --delete-conflicting-outputs run failed in github action 如何在 intellij idea 中以调试模式运行 flutter 'packages pub run build_runner build'? - How run flutter 'packages pub run build_runner build' with debug mode in intellij idea? 运行时出错 flutter pub run build_runner build --delete-conflicting-outputs - Error when running flutter pub run build_runner build --delete-conflicting-outputs pub run build_runner build 有错误 (66) - pub run build_runner build has error (66)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM