Identifies an image without committing to the precise final asset. This allows a set of images to be identified and for the precise image to later be resolved based on the environment, e.g. the device pixel ratio.
To obtain an ImageStream from an ImageProvider, call resolve, passing it an ImageConfiguration object.
ImageProvides uses the global imageCache to cache images.
The type argument T
is the type of the object used to represent a resolved
configuration. This is also the type used for the key in the image cache. It
should be immutable and implement operator ==
and hashCode. Subclasses should
subclass a variant of ImageProvider with an explicit T
type argument.
The type argument does not have to be specified when using the type as an argument (where any image provider is acceptable).
- Implemented by
- Annotations
- optionalTypeArgs
Constructors
- ImageProvider()
-
Abstract const constructor. This constructor enables subclasses to provide const constructors so that they can be used in const expressions.
const
Properties
- hashCode → int
-
Get a hash code for this object.
read-only, inherited - runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Operators
-
operator ==(
other) → bool -
The equality operator.
inherited
Methods
-
load(
T key) → ImageStreamCompleter -
Converts a key into an ImageStreamCompleter, and begins fetching the image.
-
obtainKey(
ImageConfiguration configuration) → Future<T> -
Converts an ImageProvider's settings plus an ImageConfiguration to a key that describes the precise image to load.
-
resolve(
ImageConfiguration configuration) → ImageStream -
Resolves this image provider using the given
configuration
, returning an ImageStream. -
toString(
) → String -
Returns a string representation of this object.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited