Reputation: 446
flutter seems to be switching between null safety checks and nonnull safety checks causing dozens of issues.
Running: flutter clean remove all null check errors, but when I run: flutter pub get the null errors return?
Really confusing, my dart sdk:
environment:sdk: ">=2.11.6 <3.0.0"
I think dart was updated recently to include null checks and it seems to be causing loads of problems for me, I have corrected the null errors before anyone suggests this and when I run flutter clean the null error check I have implemented cause errors.
lib/screens/add_new_location_note_screen.dart:23:8:
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. Place? _pickedLocation;
Now I have changed the minimum sdk to
environment: sdk: ">=2.12.0 <3.0.0"
ran: flutter clean
and the errors again disappear now running: flutter pub get
the null errors checks return ???
Upvotes: 0
Views: 1004
Reputation: 3067
You must set the SDK constraints like so:
environment: sdk: ">=2.12.0-0 <3.0.0"
Currently, the 2.12 SDK is in pre-release (beta), requiring the use of the -0
to signify the pre-release version to use.
Upvotes: 2