getNetworkStatusWithAlert static method

void getNetworkStatusWithAlert(
  1. dynamic callback(
    1. bool isOnline
    ),
  2. BuildContext context,
  3. Widget snackBarWidget,
  4. Color backgroundColor,
)

Implementation

static void getNetworkStatusWithAlert(Function(bool isOnline) callback,BuildContext context,Widget snackBarWidget,Color backgroundColor) {
  NetworkConnectivity.isNetworkAvailable().then((value) {
    callback.call(value);
    if (!value) {
      _showNoInternetSnackBar(context, snackBarWidget,backgroundColor);
    } else {
      ScaffoldMessenger.of(context).hideCurrentSnackBar();
    }
  });
}