exportToImage method
Implementation
Future<ui.Image> exportToImage(GlobalKey boundaryKey) async {
final RenderRepaintBoundary? boundary =
boundaryKey.currentContext?.findRenderObject()
as RenderRepaintBoundary?;
if (boundary == null) {
throw Exception('Editor boundary not found');
}
final ui.Image image = await boundary.toImage(
pixelRatio: ui.window.devicePixelRatio,
);
return image;
}