The current implementation relies on flutter being in the path. This is an issue since there might be constraints where flutter cannot be found.
|
final process = Process.runSync( |
|
'flutter', |
|
[ |
|
'pub', |
|
'run', |
|
'build_runner', |
|
'build', |
|
'--build-filter', |
|
_getBuildFilterList(files), |
|
'--delete-conflicting-outputs' |
|
], |
|
workingDirectory: Utils.projectDirectory, |
|
); |
This also means that this package is flutter specific. Though that is the most notable use of dart, the language starts being used in the backend as well (serverpod for instance) and that also implies code gen sometimes.
Using dart run instead of flutter pub run would be a good temp fix, but the long term solution would be to import the build_runner package and use its library of functions as much as possible to perform the code gen instead of calling it in a subprocess.
This also would remove the need to specify build_runner as a dependency explicitely in the pubspec of the packages to build.