Class for the imageCache object.

Implements a least-recently-used cache of up to 1000 images. The maximum size can be adjusted using maximumSize. Images that are actively in use (i.e. to which the application is holding references, either via ImageStream objects, ImageStreamCompleter objects, ImageInfo objects, or raw dart:ui.Image objects) may get evicted from the cache (and thus need to be refetched from the network if they are referenced in the putIfAbsent method), but the raw bits are kept in memory for as long as the application is using them.

The putIfAbsent method is the main entry-point to the cache API. It returns the previously cached ImageStreamCompleter for the given key, if available; if not, it calls the given callback to obtain it first. In either case, the key is moved to the "most recently used" position.

Generally this class is not used directly. The ImageProvider class and its subclasses automatically handle the caching of images.

Constructors

ImageCache()

Properties

maximumSize int value
Maximum number of entries to store in the cache. [...]
read / write
hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

clear() → void
Evicts all entries from the cache. [...]
putIfAbsent(Object key, ImageStreamCompleter loader()) ImageStreamCompleter
Returns the previously cached ImageStream for the given key, if available; if not, calls the given callback to obtain it first. In either case, the key is moved to the "most recently used" position. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
Returns a string representation of this object.
inherited

Operators

operator ==(other) bool
The equality operator. [...]
inherited