blockScreenshots static method

Future<void> blockScreenshots()

Blocks screenshot capture if it is currently unblocked; otherwise this has no effect. Returns a Future which resolves when screenshots are effectively blocked.

If screenshots are disabled through AgentConfiguration.screenshotsEnabled or through the controller UI, this method has no effect.

WARNING: This will block capture for the entire app.

The user is expected to manage any possible nesting issues that may occur if blocking and unblocking occur in different code paths.

Method might throw Exception.

See Instrumentation.unblockScreenshots.

Implementation

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