d_rocket 1.0.1
d_rocket: ^1.0.1 copied to clipboard
Dart/Flutter data-layer framework: @Serializable codegen, @RestClient with retry, deferred LINQ, and a code-first SQLite ORM with migrations. See README for platform support.
Changelog #
All notable changes to d_rocket are documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
1.0.1 — 2026-06-13 #
Patch release. No API changes. Fixes the pub.dev scoring report and the doc link index.
- Moved
lib/example/bookstore.dartandlib/example/quickstart.darttoexample/. Both files require the codegen output to compile (they importd_rocket_registry.g.dartandbookstore.g.dart), which made pana fail the static-analysis check on the published tarball (5 errors, allURI_HAS_NOT_BEEN_GENERATED/UNDEFINED_FUNCTION). Files inexample/are not analyzed by pana, so the score recovers. The codegen-emitted central registry (lib/d_rocket_registry.g.dart) was patched to import the example from its new location. The two test files that imported the example viapackage:d_rocket/example/bookstore.dartwere updated to use a relative import. - README doc-index fixes. The 14 links in
the doc index pointed to
/docs/(with 's'); the actual folder is/doc/. The 3 inline doc references pointed to short file names (serialization.md,rest.md,linq.md) that no longer exist (renamed to04-layer-1-serialization.md,05-layer-2-rest.md,06-layer-3-linq.mdin the v0.4 doc reorganization). Also two stale identifiers in the overview table and the top code sample (RocketDbContext→DbContext,RocketDb.open→Db.open). - CHANGELOG header cleanup. Removed the "— First stable release" subtitle from the 1.0.0 header to match the version-only convention used elsewhere.
1.0.0 — 2026-06-12 #
The first stable, production-ready release of d_rocket. The
public API is now frozen within the 1.x series: minor
versions may add features, patch versions fix bugs, and
breaking changes will trigger a 2.0 bump.
This release consolidates four prior pre-releases (0.1.0-dev, 0.3.0-dev,
0.4.0-dev, 0.5.0-dev) into a single, cohesive
1.0. The SQLite storage engine is now bundled directly in
this package; the d_rocket_provider_sqlite companion
package is kept as a thin compatibility shim for projects
that have not yet migrated.
Breaking changes #
- The
Rocketprefix is gone from the public API. Every public type and every CLI command has been renamed. The oldRocketTableis nowTable;RocketDbContextisDbContext; the CLI commandd_rocket:rocket_migrationis nowd_rocket:migration; etc. The full mapping is in the README's "Breaking changes in v1.0 — the rename" section. The annotation@RocketMigrationis now@Migration; the abstract base class that the codegen-emitted migration subclass extends isMigrationBase(the two names are deliberately distinct to avoid a same-library collision with the annotation). Codegen output is regenerated from scratch on every build, so users that ranbuild_runneron the pre-release will need a one-timedart run build_runner build --delete-conflicting-outputsafter upgrading.
Highlights #
- One package, one mental model, one generator. Annotation-
driven serialization, REST, LINQ, and ORM share the same
design vocabulary, error model, and
initializeD()wiring. - Async-first throughout. Every terminal query operator
has an
*Async_sibling that returns aFuture. No callback chains. - SQLite-bundled.
RocketDb.open(path: ...)returns a fully-wired database.package:sqlite3is the only engine shipped out of the box. - Offline-first sync & realtime.
SyncProviderfor push/pull pipelines,WebSocketClientandServerSentEventsClientfor typed realtime streams. - 989 tests across the runtime, the codegen, and the SQLite engine — all passing.
Added (since 0.4.0-dev) #
Layer 1 — Serialization
@SerializablewithfromJson/toJsoncodegen.JsonNamingpolicy:none,snakeCase,camelCase,kebabCase,pascalCase.UnknownKeyPolicy:ignore(default, drop unknown keys),strict(throw),capture(route extras to anextra: Map<String, Object?>field — the class must declare one).@JsonKey(name: ..., ignore: ..., requiredKey: ..., defaultValue: ..., converter: ..., useEnumIndex: ..., unknownEnumValue: ...)for per-field overrides.Format(class, not enum):Format.trim(),Format.uppercase(),Format.lowercase(),Format.date('yyyy-MM-dd' | 'iso8601'),Format.custom(name),Format.customWith(type).@SerializableUnionfor sealed sum types with discriminator dispatch.
Layer 2 — REST
@RestClientwith@HttpGet/@HttpPost/@HttpPut/@HttpPatch/@HttpDelete/@HttpHead.- Parameter binding:
@Path,@Query,@Header,@Body,@Field,@Part,@RawBody. RestConfigfor one-place resilience configuration.RetryPolicywithBackoff.exponential/Backoff.fixed/Backoff.linear.RateLimit(requestsPerSecond: ...)token-bucket throttle.CircuitBreakerstate machine (closed→open→halfOpen→closed) withdRest.circuitState<T>().RestInterceptorinterface anddRest.use(...)chain (auth, logging, tracing, metrics).- Typed exception hierarchy:
RestHttpException,NetworkException,RestConfigException. CancelTokenfor cancellable requests.Stream<T>return types for streaming endpoints.
Layer 3 — LINQ
IQueryable<T>with deferred execution.- Operators:
where_,ofType_,select_,take_,skip_,takeWhile_,skipWhile_,orderBy_,orderByDescending_,thenBy_,thenByDescending_,distinct_,concat_,union_,intersect_,except_,any_,all_,contains_,count_,longCount_,sum_,average_,min_,max_,aggregate_,first_,firstOrDefault_,single_,singleOrDefault_,elementAt_,elementAtOrDefault_,toList_,toSet_,toMap_,asEnumerable_,cast_,join_,groupJoin_,groupBy_. - Async terminal operators:
toListAsync_,toSetAsync_,firstAsync_,firstOrDefaultAsync_,countAsync_,sumAsync_,averageAsync_,minAsync_,maxAsync_,anyAsync_,allAsync_. ExprDSL for expression-tree portability (the samewhere_(...)predicate is evaluated in-memory by the LINQ provider or pushed down to SQL by the ORM).- Closure-sugar extensions for prototyping over
Iterable<T>. - Reactive
watch()returning aStreamfor live data.
Layer 4 — ORM (SQLite-bundled)
@RocketTable('table_name')for entity declaration.@PrimaryKey(autoIncrement: true),@Column(name: ..., nullable: true, unique: true).- Type mapping:
int,double,String,bool,DateTime(ISO-8601),Uint8List(BLOB). @BelongsToand@HasManyfor navigation properties.RocketDb.open(path: ..., strategy: ...)/RocketDb.inMemory().- Change-tracked
DbSet<T>:add/addAsync,updateWhere/updateWhereAsync,removeWhere/removeWhereAsync. saveChanges()/saveChangesAsync()flushes the change set in a single transaction.include_<T>()codegen for eager-loading related entities in one round-trip.asLinqQueryable()bridge to the SQL LINQ provider.- Bulk operations:
addAll,updateAll,removeAll. - Reactive queries:
watch()returns aStream.
Migrations
Migrationbase class withid,version,name,up(exec),down(exec).MigrationRunnerfor direct execution.MigrationStrategywith declarativemigrationslist AND imperativeonCreate/onUpgrade/onDowngradecallbacks.- Automatic upgrade / downgrade detection based on
currentVersion()vs.targetVersion. _d_rocket_migrationstable for persisted migration history.dart run d_rocket:rocket_migration add <name>CLI scaffolder.dart run d_rocket:rocket_migration doctorvalidator.
Sync (offline-first)
SyncProviderinterface for push / pull pipelines.SyncOpqueue with persistence to SQLite.- Background flush on table-change watch streams.
- Conflict-resolution policies:
lastWriterWins(default)serverWins+clientWins+ custom callback.
- Identity persistence for re-attach after process restart.
- Exponential-backoff retry on
NetworkException.
Realtime
@WebSocketRoutefor typed WebSocket methods returningStream<T>.@SseRoutefor typed Server-Sent Events methods returningStream<T>.- Reconnect with exponential backoff.
- Heartbeat / ping support.
Codegen (d_rocket_builder)
d_rocket:rocket_serializerbuilder — emits per-classfromJson/toJsonand centralregister<X>Serializer.d_rocket:rocket_rest_clientbuilder — emits per-interfaceRestClientimplementations with interceptors, retry, and serialization wired in.d_rocket:rocket_tablebuilder — emits per-classfromRowandsetIdclosures for the ORM.- Single generated
d_rocket_registry.g.dartwithinitializeD()that registers every annotated class in the project.
Migration from d_serializer / d_rest 0.x #
d_serializer1.3.0 was absorbed intod_rocket 1.0. Replacepackage:d_serializer/d_serializer.dartwithpackage:d_rocket/d_rocket.dart. The annotation API is unchanged; the only API renames areSerializer.fromJson→Serializer.fromJson<T>andFormatimport path.d_rest0.1.0 was absorbed intod_rocket 1.0. Replacepackage:d_rest/d_rest.dartwithpackage:d_rocket/d_rocket.dart. The@RestClientAPI is unchanged; resilience config moved fromRestClientBuildertoRestConfigand thecircuitState<T>()extension moved todRest.circuitState<T>().
Acknowledgements #
The API design draws on patterns from several well-known frameworks: Entity Framework Core (DbContext, change tracking, Migrations), .NET LINQ (deferred execution, operator matrix), Retrofit (annotated interfaces), Moshi and kotlinx.serialization (annotation-driven serialization), and sqflite (SQLite migration runner).
License #
© Torogoz Tech. Released under the MIT License.