How to add //@dart=2.9 in dart file

Issue

Now I’m working in flutter project.
I need to add //@dart=2.9 in dart file.
But i got run time error. Like A library can’t opt out of null safety by default,when using sound null safety.
How can i add it on dart file?

Solution

add it at the top of main.dart.

then run
$ flutter clean
$ flutter pub get

if this does not work,check this https://dart.dev/null-safety/migration-guide

Answered By – takudzw_M

Answer Checked By – Senaida (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *