Home > Net >  Error: Null safety features are disabled for this library. Try removing the package language version
Error: Null safety features are disabled for this library. Try removing the package language version

Time:09-30

Building without sound null safety
For more information see https://dart.dev/null-safety/unsound-null-safety

lib/main.dart:8:19: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.12 or higher.
  const MyApp({Key? key}) : super(key: key);
                  ^
lib/main.dart:33:24: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.12 or higher.
  const MyHomePage({Key? key, required this.title}) : super(key: key);
                       ^
lib/main.dart:33:31: Error: 'required' isn't a type.
  const MyHomePage({Key? key, required this.title}) : super(key: key);
                              ^^^^^^^^
../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/meta-1.7.0/lib/meta.dart:260:16: Context: This isn't a type.
const Required required = Required();
               ^^^^^^^^


FAILURE: Build failed with an exception.

* Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1156

* What went wrong:
Execution failed for task ':app:compileFlutterBuildRelease'.
> Process 'command 'C:\src\flutter\bin\flutter.bat'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 16s
Running Gradle task 'assembleRelease'...                           18.0s
Gradle task assembleRelease failed with exit code 1

CodePudding user response:

are you using any plugin that do not uses null safety. If so, try updating the plugin.

CodePudding user response:

Try this command in terminal for building

flutter run --no-sound-null-safety
  • Related