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.
const
factory
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 message property should be suitable for showing the user.
const
factory
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 ReadListFailure objects or throw in the case of an unexpected ReadListSuccess.
getOrRaise() → ReadListSuccess<T>
Helper to extract expected ReadListSuccess objects or throw in the case of an unexpected ReadListFailure.
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<T>, provided by the ReadListResultPatterns extension

A switch-like method, using callbacks.
mapOrNull<TResult extends Object?>(TResult? $default(ReadListSuccess<T> value)?, {TResult? failure(ReadListFailure<T> value)?}) → TResult?

Available on ReadListResult<T>, provided by the ReadListResultPatterns extension

A variant of map that fallback to returning null.
maybeMap<TResult extends Object?>(TResult $default(ReadListSuccess<T> value)?, {TResult failure(ReadListFailure<T> value)?, required TResult orElse()}) → TResult

Available on ReadListResult<T>, provided by the ReadListResultPatterns extension

A variant of map that fallback to returning orElse.
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<T>, provided by the ReadListResultPatterns 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?>(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<T>, provided by the ReadListResultPatterns extension

A switch-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<T>, provided by the ReadListResultPatterns extension

A variant of when that fallback to returning null

Operators

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