0

我正在尝试运行flutter packages pub run build_runner build --delete-conflicting-outputs以生成冻结的文件,但出现此错误。

Failed to build build_runner:build_runner:
../../../Development/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' ('../../../Development/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()
                                                 ^^^^^^^^^^^^^
../../../Development/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 {
             ^^^^^^^^^^^^^
../../../Development/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 {
             ^^^^^^^^^^^^^
../../../Development/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;
                                   ^^^^^^^^^^^^^^^^^^^^
pub finished with exit code 1

我在 M1 芯片 MacOS 上运行它

  • Dart/Flutter SDK 版本 ( dart --version) - 2.15.1 (稳定)
  • 您正在使用此 repo 中的哪些包,以及版本 - build_runner 1.11.5)

这是我的 pubspec.yaml 文件

name: flutter_app
description: A new Flutter application.

publish_to: "none" # Remove this line if you wish to publish to pub.dev
version: 1.0.5+30

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  firebase_core: "^0.7.0" # ^1.0.1
  firebase_messaging: "^8.0.0-dev.15"

  bloc: ^6.1.1 # ^7.0.0-nullsafety.3
  flutter_bloc: ^6.1.2 # ^7.0.0-nullsafety.5
  google_fonts: ^1.1.1 # ^2.0.0
  flutter_svg: ^0.19.1 # ^0.21.0-nullsafety.0

  flutter_screenutil: ^4.0.2+3 # ^5.0.0-nullsafety.9

  video_player: ^2.0.0

  rudder_sdk_flutter: ^1.0.2
  flutter_dotenv: ^5.0.2

  easy_localization: ^2.3.0 # ^3.0.0

  # Flare animations
  flare_flutter: ^2.0.6 # ^3.0.0-nullsafety.0

  # Overlays
  flutter_portal: ^0.3.0 # ^0.4.0-nullsafety.0

  # Charts
  fl_chart: ^0.12.2 # ^0.20.1

  table_calendar: ^2.3.3 # ^3.0.0-nullsafety.1

  url_launcher: ^5.7.10 # ^6.0.2
  flutter_inappwebview: ^4.0.0+4 # ^5.1.0+4
  html: ^0.14.0+4 # ^0.15.0
  permission_handler: ^5.1.0+2

  # Flutter widget that can be expanded or collapsed by the user.
  expandable: ^4.1.4 # ^5.0.1
  infinite_listview: ^1.0.1+1 # - (Not coming)
  social_embed_webview: ^0.3.1 # - (Not coming)

  # Stepper
  flutter_dash: ^0.0.1 # - (Not coming)
  timelines: ^0.0.2+1 # - (Temporary git: https://github.com/areille/timelines/tree/null-safety)
  scrollable_positioned_list: ^0.1.9 # ^0.2.0-nullsafety.0

  shared_preferences: ^0.5.12+4 # ^^2.0.4
  logger: ^1.0.0 # ^1.0.0-nullsafety.0
  equatable: ^1.2.6 # ^2.0.0
  uuid: ^2.1.0 # ^3.0.1
  formz: ^0.3.2 # ^0.4.0-nullsafety.0
  flutter_hooks: ^0.15.0 # ^0.16.0
  hooks_riverpod: ^0.12.2 # ^0.13.1
  smooth_page_indicator: ^0.2.1 # ^0.3.0-nullsafety.0
  http: ^0.12.2 # ^0.13.0
  retry: ^3.0.1 # ^3.1.0
  flutter_local_notifications: ^4.0.1+2
  freezed_annotation: ^0.12.0

  # powerful Http client for Dart, which supports Interceptors, Global configuration, FormData, Request Cancellation, File downloading, Timeout etc
  dio: ^3.0.10
  # it's a type conversion dio client generator using source_gen and inspired by Chopper and Retrofit (android).
  retrofit: ^1.3.4+1
  json_serializable: ^3.5.1
  json_annotation: ^3.1.1
  # A collection of loading indicators animated with flutter
  flutter_spinkit: ^4.1.2
  fluro: ^1.7.8
  rxdart: ^0.25.0

  # to discover network connectivity
  connectivity: ^2.0.2
  flutter_offline: ^1.0.0
  jwt_decoder: ^1.0.4

  cupertino_icons: ^1.0.0 # 1.0.2

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_launcher_icons: "^0.8.0"
  retrofit_generator: any
  build_runner: any
  freezed: any
  analyzer: any

flutter_icons:
  android: "launcher_icon"
  ios: true
  image_path: "assets/images/icon.jpg"

我尝试在 pubspec(0.40.7) 中为分析器指定一个版本,然后它不会抛出任何错误,而是卡在一个循环中并且永远不会停止。

不知道这里有什么问题。任何帮助都会很棒。谢谢!

4

0 回答 0