ReadListResult<T> class
sealed
Outcome of an attempted bulk read operation. It may have succeeded, failed, or had no chance due to connectivity issues.
- Available extensions
- Annotations
-
- @Freezed.new()
Constructors
-
ReadListResult({required Iterable<
T> items, required Map<String, T> itemsMap, required Set<String> missingItemIds, required RequestDetails details}) -
Container for the results of a list read that did not encounter any
errors. Note that the list of results may be empty, which is not an error.
constfactory
-
ReadListResult.empty(RequestDetails details, {Set<
String> missingItemIds = const <String>{}}) -
factory
- ReadListResult.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 - ReadListResult.fromApiError(ApiError e)
-
Builder for a failed write attemped, derived from its
ApiError.factory -
ReadListResult.fromList(Iterable<
T> items, RequestDetails details, Set<String> missingItemIds, String? getId(T)) -
List-friendly constructor.
factory
-
ReadListResult.fromMap(Map<
String, T> map, RequestDetails details, Set<String> missingItemIds) -
Map-friendly constructor.
factory
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(
) → ReadListFailure< T> -
Helper to extract expected
ReadListFailureobjects or throw in the case of an unexpectedReadListSuccess. -
getOrRaise(
) → ReadListSuccess< T> -
Helper to extract expected
ReadListSuccessobjects or throw in the case of an unexpectedReadListFailure. -
itemsOrRaise(
) → List< T> -
Helper to extract expected List<T> objects or throw in the case of
an unexpected
ReadListFailure. -
map<
TResult extends Object?> (TResult $default(ReadListSuccess< T> value), {required TResult failure(ReadListFailure<T> value)}) → TResult -
Available on ReadListResult<
AT> , provided by the ReadListResultPatterns extensionswitch-like method, using callbacks. -
mapOrNull<
TResult extends Object?> (TResult? $default(ReadListSuccess< T> value)?, {TResult? failure(ReadListFailure<T> value)?}) → TResult? -
Available on ReadListResult<
A variant ofT> , provided by the ReadListResultPatterns extensionmapthat fallback to returningnull. -
maybeMap<
TResult extends Object?> (TResult $default(ReadListSuccess< T> value)?, {TResult failure(ReadListFailure<T> value)?, required TResult orElse()}) → TResult -
Available on ReadListResult<
A variant ofT> , provided by the ReadListResultPatterns extensionmapthat fallback to returningorElse. -
maybeWhen<
TResult extends Object?> (TResult $default(Iterable< T> items, Map<String, T> itemsMap, Set<String> missingItemIds, RequestDetails details)?, {TResult failure(FailureReason reason, String message)?, required TResult orElse()}) → TResult -
Available on ReadListResult<
A variant ofT> , provided by the ReadListResultPatterns 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?> (TResult $default(Iterable< T> items, Map<String, T> itemsMap, Set<String> missingItemIds, RequestDetails details), {required TResult failure(FailureReason reason, String message)}) → TResult -
Available on ReadListResult<
AT> , provided by the ReadListResultPatterns extensionswitch-like method, using callbacks. -
whenOrNull<
TResult extends Object?> (TResult? $default(Iterable< T> items, Map<String, T> itemsMap, Set<String> missingItemIds, RequestDetails details)?, {TResult? failure(FailureReason reason, String message)?}) → TResult? -
Available on ReadListResult<
A variant ofT> , provided by the ReadListResultPatterns extensionwhenthat fallback to returningnull
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited