instantiateImageCodecWithSize method
- ImmutableBuffer buffer, {
- TargetImageSizeCallback? getTargetSize,
Calls through to dart:ui.instantiateImageCodecWithSize from ImageCache.
The buffer
parameter should be an ui.ImmutableBuffer instance which can
be acquired from ui.ImmutableBuffer.fromUint8List or
ui.ImmutableBuffer.fromAsset.
The getTargetSize
parameter, when specified, will be invoked and passed
the image's intrinsic size to determine the size to decode the image to.
The width and the height of the size it returns must be positive values
greater than or equal to 1, or null. It is valid to return a TargetImageSize
that specifies only one of width
and height
with the other remaining
null, in which case the omitted dimension will be scaled to maintain the
aspect ratio of the original dimensions. When both are null or omitted,
the image will be decoded at its native resolution (as will be the case if
the getTargetSize
parameter is omitted).
Implementation
Future<ui.Codec> instantiateImageCodecWithSize(
ui.ImmutableBuffer buffer, {
ui.TargetImageSizeCallback? getTargetSize,
}) {
return ui.instantiateImageCodecWithSize(buffer, getTargetSize: getTargetSize);
}