renderImage method

Future<Image?> renderImage({
  1. double pixelRatio = 6,
})

Render a image from widget by this GlobalKey and return as ui.Image. Remember to surround your widget with WidgetsToImage and give it this GlobalKey

Implementation

Future<ui.Image?> renderImage({
  double pixelRatio = 6,
}) async {
  try {
    final boundary = currentContext?.boundary;
    return boundary?.toImage(pixelRatio: pixelRatio);
  } catch (e) {
    rethrow;
  }
}