Unverified Commit 46d07401 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[framework] clean up image provider documentation. (#131416)

Fixes https://github.com/flutter/flutter/issues/130524

loadBuffer was superseded by loadImage
parent 80c7dd72
...@@ -162,8 +162,8 @@ class ImageConfiguration { ...@@ -162,8 +162,8 @@ class ImageConfiguration {
/// Performs the decode process for use in [ImageProvider.load]. /// Performs the decode process for use in [ImageProvider.load].
/// ///
/// This typedef is deprecated. Use [DecoderBufferCallback] with /// This typedef is deprecated. Use [ImageDecoderCallback] with
/// [ImageProvider.loadBuffer] instead. /// [ImageProvider.loadImage] instead.
/// ///
/// This callback allows decoupling of the `cacheWidth`, `cacheHeight`, and /// This callback allows decoupling of the `cacheWidth`, `cacheHeight`, and
/// `allowUpscaling` parameters from implementations of [ImageProvider] that do /// `allowUpscaling` parameters from implementations of [ImageProvider] that do
...@@ -247,16 +247,16 @@ typedef ImageDecoderCallback = Future<ui.Codec> Function( ...@@ -247,16 +247,16 @@ typedef ImageDecoderCallback = Future<ui.Codec> Function(
/// using that key. This is handled by [resolveStreamForKey]. That method /// using that key. This is handled by [resolveStreamForKey]. That method
/// may fizzle if it determines the image is no longer necessary, use the /// may fizzle if it determines the image is no longer necessary, use the
/// provided [ImageErrorListener] to report an error, set the completer /// provided [ImageErrorListener] to report an error, set the completer
/// from the cache if possible, or call [loadBuffer] to fetch the encoded image /// from the cache if possible, or call [loadImage] to fetch the encoded image
/// bytes and schedule decoding. /// bytes and schedule decoding.
/// 4. The [loadBuffer] method is responsible for both fetching the encoded bytes /// 4. The [loadImage] method is responsible for both fetching the encoded bytes
/// and decoding them using the provided [DecoderCallback]. It is called /// and decoding them using the provided [DecoderCallback]. It is called
/// in a context that uses the [ImageErrorListener] to report errors back. /// in a context that uses the [ImageErrorListener] to report errors back.
/// ///
/// Subclasses normally only have to implement the [loadBuffer] and [obtainKey] /// Subclasses normally only have to implement the [loadImage] and [obtainKey]
/// methods. A subclass that needs finer grained control over the [ImageStream] /// methods. A subclass that needs finer grained control over the [ImageStream]
/// type must override [createStream]. A subclass that needs finer grained /// type must override [createStream]. A subclass that needs finer grained
/// control over the resolution, such as delaying calling [loadBuffer], must override /// control over the resolution, such as delaying calling [loadImage], must override
/// [resolveStreamForKey]. /// [resolveStreamForKey].
/// ///
/// The [resolve] method is marked as [nonVirtual] so that [ImageProvider]s can /// The [resolve] method is marked as [nonVirtual] so that [ImageProvider]s can
...@@ -610,9 +610,9 @@ abstract class ImageProvider<T extends Object> { ...@@ -610,9 +610,9 @@ abstract class ImageProvider<T extends Object> {
/// Converts a key into an [ImageStreamCompleter], and begins fetching the /// Converts a key into an [ImageStreamCompleter], and begins fetching the
/// image. /// image.
/// ///
/// This method is deprecated. Implement [loadBuffer] for faster image /// This method is deprecated. Implement [loadImage] for faster image
/// loading. Only one of [load] and [loadBuffer] must be implemented, and /// loading. Only one of [load] and [loadImage] must be implemented, and
/// [loadBuffer] is preferred. /// [loadImage] is preferred.
/// ///
/// The [decode] callback provides the logic to obtain the codec for the /// The [decode] callback provides the logic to obtain the codec for the
/// image. /// image.
...@@ -626,7 +626,7 @@ abstract class ImageProvider<T extends Object> { ...@@ -626,7 +626,7 @@ abstract class ImageProvider<T extends Object> {
'This feature was deprecated after v2.13.0-1.0.pre.', 'This feature was deprecated after v2.13.0-1.0.pre.',
) )
ImageStreamCompleter load(T key, DecoderCallback decode) { ImageStreamCompleter load(T key, DecoderCallback decode) {
throw UnsupportedError('Implement loadBuffer for faster image loading'); throw UnsupportedError('Implement loadImage for faster image loading');
} }
/// Converts a key into an [ImageStreamCompleter], and begins fetching the /// Converts a key into an [ImageStreamCompleter], and begins fetching the
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment