takeScreenshot static method

Future<void> takeScreenshot()

Asynchronously takes a screenshot of the current screen.

If screenshots are disabled through AgentConfiguration.screenshotsEnabled or through the controller UI, this method does nothing.

This will capture everything, including personal information, so you must be cautious of when to take the screenshot.

These screenshots will show up in the Sessions screen for this user.

The screenshots are taken on a background thread, compressed, and only non-redundant parts are uploaded, so it is safe to take many of these without impacting the performance of your application.

Method might throw Exception.

Implementation

static Future<void> takeScreenshot() async {
  try {
    await channel.invokeMethod<void>('takeScreenshot');
  } on PlatformException catch (e) {
    throw Exception(e.details);
  }
}