Open dcharkes opened 3 months ago
As discussed earlier:
In would be even nicer if adding all assets was enabled by default. This requires us to land automatic treeshaking of assets first, and needs special care because of existing asset folders.
And we could add bool recursive
param to the helper function.
Adding all files in a directory as data assets seems to be a common use case.
In Flutter, all files in a directory can be added as assets easily:
https://docs.flutter.dev/ui/assets/assets-and-images#specifying-assets
Using these assets in Flutter is via the full file path:
https://docs.flutter.dev/ui/assets/assets-and-images#loading-text-assets
We should be able to support this type of use case:
Implementation sketch:
With such an implementation we'd also establish a convention that the a data asset in
assets/foo.json
will be available at runtime aspackage:my_package/assets/foo.json
which aligns with the Flutter assets approach of making assets available via their full path.Inspired by https://github.com/dart-lang/native/pull/1345#discussion_r1679054714.
Open to alternative suggestions, WDYT @mosuem?