My project is getting really big and every time I run build_runner it takes too much time to build. My idea to reduce the build time is to build only files that actually need building and those are files of my current feature directory.
Is there a way to run build_runner only for a single folder or a single file?
You can set enabled true or false in builder .
targets:
$default:
builders:
your_builder:
generate_for:
- lib/**/*.dart
mockito:mockBuilder:
enabled: false
json_serializable:
enabled: true
I found that using generate_for
for individual builders is a good way to increase the speed.
You could:
$default:
builders:
your_builder:
generate_for:
- lib/path/to/folder/**.dart
.json.dart
and then I use lib/**.json.dart
for the generate_for
.More info here: https://codewithandrea.com/tips/speed-up-code-generation-build-runner-dart-flutter/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With