flutter sdk 版本升级到2.0或者更高的版本后,运行之前的代码会报错,比方:

Error: Cannot run with sound null safety, because the following dependenciesdon't support null safety: - package:flutter_swiper - package:flutter_page_indicator - package:transformer_page_viewFor solutions, see https://dart.dev/go/unsound-null-safetyFAILURE: Build failed with an exception.

下面的问题是,这些包不反对 safety模式。咱们能够在运行的时候增加--no-sound-null-safety。关上Android Studio,而后顺次抉择【Run】 -->【 Edit Configurations】 --> 【Add Additional Run args 】--> 【--no-sound-null-safety】,如下图。

而后,再次运行就没有谬误了。