isOfflineError method
Determines whether error
was an offline error.
Implementation
@protected
@visibleForTesting
bool isOfflineError(Object? error) {
final commonExceptions = [
// timeouts via http's `connectionTimeout` are also socket exceptions
'SocketException',
'HttpException',
'HandshakeException',
'TimeoutException',
];
// we check exceptions with strings to avoid importing `dart:io`
final err = error.runtimeType.toString();
return commonExceptions.any(err.contains);
}