ReadModelResult<T> class final

Result of loading a read model with staleness information.

Wraps a read model value with metadata about whether the value may be stale (e.g., async projections have not yet processed recent events).

Constructors

ReadModelResult({T? value, required bool isStale})
Creates a read model result with the given value and staleness.
const
ReadModelResult.fresh(T value)
Creates a fresh (not stale) result with a value.
const
ReadModelResult.notFound()
Creates a not-found result (not stale).
const
ReadModelResult.stale(T value)
Creates a stale result with a value.
const
ReadModelResult.staleNotFound()
Creates a stale not-found result.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
hasValue bool
Whether a value is present.
no setter
isStale bool
Whether the value may be stale due to pending async projections.
final
requireValue → T
Returns the value or throws if absent.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value → T?
The read model value, or null if not found.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
valueOr(T defaultValue) → T
Returns the value or the defaultValue if absent.

Operators

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