screenRecordingChanged function
Recording state (Android 15+, iOS); the current state is sent first.
Returns a broadcast Stream of events from the screenRecordingChanged event channel.
Each call to this method creates a new EventChannel, so it should
not be called multiple times for the same instanceName. To deliver
events to multiple listeners, call this method once and listen to the
returned broadcast stream multiple times instead.
Implementation
Stream<bool> screenRecordingChanged({String instanceName = ''}) {
if (instanceName.isNotEmpty) {
instanceName = '.$instanceName';
}
final EventChannel screenRecordingChangedChannel = EventChannel(
'dev.flutter.pigeon.device_safety_info.DeviceSafetyEvents.screenRecordingChanged$instanceName',
pigeonMethodCodec,
);
return screenRecordingChangedChannel.receiveBroadcastStream().map((
dynamic event,
) {
return event as bool;
});
}