flutter sdk 版本升级到2.0或者更高的版本后就发现运行时会报错:
Xcode's output:
↳
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 https://dart.dev/go/unsound-null-safety
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
warning: Capabilities for Signing & Capabilities may not function correctly because its entitlements use a placeholder team ID. To resolve this, select a development team
in the Runner editor. (in target 'Runner' from project 'Runner')
也就是说以上有些包不支持 safety模式。
解决方案:--no-sound-null-safety
run
flutter run --no-sound-null-safety
build
flutter build apk --no-sound-null-safety
解决方案二:
flutter_swiper_null_safety