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(
  FMTCImageProvider key,
  DecoderBufferCallback decode,
) {
  // ignore: close_sinks
  final StreamController<ImageChunkEvent> chunkEvents =
      StreamController<ImageChunkEvent>();

  return MultiFrameImageStreamCompleter(
    codec: _loadAsync(key: key, decode: decode, chunkEvents: chunkEvents),
    chunkEvents: chunkEvents.stream,
    scale: 1,
    debugLabel: coords.toString(),
    informationCollector: () => <DiagnosticsNode>[
      DiagnosticsProperty<Coords>('Coordinates', coords),
    ],
  );
}