instantiateImageCodec method

Future<Codec> instantiateImageCodec (
  1. Uint8List bytes,
  2. {int cacheWidth,
  3. int cacheHeight}
)

Calls through to dart:ui with decodedCacheRatioCap from ImageCache.

The cacheWidth and cacheHeight parameters, when specified, indicate the size to decode the image to.

Both cacheWidth and cacheHeight must be positive values greater than or equal to 1 or null. It is valid to specify only one of cacheWidth and cacheHeight with the other remaining null, in which case the omitted dimension will decode to its original size. When both are null or omitted, the image will be decoded at its native resolution.

Implementation

Future<ui.Codec> instantiateImageCodec(Uint8List bytes, {
  int cacheWidth,
  int cacheHeight,
}) {
  assert(cacheWidth == null || cacheWidth > 0);
  assert(cacheHeight == null || cacheHeight > 0);
  return ui.instantiateImageCodec(
    bytes,
    targetWidth: cacheWidth,
    targetHeight: cacheHeight,
  );
}