How to Mix Sound Null Safety and Unsound Null Safety in Flutter

4.3k Views Asked by At

I am building a Flutter app and I need to use the flutter_redux package for my global state management.

Unfortunately when I added it and try to execute my app I am getting the below error:

Error: Cannot run with sound null safety, because the following dependencies
don't support null safety:

 - package:redux
 - package:flutter_redux

Please, how can I resolve this?

1

There are 1 best solutions below

0
On

// @dart=2.9 - add this as is to the top of main.dart file

Alternatively, set the language version in the entrypoint — the file that contains main() function — to 2.9. In Flutter apps, this file is often named lib/main.dart. In command-line apps, this file is often named bin/.dart. You can also opt out files under test, because they are also entrypoints.

https://dart.dev/null-safety/unsound-null-safety

From dart.dev, I used it when I was having problems with packages without null-safety.