addImage method

  1. @override
Future<void> addImage(
  1. Uint8List imageData
)
override

Implementation

@override
Future<void> addImage(Uint8List imageData) async {
  // Encode the image to a specific format (e.g., PNG)
  // ui.Codec codec = await ui.instantiateImageCodec(imageData);
  // ui.FrameInfo frameInfo = await codec.getNextFrame();
  // ui.Image image = frameInfo.image;

  // Convert the image to a PNG byte array
  // List<int> bytes = await image
  //     .toByteData(format: ui.ImageByteFormat.png)
  //     .then((byteData) =>
  //         byteData == null ? [] : byteData.buffer.asUint8List());
  List<int> bytes = imageData.toList();
  return await methodChannel.invokeMethod('addImage', base64Encode(bytes));
}