每次启动flutter项目时,都要执行flutter pub run build_runner watch
,有时候多model的情况下还得执行多次,使用如下方法,每次打开项目时自动执行。
File → Settings → Startup Tasks → Add New Configuration → Shell Script
Name: build_runner watch
Execute: Script text
Script text: flutter pub run build_runner watch
Apply
Ok
Ok
Restart Android Studio
摘自:
Automatically launching “build_runner watch” for Flutter/Dart