storeImages method
Store all images from pasted contents to disk.
Implementation
Future<Map<int, String>> storeImages(
Map<int, Map<String, dynamic>> pastedContents,
) async {
final pathMap = <int, String>{};
for (final entry in pastedContents.entries) {
if (entry.value['type'] == 'image') {
final path = await storeImage(
id: entry.key,
type: 'image',
content: entry.value['content'] as String,
mediaType: entry.value['mediaType'] as String? ?? 'image/png',
);
if (path != null) pathMap[entry.key] = path;
}
}
return pathMap;
}