0

** 如何使冻结的包正确生成代码?

我已经更改了依赖项,并且我尝试了更多方法,例如:清除缓存,升级主要版本..但在最好的情况下,输出将是:成功执行 0 个输出(3 或 x 个操作)x = 任意数字**

发布规范.yaml

  flutter:
    sdk: flutter
 
  freezed_annotation: ^0.12.0

  
  cupertino_icons: ^1.0.2
  analyzer: ^0.41.2


dev_dependencies:
  flutter_test:
    sdk: flutter
  build_runner: ^1.11.2
  freezed: ^0.12.7
  build_config: ^0.4.3

freezed_classes.dart

import 'package:freezed_annotation/freezed_annotation.dart';

part 'freezed_classes.freezed.dart';

@freezed
abstract class User with _$User{

  const factory User({String name,int age}) = _User;
}


** 颤振 pub run build_runner watch --delete-conflicting-outputs **

PS D:\AppDevelopment\flutter\pics> flutter pub run build_runner watch --delete-conflicting-outputs                    
Failed to build build_runner:build_runner:
../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' ('../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()
                                                 ^^^^^^^^^^^^^
../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 {
             ^^^^^^^^^^^^^
../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 {
             ^^^^^^^^^^^^^
../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;
                                   ^^^^^^^^^^^^^^^^^^^^

颤振--版本

PS D:\AppDevelopment\flutter\pics> flutter --version 
Flutter 2.5.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 18116933e7 (5 weeks ago) • 2021-10-15 10:46:35 -0700
Engine • revision d3ea636dc5
Tools • Dart 2.14.4

扑医生

[√] Flutter (Channel stable, 2.5.3, on Microsoft Windows [Version 10.0.19043.1348], locale ro-RO)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[√] Chrome - develop for the web
[X] Visual Studio - develop for Windows
    X Visual Studio not installed; this is necessary for Windows development.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2020.3)
[√] VS Code (version 1.62.3)
[√] Connected device (3 available)

! Doctor found issues in 1 category.
4

0 回答 0