MessageRepository<T, M> class

A highly-typed adapter for a Repository that cleanly handles discrete message/patch types (e.g. Freezed unions) for sending creation or update operations securely over an untyped boundary, before being transformed into the principal T object.

Inheritance

Constructors

MessageRepository(SourceList<T> sourceList, {required Bindings<M> messageBindings, String? loggerName, DateTime getTime()?})
A highly-typed adapter for a Repository that cleanly handles discrete message/patch types (e.g. Freezed unions) for sending creation or update operations securely over an untyped boundary, before being transformed into the principal T object.

Properties

getTime → DateTime Function()
Reads the wall clock to annotate operations.
finalinherited
hashCode → int
The hash code for this object.
no setterinherited
isNotReady → bool
Returns true if this object has not yet successfully achieved readiness.
no setterinherited
isReady → bool
Returns true if this object has successfully achieved readiness.
no setterinherited
messageBindings → Bindings<M>
The strongly-typed bindings detailing how your custom message serializes itself before being sent to the server.
final
readiness ↔ Readiness
Cache of whether this object is ready. Set by the completer.
getter/setter pairinherited
ready → Future<void>
Resolves when readiness is achieved, or immediately if it has already been achieved.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sourceList → SourceList<T>
Data loader within a Repository which can cascade through a list of data sources, treating each as a write-through cache.
finalinherited

Methods

clear() → Future<void>
Clears all local data. Does not delete anything from any remote sources.
inherited
clearForRequest(RequestDetails details) → Future<void>
Clears all local data cached against this request.
inherited
close() → void
Releases any open resources like stream subscriptions.
inherited
deleteItem(String id, {RequestDetails? details}) → Future<void>
Removes the item associated with the given id from persistence.
inherited
deleteItems({RequestDetails? details}) → Future<void>
Removes all items matching the given request details from persistence.
inherited
generateOperationId() → String
Generates a unique operation ID, which defaults to v7 to preserve chronological ordering for logging and debugging purposes.
inherited
getById(String id, {RequestDetails? details}) → Future<T?>
Loads an item by the given id if it exists.
inherited
getByIds(Set<String> ids, {RequestDetails? details}) → Future<(List<T>, Set<String>)>
Loads all items in the given Id set. If any Ids were not fulfilled, they are included in missingIds.
inherited
getItems({RequestDetails? details}) → Future<List<T>>
Loads all items that match the given request details, or the default RequestDetails.read object if not given.
inherited
initialize() → void
Calls performInitialization with extra bookkeeping. Descendant classes should implement performInitialization but then invoke initialize.
inherited
markReady(void obj) → void
Marks this object as ready. Implementing classes should call this function when they are ready, presumably either in or because of some side effect of performInitialization.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
performInitialization() → FutureOr<void>
Classes using ReadinessMixin should implement this method to perform any necessary initialization. Implementations of this method should call markReady and pass in any special value for T that should be returned from ready.
inherited
resetReadiness() → void
Resets any established readiness, if for example a dependency of this object has also lost readiness.
inherited
sendMessage(M message, {String? targetId, RequestDetails? details}) → Future<T?>
Sends a generic message structure which serves as either a creation or update depending on the evaluated presence of targetId.
setItem(T item, {RequestDetails? details}) → Future<T?>
Persists the given item and returns the saved value if the write was successful.
inherited
setItems(Iterable<T> items, {RequestDetails? details}) → Future<List<T>>
Persists all items.
inherited
toString() → String
A string representation of this object.
inherited
watch(String id, {RequestDetails? details}) → Stream<T?>
Opens a live stream for the item with the given id.
inherited
watchByIds(Set<String> ids, {RequestDetails? details}) → Stream<(List<T>, Set<String>)>
Opens a live stream for all items in the given Id set.
inherited
watchList({RequestDetails? details}) → Stream<List<T>>
Opens a live stream for all items that match the given request details, or the default RequestDetails.read object if not given.
inherited

Operators

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