loadBuffer method

Converts a key into an ImageStreamCompleter, and begins fetching the image.

This method is deprecated. Implement loadImage instead.

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 loadBuffer(image_provider.CachedNetworkImageProvider key,
    DecoderBufferCallback decode) {
  final chunkEvents = StreamController<ImageChunkEvent>();
  return MultiImageStreamCompleter(
    codec: _loadBufferAsync(key, chunkEvents, decode),
    chunkEvents: chunkEvents.stream,
    scale: key.scale,
    informationCollector: () sync* {
      yield DiagnosticsProperty<ImageProvider>(
        'Image provider: $this \n Image key: $key',
        this,
        style: DiagnosticsTreeStyle.errorProperty,
      );
    },
  );
}