Generate assets reference in the pubspec manifest (like R.java in android)
See original GitHub issueCurrently, we have to manual define the assets reference. Eg:
final logo = "assets/images/logo.png"
For small resource -> ok. But if we have many resources => it would be good if we can generate those references. (Look likes R.java
in android world).
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:18 (10 by maintainers)
Top Results From Across the Web
How *Exactly* to Access Flutter Assets From Within Android ...
There's a handy trick to list all packaged assets, which helps to see what path they are at, and that they got packaged....
Read more >Indexing assets in a dart class just like R.java| Flutter - Medium
R.java contains a set of subclasses like drawable, mipmap etc which contains static variables to reference the assets & values.
Read more >Integrate asset delivery (Kotlin & Java) - Android Developers
Place assets in the src/main/assets directory. You can create subdirectories in here as well. The directory structure for your app should now look...
Read more >Flutter for Android developers
This document is meant for Android developers looking to apply their existing Android knowledge to build mobile apps with Flutter.
Read more >How to add Flutter modules to native Android project and test ...
Adding Flutter module to native Android · Depend on the Android Archive (AAR): This packages your Flutter library as a generic local Maven ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@zoechi I think this is different. https://github.com/flutter/flutter/pull/16413 => about including all assets by the given folder.
This issue is an extra step. After we scan the access -> we should generate an
R.dart
file which including references to the resource.Example for this case: https://github.com/fmatosqg/flutter_problem/blob/variants_PR_16413/lib/main.dart#L105
Instead write:
'assets/ic_error_outline_black_36dp.png',
We can use generate sourceR.dart
like:R.image.ic_error_outline_black
R.dart
is a source code file -> it can be autocomplete by the IDE.Would like to see the same kind of generation for internationalization (like R.string in android) 😃