Failure class abstract

Available extensions
Annotations
  • @freezed

Constructors

Failure.cache([String? message])
const
factory
Failure.network([String? message])
const
factory
Failure.server([String? message])
const
factory
Failure.timeout([String? message])
const
factory
Failure.unauthorized([String? message])
const
factory
Failure.unexpected([String? message])
const
factory

Properties

copyWith → $FailureCopyWith<Failure>
Create a copy of Failure with the given fields replaced by the non-null parameter values.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
message String?
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

map<TResult extends Object?>({required TResult server(ServerFailure value), required TResult network(NetworkFailure value), required TResult unauthorized(UnauthorizedFailure value), required TResult timeout(TimeoutFailure value), required TResult cache(CacheFailure value), required TResult unexpected(UnexpectedFailure value)}) → TResult

Available on Failure, provided by the FailurePatterns extension

A switch-like method, using callbacks.
mapOrNull<TResult extends Object?>({TResult? server(ServerFailure value)?, TResult? network(NetworkFailure value)?, TResult? unauthorized(UnauthorizedFailure value)?, TResult? timeout(TimeoutFailure value)?, TResult? cache(CacheFailure value)?, TResult? unexpected(UnexpectedFailure value)?}) → TResult?

Available on Failure, provided by the FailurePatterns extension

A variant of map that fallback to returning null.
maybeMap<TResult extends Object?>({TResult server(ServerFailure value)?, TResult network(NetworkFailure value)?, TResult unauthorized(UnauthorizedFailure value)?, TResult timeout(TimeoutFailure value)?, TResult cache(CacheFailure value)?, TResult unexpected(UnexpectedFailure value)?, required TResult orElse()}) → TResult

Available on Failure, provided by the FailurePatterns extension

A variant of map that fallback to returning orElse.
maybeWhen<TResult extends Object?>({TResult server(String? message)?, TResult network(String? message)?, TResult unauthorized(String? message)?, TResult timeout(String? message)?, TResult cache(String? message)?, TResult unexpected(String? message)?, required TResult orElse()}) → TResult

Available on Failure, provided by the FailurePatterns extension

A variant of when that fallback to an orElse callback.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
when<TResult extends Object?>({required TResult server(String? message), required TResult network(String? message), required TResult unauthorized(String? message), required TResult timeout(String? message), required TResult cache(String? message), required TResult unexpected(String? message)}) → TResult

Available on Failure, provided by the FailurePatterns extension

A switch-like method, using callbacks.
whenOrNull<TResult extends Object?>({TResult? server(String? message)?, TResult? network(String? message)?, TResult? unauthorized(String? message)?, TResult? timeout(String? message)?, TResult? cache(String? message)?, TResult? unexpected(String? message)?}) → TResult?

Available on Failure, provided by the FailurePatterns extension

A variant of when that fallback to returning null

Operators

operator ==(Object other) bool
The equality operator.
inherited