instantiateImageCodec method

Future<Codec> instantiateImageCodec(
  1. Uint8List data,
  2. ImageDecoderCallback decode
)

Override this method, so that you can handle raw image data, for example, compress

Implementation

Future<ui.Codec> instantiateImageCodec(
  Uint8List data,
  ImageDecoderCallback decode,
) async {
  if (cacheRawData) {
    rawImageDataMap[this] = data;
  }
  final ui.ImmutableBuffer buffer =
      await ui.ImmutableBuffer.fromUint8List(data);
  return await decode(buffer);
}