初学Flutter遇见的问题(1)

Flutter 升级高版本后,build 报错,用Android Studio开发,尝试依赖第三方包之后,在运行编译时报错:Error: Cannot run with sound null safety, because the following dependencies

解决方法:

  1. 通过命令运行:
1
2
3
flutter run --no-sound-null-safety  #run

flutter build apk --no-sound-null-safety #build
  1. 设置Android Studio启动参数
1
--no-sound-null-safety

D2__R__6XOHAE9B@__4CI13.png

3__~XCKDL3__6IN_WR~YC72.png

保存,再用Android Studio 运行就没问题了。