Created
June 30, 2021 15:44
-
-
Save perymerdeka/6a8ca44cc6e64d4c8a39dccb6041ce1d to your computer and use it in GitHub Desktop.
assets path reader example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// read image path | |
loadJson({String assetsPath='assets/AssetManifest.json'}) async { | |
final imageAssets = await rootBundle.loadString(assetsPath); | |
List<WallpaperModel> wallpaperModel = (json.decode(imageAssets) as List).map((e) => WallpaperModel.fromJson(e)).toList(); | |
wallpaperModel.forEach((element) => print(element.imagePath)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment