OutboxEntry class
One queued mutation. Immutable; the outbox replaces entries with copyWith as they move through OutboxState.
Constructors
-
OutboxEntry({required String id, required String idempotencyKey, required int sequence, required String operation, required String resourceKey, required Map<
String, Object?> payload, required DateTime createdAt, DateTime? updatedAt, int attempts = 0, DateTime? nextAttemptAt, String? lastError, OutboxState state = OutboxState.pending, String? group, int conflictCount = 0, ConflictResolution? conflictResolution, Object? serverState}) -
Creates an entry. Apps normally call
Outbox.enqueueinstead. -
OutboxEntry.fromJson(Map<
String, Object?> json) -
Restores an entry written by toJson.
factory
Properties
- attempts → int
-
Number of times the entry has been handed to the sender.
final
- conflictCount → int
-
Number of conflicts the entry has run into.
final
- conflictResolution → ConflictResolution?
-
How the latest conflict was resolved, if it was.
final
- createdAt → DateTime
-
When the entry was enqueued.
final
- group → String?
-
Ordering group. Entries in the same group are sent one at a time in
FIFO order, and a failure blocks the rest of the group.
nullmeans the entry is independent of every other entry.final - hashCode → int
-
The hash code for this object.
no setteroverride
- id → String
-
Local, unique identifier of the entry.
final
- idempotencyKey → String
-
Key the server uses to deduplicate retries of the same mutation. Sent
with every attempt; replaced only when the payload changes after a
conflict, because the old request is known not to have been applied.
final
- isTerminal → bool
-
Whether the entry is finished and will not be sent again.
no setter
- lastError → String?
-
Description of the most recent failure.
final
- nextAttemptAt → DateTime?
-
Earliest time of the next attempt, or
nullwhen due immediately.final - operation → String
-
Operation type, for example
create,updateordelete.final -
payload
→ Map<
String, Object?> -
JSON-encodable body of the mutation. Unmodifiable.
final
- resourceKey → String
-
The resource the mutation targets, for example
note:42. Coalescing only combines entries with the same resource key.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sequence → int
-
Monotonic position in the queue; defines FIFO order.
final
- serverState → Object?
-
The server's version reported with the latest conflict (JSON value).
final
- state → OutboxState
-
Current lifecycle state.
final
- updatedAt → DateTime
-
When the local change was last modified (enqueue, coalescing or a
merge). Used by the last-write-wins conflict strategy.
final
Methods
-
copyWith(
{String? idempotencyKey, String? operation, Map< String, Object?> ? payload, DateTime? updatedAt, int? attempts, DateTime? nextAttemptAt, bool clearNextAttemptAt = false, String? lastError, bool clearLastError = false, OutboxState? state, int? conflictCount, ConflictResolution? conflictResolution, bool clearConflictResolution = false, Object? serverState, bool clearServerState = false}) → OutboxEntry -
Returns a copy with the given fields replaced. The
clear*flags set the matching nullable field tonull. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, Object?> - JSON representation, readable by OutboxEntry.fromJson. Dates are ISO 8601 strings in UTC.
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override