imgToRgba function

Future<Uint8List> imgToRgba(
  1. dynamic image
)

Converts an Image object to raw RGBA bytes.

Parameters:

  • image: The source Image object

Returns a Future that completes with the image data as RGBA bytes.

Implementation

Future<Uint8List> imgToRgba(Image image) async {
  final data = await image.toByteData(format: ImageByteFormat.rawRgba);
  return data!.buffer.asUint8List();
}