loadAllFromPattern method
Loads all images under directory that match the specified pattern.
Images are cached under their full path, as listed in the asset manifest.
Implementation
Future<List<Image>> loadAllFromPattern(
Pattern pattern, {
required String directory,
}) async {
assert(
directory.isEmpty || directory.endsWith('/'),
'directory must be empty or end with a "/"',
);
final manifest = await AssetManifest.loadFromAssetBundle(bundle);
final imagePaths = manifest.listAssets().where((path) {
return path.startsWith(directory) && path.toLowerCase().contains(pattern);
});
return loadAll(imagePaths.toList());
}