在 Flutter SDK 升级到 2.0 或者更高的版本 , 运行时会发现不少三方插件会报错 .

1
2
3
4
5
6
7
8
9
10
11
12
13
Error: Cannot run with sound null safety, because the following dependencies
don't support null safety:

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

For solutions, see https://dart.dev/go/unsound-null-safety


FAILURE: Build failed with an exception.

也就是说以上有些包不支持 Safety 模式 .

解决方案: --no-sound-null-safety

  • run
    flutter run --no-sound-null-safety
  • build
    flutter build apk --no-sound-null-safety