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?
Asked
Active
Viewed 1,670 times
2 Answers
0
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

takudzw_M
- 186
- 1
- 5
0
Use like this
//@dart=2.9
Import 'package: flutter/material. Dart';
class dart extends StatefulWidget {
dart ({Key key}): super (key: key);
@override
_dartState createState () => _dartState();
}
class _dartState extends State<dart> {
@override
Widget builds (BuildContext context) => Scaffold();
}

buddemat
- 4,552
- 14
- 29
- 49

Rush tomato
- 26
- 5
-
Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 28 '21 at 09:15