Home > Mobile >  How to add //@dart=2.9 in dart file
How to add //@dart=2.9 in dart file

Time:12-20

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?

CodePudding user response:

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

  • Related