Skip to content

Instantly share code, notes, and snippets.

@perymerdeka
Created June 30, 2021 15:44
Show Gist options
  • Save perymerdeka/6a8ca44cc6e64d4c8a39dccb6041ce1d to your computer and use it in GitHub Desktop.
Save perymerdeka/6a8ca44cc6e64d4c8a39dccb6041ce1d to your computer and use it in GitHub Desktop.
assets path reader example
// 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