PendingWrite class
A change made offline, waiting to be sent.
The counterpart to KoolbaseConflict, one step earlier in the lifecycle: a conflict is a write the server refused; a pending write is one the server has not seen yet. Both are durable state an app should surface — a queue nobody can see accumulates invisibly, and the changes it holds feel saved to the user while existing only on this device.
The case that makes this API matter: logout. Queues are per-user and survive logout by design, so a user signing out with pending writes walks away believing their edits saved — and they sync whenever that user next signs in on this device, which may be never. Warn before logout:
final pending = await Koolbase.db.pendingWrites();
if (pending.isNotEmpty) {
// "You have 3 unsynced changes. Sync now, or they wait until you
// next sign in on this device."
}
Koolbase.db.pendingWrites is a snapshot; Koolbase.db.watchPendingWrites
emits on every change, for a sync badge. Both are per-user: another
account's queue on this device is not visible here.
Constructors
Properties
- attempts → int
-
Failed send attempts so far. A count, not a policy — nothing drops it.
final
- collection → String
-
final
-
data
→ Map<
String, dynamic> ? -
What the user changed. Absent for a delete.
final
- enqueuedAt → DateTime
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
final
- operation → String
-
'insert' | 'update' | 'delete'.
final
- recordId → String?
-
Absent for an insert the server has not yet assigned.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited