-
Notifications
You must be signed in to change notification settings - Fork 19
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
References are not generating for assets with same file name. #36
Comments
Can you share file structure here? |
For example: |
I see. Please share exact configuration file as well. |
|
Because both of the files fall under the same group and we are using file names as dart reference names, it is most likely that it is being overridden because of the same name. While we can add some suffix (like img1 and img2) to the reference name, it is not ideal to do that. It also makes it hard for the user to identify which is which. You can do 2 things here:
groups:
- path: assets
class_name: Assets
- path: assets/profile
class_name: ProfileAssets
Let me know if this is helpful. Thanks. |
Using separate class names is not always convenient because we need to remember (or check) which class contains which reference. Renaming is an option but probably names conflict should be marked more clear so user always notice it. |
Hmm....this could be tricky though for OS where file system is case sensitive which allows you to store 2 different files with same name and deferred case (e.g. Linux). I agree to let the user know about this conflict. Perhaps we could add a warning/error in the console output to let the user know why it did not generate certain file reference or why it failed. I liked the prefix idea. I'll think on it and try to create a prototype. Thanks for this insights. |
Thanks. Perhaps it is better to generate some error marks directly in output files so we can not build a project normally without fixing conflicts. Otherwise console output can be ignored and we get runtime issue. |
@vcrash That would require to add error in the codegen. Interesting! This conflicts with how this package's internals work so it would require special provisions perhaps. Let me give this some thought. |
@BirjuVachhani May be we could generate references with type of Error instead of String in a case of name conflict? It would cause an error during types resolving analysis except somebody is using asset path as a dynamic type var. Looks a little bit tricky but may do the job. Just for thoughts. |
When assets with same file name are containing in different subdirectories reference will be generated only for a single asset.
Expecting references are generated for each asset with specified paths.
The text was updated successfully, but these errors were encountered: