如何减少Flutter的build_runner构建时间
我的项目越来越大,每次我运行build_runner时,构建都需要太多时间。我减少构建时间的想法是仅构建实际需要构建的文件,而这些文件是我当前功能目录的文件。
是否可以仅适用于单个文件夹或一个文件来运行build_runner?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以在构建器中设置启用的true或fals。
You can set enabled true or false in builder .
我发现使用
generate_for
单个构建器是提高速度的好方法。您可以:
.json.dart
给出文件,然后我使用lib/**。json.dart
用于generate_for
>。更多信息在此处: https://codewithandrea.com /提示/加速代码生成型跑步者 - dart-flutter/
I found that using
generate_for
for individual builders is a good way to increase the speed.You could:
.json.dart
and then I uselib/**.json.dart
for thegenerate_for
.More info here: https://codewithandrea.com/tips/speed-up-code-generation-build-runner-dart-flutter/
您可以考虑使用构建过滤器。
这是文章更聪明。
You can consider running the build runner on a subset of the files using the build-filter.
Here's an article where the author walks you through creating a shell script that runs the buildrunner more smartly.