ReadResult<T> class
sealed
////////////// READ RESULTS ////////////// Outcome of an attempted read operation. It may have succeeded, failed, or had no chance due to connectivity issues.
- Available extensions
- Annotations
-
- @Freezed.new()
Constructors
- ReadResult.failure(FailureReason reason, String message)
-
Represents a failure with the write, resulting from either an unexpected
problem on the server or the server rejecting the client's request.
The
messageproperty should be suitable for showing the user.constfactory - ReadResult.fromApiError(ApiError e)
-
Builder for a failed write attemped, derived from its
ApiError.factory - ReadResult.success(T? item, {required RequestDetails details})
-
Container for the results of a single object read that did not encounter
any errors. Note that the requested object may be null, which is not an
error.
constfactory
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
-
errorOrRaise(
) → ReadFailure< T> -
Helper to extract expected
ReadFailureobjects or throw in the case of an unexpectedReadSuccess. -
getOrRaise(
) → ReadSuccess< T> -
Helper to extract expected
ReadSuccessobjects or throw in the case of an unexpectedReadFailure. -
itemOrRaise(
) → T? -
Helper to extract expected
T?objects or throw in the case of an unexpectedReadFailure. -
map<
TResult extends Object?> ({required TResult success(ReadSuccess< T> value), required TResult failure(ReadFailure<T> value)}) → TResult -
Available on ReadResult<
AT> , provided by the ReadResultPatterns extensionswitch-like method, using callbacks. -
mapOrNull<
TResult extends Object?> ({TResult? success(ReadSuccess< T> value)?, TResult? failure(ReadFailure<T> value)?}) → TResult? -
Available on ReadResult<
A variant ofT> , provided by the ReadResultPatterns extensionmapthat fallback to returningnull. -
maybeMap<
TResult extends Object?> ({TResult success(ReadSuccess< T> value)?, TResult failure(ReadFailure<T> value)?, required TResult orElse()}) → TResult -
Available on ReadResult<
A variant ofT> , provided by the ReadResultPatterns extensionmapthat fallback to returningorElse. -
maybeWhen<
TResult extends Object?> ({TResult success(T? item, RequestDetails details)?, TResult failure(FailureReason reason, String message)?, required TResult orElse()}) → TResult -
Available on ReadResult<
A variant ofT> , provided by the ReadResultPatterns extensionwhenthat fallback to anorElsecallback. -
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 success(T? item, RequestDetails details), required TResult failure(FailureReason reason, String message)}) → TResult -
Available on ReadResult<
AT> , provided by the ReadResultPatterns extensionswitch-like method, using callbacks. -
whenOrNull<
TResult extends Object?> ({TResult? success(T? item, RequestDetails details)?, TResult? failure(FailureReason reason, String message)?}) → TResult? -
Available on ReadResult<
A variant ofT> , provided by the ReadResultPatterns extensionwhenthat fallback to returningnull
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited