isNetworkConnected method

Future<bool> isNetworkConnected()

Use to get True or false for device is Connected to Internet provider or not It uses Connectivity_plus to fetch information.

Implementation

Future<bool> isNetworkConnected() async {
  final results = await Connectivity().checkConnectivity();

  if (results.isEmpty) {
    return false;
  } else if (results.contains(ConnectivityResult.none)) {
    return false;
  }
  return true;
}