Skip to content

Instantly share code, notes, and snippets.

@perymerdeka
Created July 1, 2021 10:07
Show Gist options
  • Save perymerdeka/eef62944c248f7d9a0286c33e512ad58 to your computer and use it in GitHub Desktop.
Save perymerdeka/eef62944c248f7d9a0286c33e512ad58 to your computer and use it in GitHub Desktop.
import 'dart:convert';
import 'dart:io';
void main() async {
assetsGenerator();
}
void assetsGenerator({String assetsDir='/assets/images/'}) async {
var assetsPaths = Directory(Directory.current.path + assetsDir);
try {
var assetsList = assetsPaths.list();
await assetsList.forEach((element) {
String imageName = element.path.split('/').last;
String imagePath = element.path.split('/')[6] + '/' + element.path.split('/')[7] + '/' + imageName;
print(imagePath);
});
} catch (error) {
print(error.toString());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment