haveConnectivity function

Future<bool> haveConnectivity({
  1. bool showToast = true,
})

Implementation

Future<bool> haveConnectivity({bool showToast = true}) async {
  var connection = await Connectivity().checkConnectivity();
  if (connection == ConnectivityResult.none && showToast) {
    Fluttertoast.showToast(msg: S.of().networkErrorTip);
  }
  return connection != ConnectivityResult.none;
}