isNetworkError method

  1. @protected
  2. @visibleForTesting
bool isNetworkError(
  1. dynamic error
)
inherited

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');
}