adapter_api library
SPI for storage adapter authors (SQLite, Drift, Hive CE, ...).
Implement LocalStore and run the conformance suite from
package:offline_cache_sync_test/conformance.dart in your tests.
Classes
- ErrorInfo
- A classified error, safe to persist (messages must already be redacted).
- LocalStore
- The storage port. Records, the op log and engine metadata live behind ONE transaction boundary, so "write locally + enqueue" is atomic.
- MetaTable
- Small key/value table for engine bookkeeping (sequence, lease, epochs).
- Operation
- One durable entry in the outbox. Immutable; transitions produce copies.
- OpLog
- RecordTable
- StoredRecord
- A server-confirmed base value plus the metadata the engine needs for freshness and retention. Immutable.
- StoreStats
- StoreTxn
- Tables available inside one transaction.
- UuidV4
- Generates RFC 4122 version-4 UUIDs without any package dependency.
- Validators
- HTTP validators used for conditional requests (304 Not Modified).
- Version
- Opaque server version of an entity. Prefer revision or a strong etag; updatedAt is the weakest signal (clock skew, millisecond collisions).
Extension Types
- IdempotencyKey
-
Key sent as the
Idempotency-Keyheader. Minted once per operation. - OpId
- Local identity of one queued operation.
- RecordKey
-
Identifies one entity:
<type>:<id>, e.g.user:123.
Functions
-
estimateSize(
Object? payload) → int - Approximate encoded size of a JSON-compatible value, in bytes.