loadImage method
ImageStreamCompleter
loadImage(
- AssetEntityImageProvider key,
- ImageDecoderCallback decode
override
Converts a key into an ImageStreamCompleter, and begins fetching the image.
For backwards-compatibility the default implementation of this method returns an object that will cause resolveStreamForKey to consult loadBuffer. However, implementors of this interface should only override this method and not loadBuffer, which is deprecated.
The decode
callback provides the logic to obtain the codec for the
image.
See also:
- ResizeImage, for modifying the key to account for cache dimensions.
Implementation
@override
ImageStreamCompleter loadImage(
AssetEntityImageProvider key,
ImageDecoderCallback decode,
) {
return MultiFrameImageStreamCompleter(
codec: _loadAsync(key, decode),
scale: 1.0,
debugLabel: '${key.entity.runtimeType}-'
'${key.entity.id}-'
'${isOriginal ? 'origin-' : ''}'
'${isOriginal ? '' : '$thumbnailFormat'}',
informationCollector: () {
return <DiagnosticsNode>[
DiagnosticsProperty<ImageProvider>('Image provider', this),
DiagnosticsProperty<AssetEntityImageProvider>('Image key', key),
DiagnosticsProperty<AssetEntity>('entity', entity),
DiagnosticsProperty<bool>('isOriginal', isOriginal),
DiagnosticsProperty<ThumbnailSize>('thumbnailSize', thumbnailSize),
DiagnosticsProperty<ThumbnailFormat>(
'thumbnailFormat',
thumbnailFormat,
),
DiagnosticsProperty<int>('frame', frame),
];
},
);
}