How to disable Flutter sound-safety and null-safety for the SplashScreen library?

4,119

Solution 1

If you want you can just disable null safety, without downgrading.

Add this to your launch configuration:

--no-sound-null-safety

More info on https://dart.dev/null-safety/unsound-null-safety

Solution 2

To disable null safety change flutter SDK version to:

environment:
sdk: ">=2.11.0 <3.0.0"

in pubspec.yaml file

Solution 3

it saying you can not user a non null safe package while using Dart null safety or sound null safety

Now you have one option to keep using non null safe package. that is you have to downgrade your flutter to non null safe version

to achieve that run the following command

flutter pub downgrade

Share:
4,119
bravestLimit
Author by

bravestLimit

BALLER!

Updated on December 30, 2022

Comments

  • bravestLimit
    bravestLimit over 1 year

    I am trying to run the SplashScreen library but it isn't working. I have edited the package’s pubspec.yaml file, setting the minimum SDK constraint to 2.7.0, It brought out this error:

    lib/mySplashScreen.dart:5:28: 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 MySplashScreen({Key? key}) : super(key: key); ^ Error: Cannot run with sound null safety, because the following dependencies don't support null safety:

    I added a language version comment to the top of the Dart files, ie: // @dart=2.9 It brought this error:

    Error: A library can't opt out of null safety by default, when using sound null safety. // @dart=2.9 ^^^^^^^^^^^^

    What do I do?