winche_database library

Classes

ArrayRemoveSentinel
Internal sentinel class exposed for pattern-matching in converters.
ArrayUnionSentinel
Internal sentinel class exposed for pattern-matching in converters.
ArrayValue
{"arrayValue": {"values": [...]}} — empty array omits values.
BooleanValue
{"booleanValue": true|false}
BytesValue
{"bytesValue": "<base64>"} — standard base64 encoding.
CollectionReference<T>
A reference to a collection of documents in the Winche Database.
ConnectionConfig
Converter<T>
Typed converter pair attached by withConverter.
CursorSpec
Cursor for start/end pagination bounds (PROTOCOL §4.5).
DeleteFieldValue
{"deleteField": true} — write-time sentinel that removes a field.
DeleteSentinel
Internal sentinel class exposed for pattern-matching in converters.
DeleteWrite
Deletes a document, optionally cascading to nested documents.
DocumentChange<T>
A single document change within a QuerySnapshot.
DocumentReference<T>
A reference to a single document in the Winche Database.
DocumentSnapshot<T>
An immutable snapshot of a single document.
DoubleValue
{"doubleValue": <number>} or {"doubleValue": "NaN"|"Infinity"|"-Infinity"}
FieldTransform
A transform applied to a single field after the write data has been written.
FieldValue
Sentinel values for write operations.
FilterSpec
Immutable filter specification, producing wire JSON per PROTOCOL §4.2.
GeoPoint
Facade-level geographic point (latitude, longitude).
GeoPointValue
{"geoPointValue": {"latitude": <number>, "longitude": <number>}}
GetOptions
Options for a one-shot read.
HiveLocalStore
Durable LocalStore backed by Hive CE. Pure Dart; works on native and web (Hive uses IndexedDB on web automatically).
IncrementSentinel
Internal sentinel class exposed for pattern-matching in converters.
IntegerValue
{"integerValue": "<string>"} — wire format is always a string.
LazyLocalStore
A LocalStore that defers opening its underlying store until the first operation.
LocalStore
Durable key/value backing store for the offline cache, write queue and sync metadata. All values are JSON-safe (Map/List/String/num/bool/null).
MapValue
{"mapValue": {"fields": {...}}} — empty map omits fields.
MaximumSentinel
Internal sentinel class exposed for pattern-matching in converters.
MemoryLocalStore
An in-memory LocalStore — the default store when none is supplied.
MinimumSentinel
Internal sentinel class exposed for pattern-matching in converters.
NullValue
{"nullValue": null}
OrderSpec
One element of an orderBy clause.
PendingBase
The version basis a pending write was made against (for version-checked replay). Set existsFalse when the document was known-absent; set updateTime/version when it had a confirmed value; all-null means the base was unknown (the write replays last-write-wins).
PendingWrite
A durable pending write in the offline queue.
Precondition
Optional precondition that must hold for a write to succeed.
QueryReference<T>
An immutable, composable query over a collection.
QuerySnapshot<T>
An immutable snapshot of a query result set.
QuerySpec
Immutable query specification (PROTOCOL §4.1).
ReferenceValue
{"referenceValue": "collection/id"} — document path string.
ServerTimestampSentinel
Internal sentinel class exposed for pattern-matching in converters.
SetWrite
Replaces or deep-merges a document.
SnapshotMetadata
Provenance flags for a snapshot.
StringValue
{"stringValue": "..."}
SyncEvent
An event emitted on WincheDatabase.syncEvents as the write queue drains.
TimestampValue
{"timestampValue": "yyyy-MM-ddTHH:mm:ss.ffffffZ"}
Transaction
A database transaction handler object.
Transport
UpdateWrite
Patches individual nested fields (via dotted field paths).
Value
Sealed base class for all Winche Database tagged value types.
WincheDatabase
The entry point for the Winche Database Dart SDK.
WincheDatabaseConfig
All configuration for a WincheDatabase in one object — connection knobs, local-store selection, and sync policy. Mirrors winche_storage's WincheStorageConfig.
Write
Sealed base class for write operations in a batch.
WriteBatch
Accumulates multiple write operations and commits them atomically.
WriteConflict
A pending write (or batch) was rejected by a version precondition. Resolve it with retry, discard, or overwrite.
WriteFailed
A pending write (or batch) failed permanently (e.g. permission denied) and was dropped from the queue.
WriteResult
The result of a single write in a batch or transaction commit.
WriteSynced
A pending write (or batch) was acknowledged by the server.

Enums

ConflictPolicy
How unresolved write conflicts are handled by default.
ConnectionState
Connection lifecycle state.
DocumentChangeType
The type of change in a DocumentChange.
FieldOp
Field filter operators matching PROTOCOL §4.3 wire strings exactly.
PendingKind
The kind of a pending write, derived from the write type.
SortDirection
Sort direction.
Source
Where a read should be served from.
TransformKind
The kind of a field transform, matching the wire string names exactly (per PROTOCOL §3.7).
UnaryOp
Unary filter operators (PROTOCOL §4.3): isNull, isNan, exists.

Functions

fromValue(Value value) Object?
Converts a Value back to a native Dart object.
numToValue(num n) Value
Wraps a num as the matching Value: intIntegerValue, otherwise DoubleValue.
splitUpdateData(Map<String, Object?> data) → (Map<String, Value>, List<FieldTransform>)
Like splitWriteData but enforces update() semantics:
splitWriteData(Map<String, Object?> data) → (Map<String, Value>, List<FieldTransform>)
Splits a Dart write-data map into wire-ready fields and field transforms.
stageDelete(String path, {bool cascade = false, Precondition? precondition}) DeleteWrite
Builds a DeleteWrite.
stageSet(String path, Map<String, Object?> data, {bool merge = false, Precondition? precondition}) SetWrite
Builds a SetWrite from already-mapped data.
stageUpdate(String path, Map<String, Object?> data, {Precondition? precondition}) UpdateWrite
Builds an UpdateWrite from already-mapped data (top-level dotted keys ok).
toValue(Object? obj, {String keyPath = ''}) Value
Converts a native Dart object to a Value, following the type mapping described in PROTOCOL §1.

Exceptions / Errors

AbortedException
ABORTED — transaction conflict, expired, or unknown transaction id.
AlreadyExistsException
ALREADY_EXISTS — an exists: false precondition targeted an existing document.
DeadlineExceededException
DEADLINE_EXCEEDED — the operation timed out on the server.
FailedPreconditionException
FAILED_PRECONDITION — an updateTime precondition did not match.
InternalException
INTERNAL — an unexpected server error (always a bug; report it).
InvalidArgumentException
INVALID_ARGUMENT — malformed request, bad field types, batch size exceeded, or an invalid write shape.
InvalidQueryException
INVALID_QUERY — query or pipeline parse / validation error.
NotFoundException
NOT_FOUND — an UpdateWrite or exists: true precondition targeted a document that does not exist.
PermissionDeniedException
PERMISSION_DENIED — access rule denied the operation.
UnauthenticatedException
UNAUTHENTICATED — authentication token invalid or missing.
UnavailableException
UNAVAILABLE — client-side status indicating the server is unreachable, the WebSocket was disconnected, or the response body could not be parsed.
WincheException
Base exception for all Winche Database errors.