-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conflict build process when used with build_runner
#14
Comments
build_runner
build_runner
I think the manual method of generation still works:
it would be nice to document it. Perhaps it could also use config from pubspec instead of command line arguments (intl-file, etc.). |
Seems to work when you add it to
|
@kuhnroyal I just tried that and |
@hiaw correct, if you want to run from command line (the old method), then there is no point in calling |
Sorry I must have missed something. There's a new method? Or do you mean the manual method you commented before? I only see |
There are multiple ways of doing code generation in flutter:
As you have noticed, methods 1 and 2 do not play nicely with each other, so you can switch to method 3 for r_flutter. Readme does not mention it, but it still works. |
Sorry for the late response. |
One problem with manually generating the file is that people will want to commit it, and then absolute paths in asset docs do not look great. I tried to find a solution for VSCode but found nothing. I created a feature request to support relative paths, but it may be never implemented: microsoft/vscode#86564 The same problem probably exists in Android Studio. |
I agree with commiting the generated file, but actually I dont see the need to have absolute paths in the comments of the generated file. For image paths VSC's Dartcode plugin will give you a gutter preview of the image using only a relative file path in the actual static's value without needing the code comment at all. In regards to using |
Sorry I stand corrected, looks like the general recommendation is not to commit generated files. I do wonder then about requiring a build step for then running the code generator when building in a CI system, but perhaps thats taken care of by Flutters new |
Slightly offtopic, but I need 10 more upvotes for the VSCode feature request that I have posted. Otherwise they will just close it. All help appreciated. |
I was trying to do JSON parsing and the recommended way uses
build_runner
. But afterbuild_runner
ran, the asset.dart file is deleted.Running
flutter generate
again will not regenerateasset.dart
.Currently just doing JSON parsing by hand instead of the recommended way but would be great if we can solve this.
The text was updated successfully, but these errors were encountered: