Reputation: 909
Ever since null-safety was introduced to Flutter, when I do flutter clean
, the whole project switches to null-safety.
I can not update my whole project to null-safety quite yet as many packages I use have not migrated.
How can I do a flutter clean
without getting thousands of errors telling me that non-nullable item must be initialized first...
I am currently on Flutter 1.24.0-10.2-pre, channel beta.
pubspec.yaml includes the following
environment:
sdk: ">=2.2.2 <3.0.0"
Upvotes: 4
Views: 6610
Reputation: 21
Using VS code editor:
The above fixed similar issue I got
Upvotes: 2
Reputation: 114
If you get an error after running "flutter clean", do the following to solve the problem;
After this you'll see "Running 'flutter pub get' in 'xxx'(where xxx stands for the name of your project)
When this is complete, all will be reset back to normal
Upvotes: 0
Reputation: 11
Sometimes you have to run this command:
dart pub upgrade
or
dart pub update
Upvotes: 0
Reputation: 529
I have the same problem, For me
That is!! I am using VS code.
Upvotes: 0
Reputation: 51
I have the same issue. For me running flutter pub get
worked. But I still don't know why this error happens
Upvotes: 5
Reputation: 91
I get exactly the same issue. I haven't found a fix yet but if you open the pub spec.yaml file and save it without making changes it solves the issue until you next run flutter clean.
Upvotes: 9