Кроссплатформенные проверки типов ошибок dart:io.
Типы dart:io (SocketException, FileSystemException и т.д.) не существуют
на web, поэтому мапперы не могут обращаться к ним напрямую. Эти probes
сохраняют семантику на VM/mobile/desktop и возвращают false/null на web,
где такие ошибки невозможны.
Пример
if (PlatformExceptions.isSocketException(error)) {
final message = PlatformExceptions.socketMessage(error);
// обработка сетевой ошибки...
}
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
fileSystemDetails(
Object? error) → ({String message, String? path})? -
Детали ошибки файловой системы:
(path, message)илиnull. -
httpMessage(
Object? error) → String? -
Сообщение
HttpExceptionилиnull, еслиerrorне являетсяHttpException. -
isFileSystemException(
Object? error) → bool -
Проверяет, является ли
errorэкземпляромFileSystemException. -
isHandshakeException(
Object? error) → bool -
Проверяет, является ли
errorэкземпляромHandshakeException. -
isHttpException(
Object? error) → bool -
Проверяет, является ли
errorэкземпляромHttpException. -
isPathNotFoundException(
Object? error) → bool -
Проверяет, является ли
errorэкземпляромPathNotFoundException. -
isSocketException(
Object? error) → bool -
Проверяет, является ли
errorэкземпляромSocketException. -
isTlsException(
Object? error) → bool -
Проверяет, является ли
errorэкземпляромTlsException. -
socketMessage(
Object? error) → String? -
Сообщение
SocketExceptionилиnull, еслиerrorне являетсяSocketException.