GetAsset extension
Asset directories mapping for easy access.
### Usage ``` IconAsset.my_icon_name.png ```
### How it works If you want to add new file type extension for assets, then just make a copy of [png] or any defined type in [AssetX] and add it in the desired extension for Object class.
To use it, make an enum named Asset at the end and put the same asset name in that as in the asset directory i.e for icon directory, enum name must be as IconAsset
### Some key practices
-
Don't add file type extensions in the object of enums meaning no png or jpg at the end.
-
Use the underscore naming convention for all files in asset directory.
-
If you want to add new directory in assets, then make a similar enum with specific name and maps its directory name in
AssetX
. -
Also map that directory in
pubspec.yaml
under the assets property.
- on
Properties
Methods
-
asset(
[String? name]) → String -
imageAsset(
String name) → dynamic