onConnectivityChanged property

Stream<List<ConnectivityResult>> onConnectivityChanged

Exposes connectivity update events from the platform.

On iOS, the connectivity status might not update when WiFi status changes, this is a known issue that only affects simulators. For details see https://github.com/fluttercommunity/plus_plugins/issues/479.

The emitted list is never empty. In case of no connectivity, the list contains a single element of ConnectivityResult.none. Note also that this is the only case where ConnectivityResult.none is present.

This method applies Stream.distinct over the received events to ensure only emiting when connectivity changes.

Implementation

Stream<List<ConnectivityResult>> get onConnectivityChanged {
  return _platform.onConnectivityChanged.distinct((a, b) => a.equals(b));
}