ios - flutter @Error : Null safety features are disabled for this library

标签 ios flutter dart

我正在构建一个 Flutter 应用程序,当我为 Android 构建应用程序时,该应用程序运行良好,但是当我开始为 iOS 构建应用程序时,我开始面临“此库禁用空安全功能”的错误
错误如下:

Users/himanshu/.pub-cache/hosted/pub.dartlang.org/path-1.8.0-nullsafety/lib/path.dart:100:4: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
Uri? _currentUriBase;
   ^
/Users/himanshu/.pub-cache/hosted/pub.dartlang.org/path-1.8.0-nullsafety/lib/path.dart:106:7: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
String? _current;
      ^
/Users/himanshu/.pub-cache/hosted/pub.dartlang.org/path-1.8.0-nullsafety/lib/path.dart:120:16: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
        [String? part2,
               ^
/Users/himanshu/.pub-cache/hosted/pub.dartlang.org/path-1.8.0-nullsafety/lib/path.dart:121:15: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
        String? part3,
              ^
/Users/himanshu/.pub-cache/hosted/pub.dartlang.org/path-1.8.0-nullsafety/lib/path.dart:122:15: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
        String? part4,
              ^
/Users/himanshu/.pub-cache/hosted/pub.dartlang.org/path-1.8.0-nullsafety/lib/path.dart:123:15: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
        String? part5,
              ^
/Users/himanshu/.pub-cache/hosted/pub.dartlang.org/path-1.8.0-nullsafety/lib/path.dart:124:15: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
        String? part6,
              ^
/Users/himanshu/.pub-cache/hosted/pub.dartlang.org/path-1.8.0-nullsafety/lib/path.dart:125:15: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
        String? part7]) =>
              ^
/Users/himanshu/.pub-cache/hosted/pub.dartlang.org/path-1.8.0-nullsafety/lib/path.dart:258:16: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
        [String? part2,
               ^
/Users/himanshu/.pub-cache/hosted/pub.dartlang.org/path-1.8.0-nullsafety/lib/path.dart:259:15: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
        String? part3,
              ^
/Users/himanshu/.pub-cache/hosted/pub.dartlang.org/path-1.8.0-nullsafety/lib/path.dart:260:15: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
        String? part4,
              ^
/Users/himanshu/.pub-cache/hosted/pub.dartlang.org/path-1.8.0-nullsafety/lib/path.dart:261:15: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
        String? part5,
              ^
/Users/himanshu/.pub-cache/hosted/pub.dartlang.org/path-1.8.0-nullsafety/lib/path.dart:262:15: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
        String? part6,
              ^
/Users/himanshu/.pub-cache/hosted/pub.dartlang.org/path-1.8.0-nullsafety/lib/path.dart:263:15: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
        String? part7,
              ^
/Users/himanshu/.pub-cache/hosted/pub.dartlang.org/path-1.8.0-nullsafety/lib/path.dart:264:15: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
        String? part8]) =>
              ^
/Users/himanshu/.pub-cache/hosted/pub.dartlang.org/path-1.8.0-nullsafety/lib/path.dart:358:37: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
String relative(String path, {String? from}) =>
                                    ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/actions.dart:126:9: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
  Object? invoke(covariant T intent);
        ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/actions.dart:235:8: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
    Key? key,
       ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/actions.dart:330:50: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
  Object invoke(covariant T intent, [BuildContext? context]);
                                                 ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/actions.dart:334:52: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
typedef OnInvokeCallback<T extends Intent> = Object? Function(T intent);
                                                   ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/actions.dart:361:9: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
  Object? invoke(covariant T intent) => onInvoke(intent);
        ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/actions.dart:386:9: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
  Object? invokeAction(covariant Action<Intent> action, covariant Intent intent, [BuildContext? context]) {
        ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/actions.dart:386:95: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
  Object? invokeAction(covariant Action<Intent> action, covariant Intent intent, [BuildContext? context]) {
                                                                                              ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/actions.dart:420:8: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
    Key? key,
       ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/actions.dart:436:25: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
  final ActionDispatcher? dispatcher;
                        ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/actions.dart:495:22: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
  static VoidCallback? handler<T extends Intent>(BuildContext context, T intent, {bool nullOk = false}) {
                     ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/actions.dart:510:19: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
  static Action<T>? find<T extends Intent>(BuildContext context, {bool nullOk = false}) {
                  ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/actions.dart:595:16: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
  static Object? invoke<T extends Intent>(
               ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/actions.dart:653:22: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
  Set<Action<Intent>>? listenedActions = <Action<Intent>>{};
                     ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/actions.dart:718:8: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
    Key? key,
       ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/actions.dart:719:21: Error: Expected '}' before this.
    required Widget child,
                    ^^^^^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/actions.dart:724:25: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
  final ActionDispatcher? dispatcher;
                        ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/actions.dart:887:8: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
    Key? key,
       ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/actions.dart:914:18: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
  final FocusNode? focusNode;
                 ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/actions.dart:920:34: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
  final Map<Type, Action<Intent>>? actions;
                                 ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/actions.dart:923:35: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
  final Map<LogicalKeySet, Intent>? shortcuts;
                                  ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/actions.dart:929:27: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
  final ValueChanged<bool>? onShowFocusHighlight;
                          ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/actions.dart:934:27: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
  final ValueChanged<bool>? onShowHoverHighlight;
                          ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/actions.dart:939:27: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
  final ValueChanged<bool>? onFocusChange;
                          ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/actions.dart:1031:41: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
  void _mayTriggerCallback({VoidCallback? task, FocusableActionDetector? oldWidget}) {
                                        ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/actions.dart:1031:72: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
  void _mayTriggerCallback({VoidCallback? task, FocusableActionDetector? oldWidget}) {
                                                                       ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/animated_cross_fade.dart:121:8: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
    Key? key,
       ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/animated_cross_fade.dart:164:17: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
  final Duration? reverseDuration;
                ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/animated_cross_fade.dart:250:22: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
  AnimationController? _controller;
                     ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/animated_cross_fade.dart:251:8: Error: A method declaration needs an explicit list of parameters.
Try adding a parameter list to the method declaration.
  late Animation<double> _firstAnimation;
       ^^^^^^^^^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/animated_cross_fade.dart:251:26: Error: Expected '{' before this.
  late Animation<double> _firstAnimation;
                         ^^^^^^^^^^^^^^^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/animated_cross_fade.dart:251:26: Error: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
Try adding the name of the type of the variable or the keyword 'var'.
  late Animation<double> _firstAnimation;
                         ^^^^^^^^^^^^^^^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/animated_cross_fade.dart:252:8: Error: A method declaration needs an explicit list of parameters.
Try adding a parameter list to the method declaration.
  late Animation<double> _secondAnimation;
       ^^^^^^^^^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/animated_cross_fade.dart:252:26: Error: Expected '{' before this.
  late Animation<double> _secondAnimation;
                         ^^^^^^^^^^^^^^^^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/animated_cross_fade.dart:252:8: Error: 'Animation' is already declared in this scope.
  late Animation<double> _secondAnimation;
       ^^^^^^^^^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/animated_cross_fade.dart:251:8: Context: Previous declaration of 'Animation'.
  late Animation<double> _firstAnimation;
       ^^^^^^^^^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/animated_cross_fade.dart:252:26: Error: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
Try adding the name of the type of the variable or the keyword 'var'.
  late Animation<double> _secondAnimation;
                         ^^^^^^^^^^^^^^^^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/animated_cross_fade.dart:274:3: Error: 'Animation' isn't a type.
  Animation<double> _initAnimation(Curve curve, bool inverted) {
  ^^^^^^^^^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/animated_cross_fade.dart:274:3: Context: This isn't a type.
  Animation<double> _initAnimation(Curve curve, bool inverted) {
  ^^^^^^^^^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/animated_list.dart:33:28: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
  final AnimationController? controller;
                           ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/animated_list.dart:34:39: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
  final AnimatedListRemovedItemBuilder? removedItemBuilder;
                                      ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/animated_list.dart:272:8: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
    Key? key,
       ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/animated_list.dart:340:25: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
  final ScrollController? controller;
                        ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/animated_list.dart:350:13: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
  final bool? primary;
            ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/animated_list.dart:358:22: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
  final ScrollPhysics? physics;
                     ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/animated_list.dart:377:27: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
  final EdgeInsetsGeometry? padding;
                          ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/animated_list.dart:388:27: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
  static AnimatedListState? of(BuildContext context, { bool nullOk = false }) {
                          ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/animated_list.dart:737:8: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
    Key? key,
       ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/animated_list.dart:774:33: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
  static SliverAnimatedListState? of(BuildContext context, {bool nullOk = false}) {
                                ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/animated_list.dart:837:14: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
  _ActiveItem? _removeActiveItemAt(List<_ActiveItem> items, int itemIndex) {
             ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/animated_list.dart:842:14: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
  _ActiveItem? _activeItemAt(List<_ActiveItem> items, int itemIndex) {
             ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/animated_size.dart:57:8: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
    Key? key,
       ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/animated_size.dart:58:11: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
    Widget? child,
          ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/animated_size.dart:101:17: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
  final Duration? reverseDuration;
                ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/animated_switcher.dart:64:63: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
typedef AnimatedSwitcherLayoutBuilder = Widget Function(Widget? currentChild, List<Widget> previousChildren);
                                                              ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/animated_switcher.dart:149:8: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
    Key? key,
       ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/animated_switcher.dart:175:15: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
  final Widget? child;
              ^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/animated_switcher.dart:192:17: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
该错误还表明 required 不是类型
/Users/himanshu/.pub-cache/hosted/pub.dartlang.org/meta-1.3.0-nullsafety.2/lib/meta.dart:224:16: Context: This isn't a type.
const Required required = Required();
               ^^^^^^^^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/basic.dart:400:5: Error: 'required' isn't a type.
    required this.filter,
    ^^^^^^^^
/Users/himanshu/.pub-cache/hosted/pub.dartlang.org/meta-1.3.0-nullsafety.2/lib/meta.dart:224:16: Context: This isn't a type.
const Required required = Required();
               ^^^^^^^^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/basic.dart:820:5: Error: 'required' isn't a type.
    required ShapeBorder shape,
    ^^^^^^^^
/Users/himanshu/.pub-cache/hosted/pub.dartlang.org/meta-1.3.0-nullsafety.2/lib/meta.dart:224:16: Context: This isn't a type.
const Required required = Required();
               ^^^^^^^^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/basic.dart:907:5: Error: 'required' isn't a type.
    required this.color,
    ^^^^^^^^
/Users/himanshu/.pub-cache/hosted/pub.dartlang.org/meta-1.3.0-nullsafety.2/lib/meta.dart:224:16: Context: This isn't a type.
const Required required = Required();
               ^^^^^^^^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/basic.dart:999:5: Error: 'required' isn't a type.
    required this.clipper,
    ^^^^^^^^
/Users/himanshu/.pub-cache/hosted/pub.dartlang.org/meta-1.3.0-nullsafety.2/lib/meta.dart:224:16: Context: This isn't a type.
const Required required = Required();
               ^^^^^^^^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/basic.dart:1002:5: Error: 'required' isn't a type.
    required this.color,
    ^^^^^^^^
/Users/himanshu/.pub-cache/hosted/pub.dartlang.org/meta-1.3.0-nullsafety.2/lib/meta.dart:224:16: Context: This isn't a type.
const Required required = Required();
               ^^^^^^^^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/basic.dart:1114:5: Error: 'required' isn't a type.
    required this.transform,
    ^^^^^^^^
/Users/himanshu/.pub-cache/hosted/pub.dartlang.org/meta-1.3.0-nullsafety.2/lib/meta.dart:224:16: Context: This isn't a type.
const Required required = Required();
               ^^^^^^^^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/basic.dart:1151:5: Error: 'required' isn't a type.
    required double angle,
    ^^^^^^^^
/Users/himanshu/.pub-cache/hosted/pub.dartlang.org/meta-1.3.0-nullsafety.2/lib/meta.dart:224:16: Context: This isn't a type.
const Required required = Required();
               ^^^^^^^^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/basic.dart:1180:5: Error: 'required' isn't a type.
    required Offset offset,
    ^^^^^^^^
/Users/himanshu/.pub-cache/hosted/pub.dartlang.org/meta-1.3.0-nullsafety.2/lib/meta.dart:224:16: Context: This isn't a type.
const Required required = Required();
               ^^^^^^^^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/basic.dart:1219:5: Error: 'required' isn't a type.
    required double scale,
    ^^^^^^^^
/Users/himanshu/.pub-cache/hosted/pub.dartlang.org/meta-1.3.0-nullsafety.2/lib/meta.dart:224:16: Context: This isn't a type.
const Required required = Required();
               ^^^^^^^^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/basic.dart:1301:5: Error: 'required' isn't a type.
    required this.link,
    ^^^^^^^^
/Users/himanshu/.pub-cache/hosted/pub.dartlang.org/meta-1.3.0-nullsafety.2/lib/meta.dart:224:16: Context: This isn't a type.
const Required required = Required();
               ^^^^^^^^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/basic.dart:1361:5: Error: 'required' isn't a type.
    required this.link,
    ^^^^^^^^
/Users/himanshu/.pub-cache/hosted/pub.dartlang.org/meta-1.3.0-nullsafety.2/lib/meta.dart:224:16: Context: This isn't a type.
const Required required = Required();
               ^^^^^^^^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/basic.dart:1507:5: Error: 'required' isn't a type.
    required this.translation,
    ^^^^^^^^
/Users/himanshu/.pub-cache/hosted/pub.dartlang.org/meta-1.3.0-nullsafety.2/lib/meta.dart:224:16: Context: This isn't a type.
const Required required = Required();
               ^^^^^^^^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/basic.dart:1569:5: Error: 'required' isn't a type.
    required this.quarterTurns,
    ^^^^^^^^
/Users/himanshu/.pub-cache/hosted/pub.dartlang.org/meta-1.3.0-nullsafety.2/lib/meta.dart:224:16: Context: This isn't a type.
const Required required = Required();
               ^^^^^^^^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/basic.dart:1644:5: Error: 'required' isn't a type.
    required this.padding,
    ^^^^^^^^
/Users/himanshu/.pub-cache/hosted/pub.dartlang.org/meta-1.3.0-nullsafety.2/lib/meta.dart:224:16: Context: This isn't a type.
const Required required = Required();
               ^^^^^^^^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/basic.dart:1921:5: Error: 'required' isn't a type.
    required this.delegate,
    ^^^^^^^^
/Users/himanshu/.pub-cache/hosted/pub.dartlang.org/meta-1.3.0-nullsafety.2/lib/meta.dart:224:16: Context: This isn't a type.
const Required required = Required();
               ^^^^^^^^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/basic.dart:1951:5: Error: 'required' isn't a type.
    required this.id,
    ^^^^^^^^
/Users/himanshu/.pub-cache/hosted/pub.dartlang.org/meta-1.3.0-nullsafety.2/lib/meta.dart:224:16: Context: This isn't a type.
const Required required = Required();
               ^^^^^^^^
/Users/himanshu/flutter/packages/flutter/lib/src/widgets/basic.dart:1952:5: Error: 'required' isn't a type.
    required Widget child,
    ^^^^^^^^
/Users/himanshu/.pub-cache/hosted/pub.dartlang.org/meta-1.3.0-nullsafety.2/lib/meta.dart:224:16: Context: This isn't a type.
const Required required = Required();
               ^^^^^^^^
flutter 医生 -v 如下:
[√] Flutter (Channel stable, 1.20.3, on Microsoft Windows [Version 10.0.19041.508], locale en-US)
    • Flutter version 1.20.3 at C:\src\flutter
    • Framework revision 216dee60c0 (3 weeks ago), 2020-09-01 12:24:47 -0700
    • Engine revision d1bc06f032
    • Dart version 2.9.2

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.0-rc2)
    • Android SDK at C:\Users\Ashu\AppData\Local\Android\Sdk
    • Platform android-29, build-tools 30.0.0-rc2
    • Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)   
    • All Android licenses accepted.

[!] Android Studio (version 3.2)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 31.3.1
    • Dart plugin version 181.5656
    X Unable to determine bundled Java version.
    • Try updating or re-installing Android Studio.

[√] Android Studio (version 3.6)
    • Android Studio at C:\Program Files\Android\Android Studio1
    • Flutter plugin version 31.3.1
    • Dart plugin version 181.5656
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)

[√] VS Code (version 1.49.0)
    • VS Code at C:\Users\Ashu\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.14.1

[!] Connected device
    ! No devices available
谢谢你。

最佳答案

我通过执行以下操作解决了它(对于 Windows 10 上的 Visual Code):
在命令提示符下(或在 PATH 中使用 flutter 的任何终端):flutter upgrade并确保版本至少为 2.12(这是在不将其用作实验性功能的情况下启用空安全性所需的最低版本(我相信🧐))

PS C:\> flutter upgrade
Flutter is already up to date on channel stable
Flutter 2.0.2 • channel stable • https://github.com/flutter/flutter.git 
Framework • revision 8962f6dc68 (2 days ago) • 2021-03-11 13:22:20 -0800
Engine • revision 5d8bf811b3
Tools • Dart 2.12.1
确认后,我检查了项目中当前的 sdk-version 是什么(在我的情况下,它是:sdk: ">=2.7.0 <3.0.0")
所以我将其更新为以下内容:sdk: ">=2.12.0 <3.0.0" .
所以环境应该如下所示:
environment:
  sdk: ">=2.12.0 <3.0.0"

关于ios - flutter @Error : Null safety features are disabled for this library,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63969287/

相关文章:

Flutter 共享元素英雄动画不适用于自定义 ModalRoute

dart - 尝试确定变量是否属于某种类型时出现语法错误

android - 在 Flutter 中为 DropdownMenu 使用枚举和 ValueNotifier

ios - 在 UIView 中绘制文本然后清除它然后在不同的地方再次绘制

ios - 如何为动态选择器 View 创建函数

ubuntu 18.04 上的 flutter 错误 'flutter' 命令未找到

Flutter:如何将麦克风的原始音频信号实时存入内存?

flutter - 屏幕底部有多个FAB

iphone - 不能做 git stash apply

ios - 无法使用阿拉伯名称注册用户