captureAsPngBytes method
refer to capture.
Implementation
Future<Uint8List> captureAsPngBytes([double? pixelRatio]) async {
final image = capture(pixelRatio);
final bytes = await image.toByteData(format: ui.ImageByteFormat.png);
return bytes!.buffer.asUint8List();
}