takeScreenShot method
void
takeScreenShot()
Implementation
void takeScreenShot() async {
if (_previewContainerKey != null) {
List<Rect> rects = [];
ScreenMeetPlugin().listOfWidgetRects().forEach((rectGetter) {
var rect = rectGetter.getRect();
if (rect != null) {
rects.add(rect);
}
});
var previewContainerKey = ScreenMeetPlugin().screenSharingKey;
var boundary = previewContainerKey!.currentContext!.findRenderObject() as RenderRepaintBoundary;
var image = await boundary.toImage(pixelRatio: 1.0);
var byteData = await image.toByteData(format: ImageByteFormat.png);
sendScreenShot(byteData!, rects);
}
else {
// no key of the preview widget has been set
}
}