takeScreenshot abstract method
- TakeScreenshotCallback callback
Asynchronously retrieves a screenshot of the map view.
Note that on Android devices this may not work when the map view is currently not visible, for example, when an application is running in background and onPause() was called. On iOS devices the GPU cannot be used when running in background and taking a screenshot is therefore not possible when the map view is not visible.
The image is returned in a Dart ImageInfo object. The image itself can be accessed from the ImageInfo.image member and its dimensions from the ImageInfo.image.width and the ImageInfo.image.height members. These are represented as physical pixels, not device independent pixels.
If a Flutter Image widget is desired, it can be created thus:
final ByteData byteData = await imageInfo.image.toByteData(format: ui.ImageByteFormat.png); Image widget = Image.memory(byteData.buffer.asUint8List());
callback Completion handler called when the screenshot is completed
Implementation
void takeScreenshot(TakeScreenshotCallback callback);