getCachedImagePathsFromDocument method
Retrieves cached image paths from a Quill document, primarily for mobile platforms.
it's not supported on web for now
This function scans a Quill document to identify and return paths to locally cached images. It is specifically designed for mobile operating systems (Android and iOS).
replaceUnexistentImagesWith
is an optional parameter.
If provided, it replaces non-existent image paths
with the specified value. If not provided, non-existent
image paths are removed from the result.
Returns a list of cached image paths found in the document. On non-mobile platforms, this function returns an empty list.
Implementation
Iterable<String> getCachedImagePathsFromDocument({
String? replaceUnexistentImagesWith,
}) {
_webIsNotSupported('getCachedImagePathsFromDocument');
final imagePaths = getImagesPathsFromDocument(
onlyLocalImages: true,
);
// We don't want the not cached images to be saved again for example.
final cachesImagePaths = imagePaths.where((imagePath) {
final isCurrentImageCached = isImageCached(imagePath);
return isCurrentImageCached;
}).toList();
return cachesImagePaths;
}