isNetworkError method
Determines whether error
was a network error.
Implementation
@protected
@visibleForTesting
bool isNetworkError(error) {
// timeouts via http's `connectionTimeout` are
// also socket exceptions
// we check the exception like this in order not to import `dart:io`
final _err = error.toString();
return _err.startsWith('SocketException') ||
_err.startsWith('Connection closed before full header was received') ||
_err.startsWith('HandshakeException');
}