checkConnectivity method

  1. @override
Future<ConnectivityResult> checkConnectivity()
override

Implementation

@override
// Method for checking connectivity by invoking the 'check' method on the platform.
Future<ConnectivityResult> checkConnectivity() {
  return methodChannel
      .invokeMethod<String>('check') // Invoke the 'check' method on the platform and get a String result.
      .then((value) => parseConnectivityResult(value ?? '')); // Convert the String result to a ConnectivityResult enum using the parseConnectivityResult function.
}