Assets

Assets — Is a file that is bundled and deployed with your app, and is accessible at runtime.

Include static data (for example, JSON files), configuration files, icons, and images (JPEG, WebP, GIF, animated WebP/GIF, PNG, BMP, and WBMP).

Specifying assets

Flutter uses the pubspec.yaml file, located at the root of your project, to identify assets required by an app.

Flutter:
assets:
- assets/my_icon.png
- assets/background.png

Your app can access its assets through an AssetBundle object.

The two main methods on an asset bundle allow you to load a string/text asset (loadString()) or an image/binary asset (load()) out of the bundle, given a logical key. The logical key maps to the path to the asset specified in the pubspec.yaml file at build time.

Sharing assets with the underlying platform

Flutter assets are readily available to platform code via AssetManager on Android and NSBundle on iOS.

Assets

Assets — Structure map

Clickable & Draggable!