renderToPng method

Future<Uint8List> renderToPng(
  1. double width,
  2. double height
)

Implementation

Future<Uint8List> renderToPng(double width, double height) async {
  final recorder = renderToPictureRecorder(width, height);
  final image = await recorder.endRecording().toImage(width.toInt(), height.toInt());
  return (await image.toByteData(format: ImageByteFormat.png))!.buffer.asUint8List();
}