checkInternetConnection static method
void
checkInternetConnection()
Implementation
static void checkInternetConnection() {
try {
_timer = Timer.periodic(const Duration(seconds: 1), (timer) async {
try {
final result =
await ApiConstants.platform.invokeMethod('checkConnectivity');
_internetController.add(result);
} on PlatformException {
_internetController.add(false);
}
});
} catch (error) {
_internetController.add(false);
_emitError(UploadError(
CONNECTIVITY_ERROR_CODE, 'Error Checking Connectivity: $error'));
}
}