onConnectivityChanged method

  1. @override
  2. @mustCallSuper
void onConnectivityChanged(
  1. ConnectivityResult result
)
override

Implementation

@override
@mustCallSuper
void onConnectivityChanged(ConnectivityResult result) {
  _connectivityStatus = result.name;
  final nowOnline = App.isOnline;
  // Connectivity was turned on
  if (_wasOffline && nowOnline) {
    _wasOffline = false;
    _turnedOnInternet = true;
    _turnedOffInternet = false;
  } else
  // Connectivity was turned off
  if (!_wasOffline && !nowOnline) {
    _wasOffline = true;
    _turnedOnInternet = false;
    _turnedOffInternet = true;
  } else {
    _turnedOnInternet = false;
    _turnedOffInternet = false;
  }
}