showNoInternet method

dynamic showNoInternet()

Responsible for getting the current context from the tree and draw the custom widget

Implementation

showNoInternet() {
  currentContext = _contextKey.currentContext;
  if (currentContext != null) {
    if (_connectivityStyle == NoConnectivityStyle.SNACKBAR) {
      showSnackBar(currentContext!);
    } else if (_connectivityStyle == NoConnectivityStyle.ALERT) {
      showPlatformAlert();
    } else {
      _entry = OverlayEntry(builder: (context) {
        _overlayContext.add(context);
        return _userWidget ??
            Container(
              color: Colors.amber,
              child: Text("No Internet"),
            );
      });
      _entries.add(_entry!);
      _overlayState?.insert(_entry!);
    }
  }
}