The AssetBundle from which this application was loaded.
The rootBundle contains the resources that were packaged with the
application when it was built. To add resources to the rootBundle for your
application, add them to the assets
section of your flutter.yaml
manifest.
Rather than using rootBundle directly, consider obtaining the
AssetBundle for the current BuildContext
using DefaultAssetBundle.of
.
This layer of indirection lets ancestor widgets substitute a different
AssetBundle at runtime (e.g., for testing or localization) rather than
directly replying upon the rootBundle created at build time. For
convenience, the WidgetsApp
or MaterialApp
widget at the top of the
widget hierarchy configures the DefaultAssetBundle
to be the rootBundle.
See also:
DefaultAssetBundle
- NetworkAssetBundle