widgetToIcon static method
Implementation
static Future<BitmapDescriptor> widgetToIcon(GlobalKey globalKey,
{Size? size}) async {
RenderRepaintBoundary boundary =
globalKey.currentContext?.findRenderObject() as RenderRepaintBoundary;
ui.Image image = await boundary.toImage(pixelRatio: 3.0);
ByteData? byteData = await image.toByteData(format: ui.ImageByteFormat.png);
return BitmapDescriptor.fromBytes(
byteData!.buffer.asUint8List(),
size: size,
);
}