-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
When assets are loaded by package:flutter APIs, they rely on the current AssetBundle to determine how to load the assets. The widget previewer currently wraps each preview in a DefaultAssetBundle widget with a custom PreviewAssetBundle, which converts project-relative asset paths into package asset paths. This is done as the widget preview scaffold project imports the projects containing previews and packages their assets using the package asset path scheme.
For example, for a preview defined in a project named package_name:
/assets/bar.png -> packages/package_name/assets/bar.png
Unfortunately, since AssetBundle and DefaultAssetBundle are part of the framework and not dart:ui, providing a custom AssetBundle does not override the behavior of asset loading for dart:ui APIs. This means that project-relative asset paths provided to these APIs will not resolve correctly (package asset paths will continue to work as expected).
At time of writing, the following APIs are currently impacted: