allowScreenshotsGlobally method

  1. @override
Future<void> allowScreenshotsGlobally()
override

Allows screenshots globally across the app using native platform methods.

This method invokes the allowScreenshotsGlobally method on the native platform to clear security flags across the entire app, enabling screenshots and screen recording. If an error occurs, a PlatformException is thrown with a descriptive error message.

Implementation

@override
Future<void> allowScreenshotsGlobally() async {
  try {
    await methodChannel.invokeMethod('allowScreenshotsGlobally');
  } on PlatformException catch (e) {
    throw 'Failed to globally allow screenshots: ${e.message}';
  }
}