onConnectionChange property

Stream<bool> get onConnectionChange

A stream that notifies the app when the internet connectivity status changes.

Listeners will receive:

  • true when the device connects to the internet.
  • false when the device loses internet connectivity.

Example:

IDSInternetChecker.onConnectionChange.listen((isConnected) {
  if (isConnected) {
    print("Internet reconnected");
  } else {
    print("Internet connection lost");
  }
});

Implementation

static Stream<bool> get onConnectionChange {
  return _service.onConnectionChange;
}