You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Would like to be able to avoid asset load errors at runtime #11477
Currently with Flutter it's very easy to end up with asset load errors at runtime since assets are keyed off of strings, which are not in any way validated at analyze time (or generated/provided by the system).
Posse's currently most common crash in their live app is a failed asset string load.
They also have a manual file of string constants that they maintain from their pubspec.yaml (presumably could be autogenerated pretty easily).
This just seems like a pattern we could help with. This bug is about finding ideas to reduce the likelihood of this kind of failure.
I'm still keen to deliver this, I was never sure what was flutter team's opinion on it. My POC is frozen since the beta days. I'll come up with some MVP clean enough that it could be a PR. Soon (TM).
I'm a member of Fly-Mix Team from NetEase company. My team did develop a flutter development tool: Flr(Flutter-R) to support the feature that you want.
Flr is a flutter resource manager tool, which can help flutter developer to auto specify assets in pubspec.yaml and generate r.g.dart file which likes R.java in Android after he changes the flutter project assets. With r.g.dart, flutter developer can apply the asset in code by referencing it's asset ID function, such as:
Activity
Hixie commentedon May 8, 2018
We could autogenerate an enum of known asset names, or some such.
fmatosqg commentedon Mar 12, 2019
I'm still keen to deliver this, I was never sure what was flutter team's opinion on it. My POC is frozen since the beta days. I'll come up with some MVP clean enough that it could be a PR. Soon (TM).
YK-Unit commentedon Feb 26, 2020
Hi, all:
I'm a member of Fly-Mix Team from NetEase company. My team did develop a flutter development tool:
Flr(Flutter-R)to support the feature that you want.Flris a flutter resource manager tool, which can help flutter developer to auto specify assets inpubspec.yamland generater.g.dartfile which likesR.javain Android after he changes the flutter project assets. Withr.g.dart, flutter developer can apply the asset in code by referencing it's asset ID function, such as:PS: yes, it is just like the AAPT(Android Asset Packaging Tool) in Android.
Up to now, Flr has supported Android Studio Plugin, CLI, and VSCode Extension:
Flr Android Studio Plugin Version
GitHub: https://github.com/Fly-Mix/flr-as-plugin
Plugin Homepage: https://plugins.jetbrains.com/plugin/13789-flr
flr-as-plugin Usage Example Gif:
Flr CLI Version
GitHub: https://github.com/Fly-Mix/flr-cli
CLI Homepage: https://rubygems.org/gems/flr
flr-cli Usage Example Gif:
Flr VSCode Extension Version
GitHub: https://github.com/Fly-Mix/flr-vscode-extension
Extension Homepage: https://marketplace.visualstudio.com/items?itemName=LincolnLaw.flr
flr-vscode-extension Usage Example: