addListener static method
Add callback actions when screenshot or screen record events received, Supported for iOS only, do nothing when run on Android.
Implementation
static void addListener(
void Function()? screenshotListener,
void Function(bool)? screenRecordListener,
) async {
_onScreenshotListener = screenshotListener;
_onScreenRecordListener = screenRecordListener;
_channel.setMethodCallHandler(_methodCallHandler);
await _channel.invokeMethod('addListener');
}