InternetConnectionChecker constructor

InternetConnectionChecker({
  1. void onInternetConnectionRestored()?,
  2. void onInternetConnectionLost()?,
})

Implementation

InternetConnectionChecker({
  void Function()? onInternetConnectionRestored,
  void Function()? onInternetConnectionLost,
}) {
  this._stream =
      Connectivity().onConnectivityChanged.listen((_) => this._debouncer());
  () async {
    await this.hasInternet();
    this.pHasInternet.addListener(() async {
      (this.pHasInternet.value
              ? onInternetConnectionRestored
              : onInternetConnectionLost)
          ?.call();
    });
  }();
}