loadAllFromPattern method
Loads all images in the prefixed path that are matching the specified pattern.
Implementation
Future<List<Image>> loadAllFromPattern(Pattern pattern) async {
final manifestContent = await bundle.loadString('AssetManifest.json');
final manifestMap = json.decode(manifestContent) as Map<String, dynamic>;
final imagePaths = manifestMap.keys
.where((path) {
return path.startsWith(_prefix) &&
path.toLowerCase().contains(pattern);
})
.map((path) => path.replaceFirst(_prefix, ''));
return loadAll(imagePaths.toList());
}