encodeNamedImage function

Uint8List? encodeNamedImage(
  1. String path,
  2. Image image
)

Encode the image to the format determined by the file extension of path. If a format wasn't able to be identified, null will be returned. Otherwise the encoded format bytes of the image will be returned.

Implementation

Uint8List? encodeNamedImage(String path, Image image) {
  final encoder = findEncoderForNamedImage(path);
  if (encoder == null) {
    return null;
  }
  return encoder.encode(image);
}