Error: A library can't opt out of null safety by default, when using sound null safety
The problem also occurs when you have a mixed-version code i.e. the code is not fully migrated to sound null safety. To run the app:
Using IDE
Add
// @dart=2.9
at the top in yourmain.dart
file and run the app using the Play ► icon.// @dart=2.9import 'package:flutter/material.dart';void main() { //...}
Using command line
flutter run --no-sound-null-safety
or to be specific (say in chrome)
flutter run -d chrome --no-sound-null-safety