captureAsPngBytes method

Future<Uint8List> captureAsPngBytes({
  1. double pixelRatio = 1,
  2. Duration delay = const Duration(milliseconds: 20),
})

Captures a Uint8List. delay is to avoid a bug, you do not need to send it

Implementation

Future<Uint8List> captureAsPngBytes({
  double pixelRatio = 1,
  Duration delay = const Duration(milliseconds: 20),
}) async {
  return Future.delayed(delay, () async {
    try {
      final boundary = _getRenderRepaintBoundary();

      return await _getPngBytes(boundary, pixelRatio);
    } on Exception {
      throw (Exception);
    }
  });
}