Cannot run with sound null safety

created at 08-17-2021 views: 10

After the flutter sdk version is upgraded to 2.0 or higher, an error will be reported when running the previous code, such as:

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

 - package:flutter_swiper
 - package:flutter_page_indicator
 - package:transformer_page_view

For solutions, see

FAILURE: Build failed with an exception.

The problem above is that these packages do not support safety mode. We can add --no-sound-null-safety at runtime. Open Android Studio, and then select [Run] -->[Edit Configurations] --> [Add Additional Run args] --> [--no-sound-null-safety], as shown in the figure below.

run/debug configuration

Then, run it again and there is no error.

created at:08-17-2021
edited at: 08-17-2021: