vpnChanged function

Stream<bool> vpnChanged({
  1. String instanceName = '',
})

Whether a VPN is active, sent on every connectivity change.

Returns a broadcast Stream of events from the vpnChanged 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> vpnChanged({String instanceName = ''}) {
  if (instanceName.isNotEmpty) {
    instanceName = '.$instanceName';
  }
  final EventChannel vpnChangedChannel = EventChannel(
    'dev.flutter.pigeon.device_safety_info.DeviceSafetyEvents.vpnChanged$instanceName',
    pigeonMethodCodec,
  );
  return vpnChangedChannel.receiveBroadcastStream().map((dynamic event) {
    return event as bool;
  });
}