Assets
Asset has its own module which aims to support all other modules so that they can use the asset, the location of the assets is in ./assets
Usages
Here are the steps for creating a logo.png image file as an example:
Add the logo files to the
assets/assets/images/
folderGenerate constants with the Morpheme CLI command:
morpheme assets
Learn more about command assets here
The logo constant will be generated in the
core/assets/lib/morpheme_images.dart
fileinfoAdjust the placement of the assets that we use
- Image file path
assets/assets/images/
constant will be generated in the filecore/assets/lib/morpheme_images.dart
- The file path icon
assets/assets/icons/
constant will be generated in the filecore/assets/lib/morpheme_icons.dart
- The path of the json file
assets/assets/json/
constant will be generated in the filecore/assets/lib/morpheme_json.dart
- Image file path
Now you can use
MorphemeImages.logo
in your codeImage.asset(MorphemeImages.logo);