I have an app that shows a platform view (a map widget) with other widget on top and I need to take a screenshot of the map but I don't know how and the best that I got is a blank screen.
The desired result is a screenshot of the map only but a screenshot of everything on the screen, as the phonescreenshot does, is acceptable too.
I tried with the package Screenshot, Take Screenshot and Native Screenshot, plus, I tried wit the RenderRepaintBoundary technique
RenderRepaintBoundary boundary = scr.currentContext?.findRenderObject() as RenderRepaintBoundary;
ui.Image image = await boundary.toImage();
ByteData? byteData = await image.toByteData(format: ui.ImageByteFormat.png);
var img = byteData?.buffer.asUint8List();
And I even went over the first page on Google search!
Unfortunately the best that I obtained is a blank screenshot and these two errors:
[ERROR:flutter/flow/layers/platform_view_layer.cc(20)] Trying to embed a platform view but the PrerollContext does not support embedding
[ERROR:flutter/flow/layers/platform_view_layer.cc(35)] Trying to embed a platform view but the PaintContext does not support embedding
Can someone help me?
Ps. The map widget could be a Google Map or not, so "Use googleMapController.takeSnapshot()" is not an available answer.