d_rocket 1.0.0 copy "d_rocket: ^1.0.0" to clipboard
d_rocket: ^1.0.0 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.0 — 2026-06-12 — First stable release #

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 Rocket prefix is gone from the public API. Every public type and every CLI command has been renamed. The old RocketTable is now Table; RocketDbContext is DbContext; the CLI command d_rocket:rocket_migration is now d_rocket:migration; etc. The full mapping is in the README's "Breaking changes in v1.0 — the rename" section. The annotation @RocketMigration is now @Migration; the abstract base class that the codegen-emitted migration subclass extends is MigrationBase (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 ran build_runner on the pre-release will need a one-time dart run build_runner build --delete-conflicting-outputs after 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 a Future. No callback chains.
  • SQLite-bundled. RocketDb.open(path: ...) returns a fully-wired database. package:sqlite3 is the only engine shipped out of the box.
  • Offline-first sync & realtime. SyncProvider for push/pull pipelines, WebSocketClient and ServerSentEventsClient for 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

  • @Serializable with fromJson / toJson codegen.
  • JsonNaming policy: none, snakeCase, camelCase, kebabCase, pascalCase.
  • UnknownKeyPolicy: ignore (default, drop unknown keys), strict (throw), capture (route extras to an extra: 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).
  • @SerializableUnion for sealed sum types with discriminator dispatch.

Layer 2 — REST

  • @RestClient with @HttpGet / @HttpPost / @HttpPut / @HttpPatch / @HttpDelete / @HttpHead.
  • Parameter binding: @Path, @Query, @Header, @Body, @Field, @Part, @RawBody.
  • RestConfig for one-place resilience configuration.
  • RetryPolicy with Backoff.exponential / Backoff.fixed / Backoff.linear.
  • RateLimit(requestsPerSecond: ...) token-bucket throttle.
  • CircuitBreaker state machine (closedopenhalfOpenclosed) with dRest.circuitState<T>().
  • RestInterceptor interface and dRest.use(...) chain (auth, logging, tracing, metrics).
  • Typed exception hierarchy: RestHttpException, NetworkException, RestConfigException.
  • CancelToken for 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_.
  • Expr DSL for expression-tree portability (the same where_(...) 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 a Stream for 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).
  • @BelongsTo and @HasMany for 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 a Stream.

Migrations

  • Migration base class with id, version, name, up(exec), down(exec).
  • MigrationRunner for direct execution.
  • MigrationStrategy with declarative migrations list AND imperative onCreate / onUpgrade / onDowngrade callbacks.
  • Automatic upgrade / downgrade detection based on currentVersion() vs. targetVersion.
  • _d_rocket_migrations table for persisted migration history.
  • dart run d_rocket:rocket_migration add <name> CLI scaffolder.
  • dart run d_rocket:rocket_migration doctor validator.

Sync (offline-first)

  • SyncProvider interface for push / pull pipelines.
  • SyncOp queue 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

  • @WebSocketRoute for typed WebSocket methods returning Stream<T>.
  • @SseRoute for typed Server-Sent Events methods returning Stream<T>.
  • Reconnect with exponential backoff.
  • Heartbeat / ping support.

Codegen (d_rocket_builder)

  • d_rocket:rocket_serializer builder — emits per-class fromJson / toJson and central register<X>Serializer.
  • d_rocket:rocket_rest_client builder — emits per-interface RestClient implementations with interceptors, retry, and serialization wired in.
  • d_rocket:rocket_table builder — emits per-class fromRow and setId closures for the ORM.
  • Single generated d_rocket_registry.g.dart with initializeD() that registers every annotated class in the project.

Migration from d_serializer / d_rest 0.x #

  • d_serializer 1.3.0 was absorbed into d_rocket 1.0. Replace package:d_serializer/d_serializer.dart with package:d_rocket/d_rocket.dart. The annotation API is unchanged; the only API renames are Serializer.fromJsonSerializer.fromJson<T> and Format import path.
  • d_rest 0.1.0 was absorbed into d_rocket 1.0. Replace package:d_rest/d_rest.dart with package:d_rocket/d_rocket.dart. The @RestClient API is unchanged; resilience config moved from RestClientBuilder to RestConfig and the circuitState<T>() extension moved to dRest.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.

2
likes
0
points
537
downloads

Documentation

Documentation

Publisher

verified publishertorogoz.tech

Weekly Downloads

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.

Repository (GitHub)
View/report issues

Topics

#linq #orm #sqlite #codegen #framework

License

unknown (license)

Dependencies

flutter, http, meta, sqlite3

More

Packages that depend on d_rocket