d_rocket library
🚀 d_rocket — Dart's data rocket.
d_rocket is a unified package for the four pillars of data
handling in Dart/Flutter applications:
- LINQ-style queries —
IQueryable<T>with deferred execution. - Serialization — annotation-driven
toJson/fromJson. - REST with steroids — typed HTTP client with interceptors, wrap-around clients (retry, rate limit, circuit breaker), and cancelable requests.
- ORM (SQLite-first) —
Db.open(path),db.set<Person>, change tracking, code-first migrations, bulk operations, reactive queries. SQLite is the default and the only storage engine shipped out of the box. - Sync (offline-first) —
SyncProviderinterface, push/pull pipeline, identity persistence, conflict resolution, retry with exponential backoff, sync triggers. - Realtime — WebSocket + SSE clients with codegen.
Status
d_rocket is at 1.2.0 (SQLite-First for Flutter).
All four data layers are complete: LINQ, Serializer, REST
(with wrap-around resilience + cancelable requests), ORM
(with bulk + reactive queries), Sync (offline-first with
conflict resolution), Realtime (WebSocket + SSE with codegen).
See CHANGELOG.md for the full history.
Classes
- AggregateExpr
-
An aggregate call:
SUM(x),COUNT(x),AVG(x),MIN(x),MAX(x). The function is one of"SUM","COUNT","AVG","MIN","MAX". distinct emitsDISTINCT(COUNT(DISTINCT x)). - AppliedMigration
-
: a row from the
_d_rocket_migrationstable. Materialized into a typed struct so the user doesn't have to parseMap<String, Object?>rows by hand. - AsyncMigrationTransaction
- : a transactional execution context for the async path. Returned by an AsyncMigrationTransactionFactory when the user opts in to automatic transaction wrapping on MigrationRunner.runAsync / MigrationRunner.rollbackAsync.
- AsyncQueryProvider
- : the async-first query provider contract.
- AutoMigrationResult
- : the result of an auto-migration run. Bundles the safe diffs that were applied (for logging) and the unsafe diffs that were NOT applied (for the caller to surface).
- AutoMigrator
- : the auto-migrator.
- BinaryExpr
- Body
- El argumento se serializa como cuerpo de la petición (JSON).
- CallbackKeyProvider
-
A KeyProvider that delegates to an async callback.
Use this when the key source is not a
String(e.g. a stream you.firstfrom) or when the caller wants to add logging, caching, or rotation around the read. - CancelToken
- A token that can be attached to a RestRequest to allow the caller to cancel an in-flight HTTP request.
- ChangeEvent
- A single change event emitted by ChangeTracker.
- ChangeTracker
- CircuitBreakerHttpClient
- ClientWinsConflictPolicy
- Client-wins policy. The merged row takes every local value and falls back to the remote value for columns the local row does not have.
- CoalesceExpr
-
.e: a null-coalesce
a ?? b. - Column
-
Marks a field as a column of its
@Tableentity. - ColumnMeta
-
Metadata for a single column of a
@Tableentity. Emitted by the codegen as part of theEntityMetaliteral; the runtime never constructs aColumnMetaby itself. - CompositeInterceptor
- Composes several interceptors in order.
- ConflictPolicy
-
ConflictPolicyis the preferred API over the bare ConflictResolver typedef (which is still supported for back-compat). The typed form documents the four common cases as named constants and provides a single point of extensibility for custom merge logic via ConflictPolicy.custom. - ConstExpr
- CustomConflictPolicy
- User-provided merge policy. Wraps a ConflictResolver callback so it can be passed to anything expecting a ConflictPolicy.
- CustomConflictResolver
- Wraps a user-provided ConflictResolver callback so it can be set on EntityMeta.conflictResolver.
- Db
- (SQLite-First): the user-facing database facade. Wraps a SqliteQueryProvider (the internal storage engine) and a DbContext (the ORM).
- DbContext
- Abstract base class for every d_rocket ORM context.
-
DbSet<
T> -
A typed, queryable collection of
Tentities backed by a single SQL table. - DbSetInclude
- .e: a pending navigation include.
- DRest
-
Singleton accesible como
dRest.client,dRest.config, etc. - Embedded
-
: marks a field as an embedded
value object (EF Core's
OwnsOne/ComplexPropertypattern). The fields of the embedded type are flattened into the parent table — they don't get their own table and they don't carry an FK. - EmbeddedMeta
-
Metadata for a single
@Embeddedvalue object (EF Core'sOwnsOne/ComplexPropertypattern). The fields of the embedded type are flattened into the parent table — they don't get their own table and they don't carry an FK. - EncryptionConfig
- EntityMeta
-
Metadata for a single
@Tableentity. - EntityRegistry
-
EnumerableQuery<
T> -
An IQueryable backed by an Iterable. Used as
the root of every in-memory query, and also as
the result of operators that produce a new
queryable (e.g.
where_). - EnumerableQueryProvider
- The default in-memory provider. Singleton.
- ExponentialBackoffRetryPolicy
- Expr
-
ExprVisitor<
R> - Field
-
El argumento se envÃa como
application/x-www-form-urlencoded. - FileSyncStateStore
- Dart VM / server file-backed SyncStateStore that persists the state to a JSON file. The file is created lazily on the first write.
- ForeignKey
-
Marks a field as a foreign key referencing
another
@Table. - Format
- Field-level formatter configuration.
- GroupByExpr
-
A
GROUP BYclause with optional post-aggregation filter (HAVING). In SQL this isSELECT key[, element] FROM source GROUP BY key [HAVING pred]. - HavingExpr
-
A
HAVINGpredicate (post-aggregation filter). - Header
-
El argumento se envÃa como header HTTP (
nameoname: value). - HttpClient
- Interfaz abstracta que todo backend HTTP debe implementar.
- HttpDelete
- HttpGet
- HttpHead
- HttpOptions
- HttpPackageClient
-
Implementación por defecto de HttpClient basada en
package:http. - HttpPatch
- HttpPost
- HttpPut
- HttpSseClient
-
An SSE client backed by
package:http. ThehttpClientis DI-friendly (default is a freshhttp.Clientper instance). For tests, inject aMockClientor a realhttp.Client. - HttpVerb
-
Verbo HTTP. Cada subclase se mapea a un
HttpMethodespecÃfico. -
IGrouping<
TKey, T> - A group of elements sharing a key.
-
ILookup<
TKey, TElement> -
: the public interface for a lookup.
The
toLookup_operator returns a_Lookup(the concrete impl inlib/src/sqlite/queryable.dart). -
IncludeMany<
T, R> -
IncludeOne<
T, R> -
IncludeRelation<
T, R> -
A relation to be eager-loaded by
DbSet<T>.findById(id, joins: [...]). - Index
-
Marks a field (or set of fields, in a future)
for indexing. The MVP does not emit the
CREATE INDEXDDL; the annotation is metadata-only and surfaces in theColumnMetafor downstream tooling. - InMemorySyncProvider
- In-memory SyncProvider that buffers changes between "clients". Useful for tests and local development without a network.
- InMemorySyncStateStore
-
Test / dev in-memory SyncStateStore backed
by a
Map<String, Object?>. No I/O. - IOWebSocketClient
-
WebSocket client backed by
dart:io's built-in WebSocket. Works on the Dart VM (server-side + tests) and Flutter (iOS / Android / desktop). -
IQueryable<
T> -
A queryable source of
Twith deferred execution. - IQueryProvider
- A backend that can execute LINQ expressions.
- JoinExpr
-
A
JOINclause. The joinType is"INNER","LEFT","RIGHT", or"FULL". - JsonKey
- Field-level serialisation customisations.
- KeyProvider
- Source of the encryption password for a SQLCipher database.
- LambdaExpr
- ListExpr
- LoggingInterceptor
- The default configuration is conservative (method, URL, status — no headers, no bodies) so it is safe to drop in production without exposing secrets. Headers and bodies are opt-in via the includeHeaders and includeBodies flags.
- LwwConflictPolicy
- Server-wins policy. The merged row takes every remote value and falls back to the local value for columns the remote did not include.
- LwwConflictResolver
- The default strategy — Last Write Wins. The remote row is applied verbatim (no merging).
- ManualSyncTrigger
- Manual trigger that exposes SignalSyncTrigger.fire so the user can integrate it with their own event sources (e.g. a custom network-reconnect listener, an app-lifecycle observer, etc.). Same as SignalSyncTrigger but documented as "manual" to make the intent clearer.
- MapLiteralExpr
-
.e: a map literal
{'a': 1, 'b': 2}. Stored as a flat list ofMapEntry<Expr, Expr>for stable ordering and duplicate-key support in the parser. - MemberAccess
-
Dispatches a member access (
obj.field) for the in-memory provider. - MemberAccessExpr
- MergeStrategies
- Pre-built merge strategies for common cases.
- MethodCall
- Dispatches a method call for the in-memory provider. Minimal coverage in; will be extended in .
- MethodCallExpr
- Migration
-
: marks a top-level function as a
code-first migration. The codegen emits a
MigrationBasesubclass (seemigration.dart) with the given id and name, and anupthat runsentityMeta.createTableDdlfor every@Tableclass in the same library. - MigrationBase
-
Abstract base for a code-first migration. The
user-facing annotation
@Migration(inrocket_migration.dart) generates a concrete subclass of this class. - MigrationRunner
- Runs a list of MigrationBases in order against a provider-agnostic MigrationExecutor.
- MigrationStrategy
-
: a version-tagged, callback-driven
migration declaration. The
versionis the target schema version (not the number of migrations applied). On a fresh install the runner applies every migration whoseversionis<= this.version. - MigrationTransaction
- A transactional execution context. Returned by a MigrationTransactionFactory when the user opts in to automatic transaction wrapping.
- .a: metadata for a single navigation property. Constructed by the codegen and read by the runtime; the runtime never constructs one itself.
- .c: a static helper for populating a navigation property on a list of entities. Fetches the related entities in one batched query and writes them into the NavigationRegistry.
-
.b: a per-instance map for navigation
properties on entities. Used by the codegen-emitted
extension XxxNavigation on Xxxgetters to read the populated values, and by the framework (viaset) to populate them after a fetch or.include_. -
.d: an Expr that represents a
navigation property reference. The SQL
translator sees a
NavRefand: - NoRetryPolicy
- Retry policy that always gives up. Use this to opt out of the default exponential backoff (e.g. for tests, or for transient-error-free environments).
- NullExpr
- NullSafeAccessExpr
-
.e: a null-safe member access
a?.b. - Parameter
- Anotaciones a nivel de parámetro. Determinan de dónde sale el valor.
- ParamExpr
- Part
-
El argumento se envÃa como parte de
multipart/form-data. - Path
-
El argumento reemplaza un
{name}en la ruta del método. - PeriodicSyncTrigger
-
Periodic timer trigger. The user provides an
interval and a jitter (default 10% of the
interval). The trigger fires every
interval + jitter(jitter avoids synchronised spikes when many devices wake up at the same time). - PrimaryKey
-
Marks a field as the primary key of its
@Table. - Query
-
El argumento se envÃa como
?{name}={value}. Sinameesnullse usa el nombre del parámetro en el código Dart. -
Queryable<
T> - A SQL-backed IQueryable over a single table.
- RateLimitedHttpClient
- : an HttpClient that wraps an inner client and rate-limits the requests using a token bucket. If the bucket is empty, requests block until a token is available.
- RawBody
-
Cuerpo crudo (
StringoList<int>). Se envÃa tal cual sin serializar como JSON. - Record
-
Base class for
RecordLiketypes whose field accessors are registered at startup by codegen. - RecordLike
- Implemented by user models to expose their fields to the expression-tree evaluator.
- RestClient
-
Marca una clase abstracta como cliente HTTP tipado generado por
d_rocket_builder. - RestConfig
-
Configuración global del runtime
d_rocket(capa 2 — REST with steroids). Suele haber una sola instancia por aplicación (dRest). - RestInterceptor
-
Refit/OkHttp-style interceptor. Lets you transform
requests (e.g. add an
Authorizationheader) and responses (e.g. refresh a token on 401). - RestRequest
-
RestResponse<
T> - RestSyncProvider
- +: an HTTP + JSON SyncProvider backed by the high-level HttpClient interface.
- RetryDecision
- The decision returned by a RetryPolicy.shouldRetry call.
- RetryingHttpClient
- : an HttpClient that wraps an inner client and retries failed requests using a RetryPolicy. On success the response is returned. On failure the policy is consulted: if it returns RetryDecision.retry, the request is re-sent after the given delay. If it returns RetryDecision.giveUp, the last error is re-thrown.
- RetryPolicy
- Pluggable retry policy. Implementations:
- Route
-
Prefijo de ruta aplicado a nivel de clase (estilo
[Route]de ASP.NET Core). - SchemaColumn
- : a single column in the snapshot. Mirrors the relevant fields of ColumnMeta but in a JSON-friendly form.
- SchemaDiff
- : a single diff entry. The fields depend on type:
- SchemaForeignKey
- : foreign-key target (used inside SchemaColumn).
- SchemaIndex
- : a single index in the snapshot.
- SchemaSnapshot
- : a serializable snapshot of the database schema. Produced by computeSnapshot from a list of EntityMeta and consumed by the diff algorithm.
- SchemaState
-
: thin wrapper around the
d_rocket_schema_statetable. The wrapper is created by AutoMigrator and is not exported from the package barrel — application code interacts with it indirectly viaDb.pendingSchemaDiff()and theDb.open(autoMigrate: true)flag. - SchemaTable
- : a single table in the snapshot, including its columns and indexes.
- Serializable
-
Marks a class as serialisable by
d_rocket_builder. - SerializableUnion
- Marks a base type as a polymorphic union root.
- Serializer
- Static JSON serializer with type registration.
- SerializerSnapshot
- SignalSyncTrigger
-
One-shot trigger that fires the next time the
user manually calls fire. Useful for
pull-to-refresh: the UI calls
fireand the sync runs. - SqlFragment
- A SQL fragment together with its bind parameters.
-
SqliteGroupedQueryable<
TKey, T> -
A grouped queryable, produced by
groupBy_. -
SqliteJoinedQueryable<
R> -
A joined queryable, produced by
join_orgroupJoin_. - SqliteQueryProvider
-
Owns a
sqlite3.Databaseand exposes the operations the queryable needs. -
SqliteSelectManyQueryable<
R> -
: the iterable wrapper for
selectMany_. Mirrors theSqliteJoinedQueryablepattern: outer is fetched via SQL, inner is fetched via SQL (or materialised in memory), and the cartesian product is emitted through the result selector. Composes withwhere_/orderBy_/take_/skip_applied to the outer side. -
SqliteSetOpQueryable<
T> -
: the iterable wrapper for set operations.
Loads both queryables, then computes the set op in Dart.
Returns a
Queryable<T>(preserves the LINQ chain contract — user can chainwhere_/orderBy_/toList_/toListAsync_on the result). - SqlTranslator
- Walks an Expr tree and produces a SqlFragment.
- SseClient
- : marks an abstract class as an HttpSseClient (the user defines the URL + optionally lastEventId, the builder emits the connect + lastEventId logic).
- SseConnection
- Abstract contract for an SSE connection.
- SseEvent
- A single Server-Sent Event.
- StaticKeyProvider
-
A KeyProvider that holds a literal value in memory.
Used by tests and by code paths where the password is
already a
Stringin scope. For production code on mobile, prefer a KeyProvider backed by platform secure storage. - SyncChange
- One row in a SyncEnvelope.
- SyncEnvelope
- A batch of SyncChanges.
- SyncProvider
- Contract for a sync backend.
- SyncStateStore
- The persistence contract for sync state (clientId + watermark).
- SyncTrigger
- Base interface for a sync trigger. The user composes one or more triggers and hands them to DbContext.startSyncTriggers.
- Table
- Marks a class as an entity managed by the d_rocket ORM.
- TernaryExpr
-
.e: a ternary
cond ? then: else. - TrackedEntry
- A single entity tracked by the ChangeTracker.
- UnaryExpr
- WebSocketClient
- : marks an abstract class as a IOWebSocketClient (the user defines the URL + optionally headers, the builder emits the connection + reconnect glue).
- WebSocketConnection
- Abstract contract for a WebSocket connection.
- WebSocketMessage
- One WebSocket frame: either a text string or a binary blob. Use WebSocketMessage.text and WebSocketMessage.binary to construct one.
- WebSocketReconnector
- Auto-reconnecting wrapper. Wraps any WebSocketConnection factory and retries connection with exponential backoff when the initial start fails.
Enums
- ChangeEventType
- The kind of a ChangeEvent.
- DiffSeverity
-
: severity classification for a
SchemaDiff.
safeoperations are non-destructive and are auto-applied.unsafeoperations are potentially destructive and are reported only. - EncryptionStatus
- The encryption posture of an open Db connection.
- EntityState
- The state of a TrackedEntry in the change tracker.
- InheritanceStrategy
-
The inheritance strategy used by a hierarchy of
entities. Mirrors EF Core's
InheritanceStrategyenum, which has the same three values (Tph,Tpt,Tpc). d_rocket supports all three. - JsonNaming
- Naming policy applied to generated JSON keys.
- OnDeleteAction
-
ON DELETEpolicy for foreign-key columns. Maps directly to SQLite'sON DELETE CASCADE / SET NULL / RESTRICT / NO ACTIONclauses (and to EF Core'sOnDeleteenum, for parity). - SchemaOperationType
-
: type of a SchemaDiff. Maps
1:1 to a SQL DDL operation (with two
exceptions:
modifyColumnhas no direct SQL in SQLite, andrenameColumnis a heuristic that suggests a possible rename). - SyncChangeType
- The kind of change encoded in a SyncChange.
- UnknownKeyPolicy
- Policy for handling unknown keys during deserialisation.
- WebSocketMessageType
- The type of a WebSocketMessage frame.
Extensions
-
AggregatesOp
on IQueryable<
T> - BulkOpsAsync on AsyncQueryProvider
-
(bulk update): extension on
AsyncQueryProvider that runs a single
UPDATE <table> SET col1 = ?, col2 = ? [WHERE ...]statement. -
ConcatOp
on IQueryable<
T> -
The
concat_LINQ operator. -
ConversionMapOps
on IQueryable<
T> -
ConversionsOp
on IQueryable<
T> -
DbSetLinqExtension
on DbSet<
T> -
(the LINQ surface): the LINQ operators
exposed directly on
DbSet<T>. Each one returns aQueryable<T>(or a typed variant forselect<T2>/groupBy<TKey>), so the user chains them naturally: -
DistinctOp
on IQueryable<
T> -
The
distinct_LINQ operator. -
ElementOp
on IQueryable<
T> -
GroupByOp
on IQueryable<
T> -
InMemoryLookupOp
on Iterable<
T> -
(in-memory extension): builds a
ILookup<TKey, T>from anyIQueryable<T>(this is the in-memory counterpart ofQueryable.toLookup_). Materialises the source in memory. -
JoinOp
on IQueryable<
TOuter> -
OfTypeOp
on IQueryable<
T> -
The
ofType_LINQ operator. -
OrderByOp
on IQueryable<
T> -
The
orderBy_LINQ operator. -
QuantifiersOp
on IQueryable<
T> -
QueryableSelectManyOnQueryable
on Queryable<
T> -
(SQL-backed CROSS JOIN): the C#-style
from o in outer from i in inner select result(o, i). Composes withwhere_/orderBy_/take_/skip_applied to the outer side. The inner is materialised in memory (it's anIQueryablewe iterate once). -
QueryableSetOpsOnQueryable
on Queryable<
T> -
(set operations): union/intersect/except.
The result preserves the outer queryable's chain
(so chained
where_/orderBy_on the left work) and the right side is materialised eagerly. -
SelectManyOp
on IQueryable<
T> -
The
selectMany_LINQ operator. -
SelectOp
on IQueryable<
T> -
The
select_LINQ operator. -
SetOps
on IQueryable<
T> -
SkipOp
on IQueryable<
T> -
The
skip_LINQ operator. -
SkipWhileOp
on IQueryable<
T> -
The
skipWhile_LINQ operator. -
SqliteDbSetExtension
on DbSet<
T> -
(the bridge): a
DbSet<T>.asQueryableextension. Returns aQueryable<T>wired to the attached SqliteQueryProvider. - SqliteRocketDbContextExtension on DbContext
-
TakeOp
on IQueryable<
T> -
The
take_LINQ operator. -
TakeWhileOp
on IQueryable<
T> -
The
takeWhile_LINQ operator. -
ThenByOp
on IQueryable<
T> -
The
thenBy_/thenByDescending_operators, available only on queryables that have already been ordered. -
ToQueryableExtension
on Iterable<
T> - Sugar: lift an Iterable to IQueryable.
-
WhereOp
on IQueryable<
T> -
The
where_LINQ operator.
Constants
- dRocketMigrationsTable → const String
- Internal name of the table that tracks applied migrations.
- schemaStateTableDdl → const String
-
: schema for the schemaStateTableName
table. A single row keyed by
id = 1. TheCHECK (id = 1)constraint guards against accidental multi-row inserts. - schemaStateTableName → const String
-
: name of the on-disk table that
stores the last applied schema snapshot. A
single row, keyed by
id = 1. - serializable → const Serializable
Functions
-
buildLookup<
T, TKey> (Iterable< T> source, LambdaExpr keySelector) → ILookup<TKey, T> -
(in-memory helper): builds a ILookup
from a source
Iterable<T>and a key extractor. Reused by both the SQL-backedQueryable.toLookup_and the in-memoryIQueryable.toLookup_extensions. -
columnToSnapshot(
ColumnMeta c, {String? nameOverride}) → SchemaColumn - : convert a ColumnMeta to a SchemaColumn. The conversion is deterministic (same input → same output).
-
computeSchemaDiff(
SchemaSnapshot old, SchemaSnapshot newSnap) → List< SchemaDiff> -
: compute the diff between two
snapshots. Returns a deterministic list of
SchemaDiffs. The caller decides what to do
with
unsafeentries (typically: log them, surface them viaDb.pendingSchemaDiff(), and DO NOT apply them). -
computeSnapshot(
List< EntityMeta> metas) → SchemaSnapshot - : produce a SchemaSnapshot from a list of EntityMetas. The order of tables in the output is the order of the input. TPH subclass columns are flattened into the parent table (matching the on-disk shape).
-
debugResetSqlCipherProbeCache(
) → void - helper: clears the cached probe result. Test only. Production code should never call this.
-
embedColumns(
EmbeddedMeta em) → String -
Emit the comma-separated flattened column list for
an EmbeddedMeta's fields, e.g.
'street TEXT NOT NULL, city TEXT NOT NULL'. -
fkClause(
ColumnMeta c) → String -
Emit the
REFERENCES … [ON DELETE …]SQL fragment for a ColumnMeta that is a foreign key. Returns the empty string for non-FK columns. -
generateUuidV4(
) → String -
Generates a random UUID v4 string in the
canonical 8-4-4-4-12 lowercase hex form
(for example
f47ac10b-58cc-4372-a567-0e02b2c3d479). -
httpVerbToString(
HttpVerb verb) → String - Atajo para serializar verbos en strings.
-
indexNameFor(
SchemaTable table, ColumnMeta c) → String -
: derive the index name for a
ColumnMeta that has
isIndexed: true. Same heuristic as EntityMeta.createIndexStatements. -
invokeRequest<
T> (RestRequest request, Decoder decoder) → Future< T> - Helper que se llama desde el código generado para invocar el cliente con la respuesta adecuada.
-
isSqlCipherAvailable(
) → bool -
Returns
trueif the underlying SQLite engine is SQLCipher. The result is cached at the isolate level; the first call opens a short in-memory database, subsequent calls are constant-time. -
redactPragmaKey(
String sql) → String -
Redacts the value of a
PRAGMA key = '...'orPRAGMA rekey = '...'statement, replacing the literal with'***'. - .d: register the navigation lookup function. Called by NavigationRegistry on first use.
-
sqliteTypeFor(
Type t) → String -
: convert the canonical SQLite type
for a Dart Type. Same mapping as
EntityMeta._sqliteType(private there, so duplicated here — they MUST stay in sync). -
validateMapKeysImpl(
Map map) → void
Typedefs
-
AsyncMigrationExecutor
= Future<
void> Function(String sql, [List<Object?> ? binds]) -
Callback signature for executing a single SQL
statement asynchronously. Mirrors
AsyncQueryProvider.executeAsync. -
AsyncMigrationSelector
= Future<
List< Function(String sql, [List<Map< >String, Object?> >Object?> ? binds]) -
Callback signature for a
SELECTstatement, asynchronously. MirrorsAsyncQueryProvider.selectAsync. -
AsyncMigrationTransactionFactory
= Future<
AsyncMigrationTransaction> Function() -
: factory that returns a fresh
AsyncMigrationTransaction per
upAsync/downAsyncinvocation. The user's implementation typically looks like: - CodecEncoder = Object? Function(Object? value)
-
Encoder side of a value codec. Recursive values
are delegated back to the supplied
encodefunction so collections can recurse without re-walking the codec table. -
ConflictResolver
= Map<
String, Object?> Function(Map<String, Object?> localRow, Map<String, Object?> remotePayload) - The contract for a conflict resolution strategy. The framework calls this when applying a remote upsert to a row that already exists locally (concurrent edit).
-
Decoder<
T> = T Function(dynamic data) -
JsonEncoder<
T> = Map< String, dynamic> Function(T value) -
Serialises an instance of
Tinto a JSON map. -
JsonFactory<
T> = T Function(Map< String, dynamic> json) -
Deserialises a map into an instance of
T. -
MigrationExecutor
= void Function(String sql, [List<
Object?> ? binds]) - Callback signature for executing a single SQL statement (optionally with positional binds).
-
MigrationSelector
= List<
Map< Function(String sql, [List<String, Object?> >Object?> ? binds]) -
Callback signature for a
SELECTstatement. Returns a list of rows, where each row is aMap<String, Object?>keyed by the column names. Mirrors theDbSet.selectcontract. - MigrationTransactionFactory = MigrationTransaction Function()
-
Factory that returns a fresh MigrationTransaction
per
up/downinvocation. The user's implementation typically looks like: -
RequestCodec
= Future<
RestResponse> Function(RestRequest request, Decoder decoder) -
ResultRowReader<
T> = T Function(Map< String, Object?> row) -
A function that maps a
Rowto a user value of typeT.
Exceptions / Errors
- DatabaseException
- : a generic database exception. Wraps any error raised by the underlying sqlite3 binding (and anything thrown by user-defined providers, in the future).
- NetworkException
- The connection failed (no response from the server).
- RequestCancelledException
- Thrown from HttpClient.execute when the CancelToken the user attached to the RestRequest is cancelled before the response finishes streaming.
- RestConfigException
- Configuration error (missing annotation, empty baseUrl, etc.).
- RestException
- Exceptions raised by the d_rest runtime (now absorbed into d_rocket as part of the roadmap).
- RestHttpException
- The server responded with an error status code.
- RestSyncException