MediaCache class

Caches remote media files in temporary storage.

Constructors

MediaCache()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

clearCache({String? cacheSubdirectory, Duration? olderThan}) Future<int>
Deletes cache files and returns deleted count.
downloadAndCacheImage(String imageUrl, {String? cacheSubdirectory, String? fileNamePrefix}) Future<String?>
Image-only convenience wrapper.
downloadAndCacheMedia(String mediaUrl, {String? cacheSubdirectory, String? fileNamePrefix}) Future<String?>
Downloads media once and returns its local path.
downloadAndCacheVideo(String videoUrl, {String? cacheSubdirectory, String? fileNamePrefix}) Future<String?>
Video-only convenience wrapper.
getCachedMediaPath(String mediaUrl, {String? cacheSubdirectory, String? fileNamePrefix}) Future<String?>
Returns cached path if present, otherwise null.
getCacheSize({String? cacheSubdirectory}) Future<int>
Returns cache folder size in bytes.
isImageUrl(String url) bool
Returns true if URL extension matches an image type.
isVideoUrl(String url) bool
Returns true if URL extension matches a video type.

Constants

imageExtensions → const List<String>
videoExtensions → const List<String>