loadBuffer method

  1. @override
  2. @Deprecated('Implement loadImage for image loading. ' 'This feature was deprecated after v3.7.0-1.4.pre.')
ImageStreamCompleter loadBuffer(
  1. ResizeImageKey key,
  2. DecoderBufferCallback decode

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.


  'Implement loadImage for image loading. '
  'This feature was deprecated after v3.7.0-1.4.pre.',
ImageStreamCompleter loadBuffer(ResizeImageKey key, DecoderBufferCallback decode) {
  Future<ui.Codec> decodeResize(ui.ImmutableBuffer buffer, {int? cacheWidth, int? cacheHeight, bool? allowUpscaling}) {
      cacheWidth == null && cacheHeight == null && allowUpscaling == null,
      'ResizeImage cannot be composed with another ImageProvider that applies '
      'cacheWidth, cacheHeight, or allowUpscaling.',
    return decode(buffer, cacheWidth: width, cacheHeight: height, allowUpscaling: this.allowUpscaling);

  final ImageStreamCompleter completer = imageProvider.loadBuffer(key._providerCacheKey, decodeResize);
  if (!kReleaseMode) {
    completer.debugLabel = '${completer.debugLabel} - Resized(${key._width}×${key._height})';
  _configureErrorListener(completer, key);
  return completer;