When running flutter packages pub run build_runner watch
to generate model classes and keep the generated code up to date with the change I make. I can't build or install or hot reload the project I'm working on.
When I pressed the run button in intellij to compile and install the app I get the following error:
Waiting for another flutter command to release the startup lock...
When I kill the build_runner process it starts compiling and installing the project.
If I start the build_runner watch when the project is already running on a device or simulator/emulator
I get the follow error when I make a change to the code:
Initializing hot reload...
Your application could not be compiled, because its dependencies could not be established.
The following Dart file:
/Users/user/projects/project/lib/value_models/models.dart
...refers, in an import, to the following library:
/Users/user/projects/project/lib/value_models/models.g.dart
Unfortunately, that library does not appear to exist on your file system.
Is there a way to start a separate process for the code generation so we can keep compiling and running our apps during development?
@aegis123 I have faced this problem too.
As a workaround, you could set FLUTTER_ROOT
and then you can use flutter run
and pub run build_runner watch
(without flutter prefix) simultaneously
We need to release the lock before running pub.
@lfkdsk fixed this! Thanks!
Most helpful comment
We need to release the lock before running pub.