toImagePng method

Future<Uint8List?> toImagePng({
  1. double pixelRatio = 1.0,
  2. FutureOr<void> onError(
    1. Object error,
    2. StackTrace stackTrace
    )?,
})

Implementation

Future<Uint8List?> toImagePng({
  double pixelRatio = 1.0,
  FutureOr<void> Function(Object error, StackTrace stackTrace)? onError,
}) async {
  try {
    return await currentContext!.toImagePng(
      pixelRatio: pixelRatio,
      onError: onError,
    );
  } catch (e, stack) {
    if (onError != null) {
      await onError(e, stack);
    }
    return null;
  }
}