isConnected static method
Checks if the device has an active internet connection.
This method performs both network interface checks (Wi-Fi, mobile data) and an actual internet availability test to ensure accuracy.
Returns:
true
if the device is connected to the internet.false
if there is no active internet connection.
Example:
bool isConnected = await IDSInternetChecker.isConnected();
if (isConnected) {
print("Internet is available");
} else {
print("No internet connection");
}
Implementation
static Future<bool> isConnected() {
return _service.hasInternetConnection();
}