connect static method
Check the connection status.
You can specify the callback when connected with onConnected
and
when disconnected with onDisconnected
.
Implementation
static Future<ConnectivityResult> connect(
{VoidCallback? onConnected, VoidCallback? onDisconnected}) async {
final result = await Connectivity().checkConnectivity();
if (result == ConnectivityResult.none) {
onDisconnected?.call();
} else {
onConnected?.call();
}
return result;
}