toImageAsPngBytes method

Future<Uint8List> toImageAsPngBytes([
  1. double? pixelRatio
])

refer to toImage.

Implementation

Future<Uint8List> toImageAsPngBytes([double? pixelRatio]) async {
  final image = toImage(pixelRatio);
  final bytes = await image.toByteData(format: ui.ImageByteFormat.png);
  return bytes!.buffer.asUint8List();
}