d_rocket_builder library

๐Ÿš€ d_rocket_builder โ€” build_runner codegen for d_rocket.

This package provides five build_runner builders that together wire up the d_rocket framework:

  1. d_rocket_builder:record (a PartBuilder with the default .g.dart suffix) โ€” walks extends Record classes and emits a part file with a _[ClassName]Init class plus a register[ClassName]Record() function per class.
  2. d_rocket_builder:serializer (a PartBuilder with the .d_rocket_serializer.g.dart suffix) โ€” walks @Serializable classes and emits a part file with XFromJson / XToJson / register[X]Serializer() per class.
  3. d_rocket_builder:rest_client (a PartBuilder with the .d_rocket_rest_client.g.dart suffix) โ€” walks @RestClient classes and emits a part file with a _$[ClassName] implementation plus a register[ClassName]RestClient() factory per class.
  4. d_rocket_builder:rocket_table (a PartBuilder with the .d_rocket_orm.g.dart suffix) โ€” walks @Table classes and emits a part file with a _$Table[ClassName].entityMeta literal plus a register[ClassName]EntityMeta() helper per class.
  5. d_rocket_builder:record_registry (a LibraryBuilder) โ€” scans the consumer's lib/**.dart, collects all extends Record and all @Serializable and all @RestClient and all @Table classes, and emits a single lib/d_rocket_registry.g.dart with a public initializeD() function that calls every register[ClassName]Record(), every register[ClassName]Serializer(), every register[ClassName]RestClient(), and every register[ClassName]EntityMeta().

The user calls initializeD() once in main() and every d_rocket-managed class is wired up.

/ / (absorb + ORM)

The d_rocket_builder:serializer and the extension of d_rocket_builder:record_registry to detect @Serializable were added in . The d_rocket_builder:rest_client and the extension of d_rocket_builder:record_registry to detect @RestClient were added in . The d_rocket_builder:rocket_table and the extension of d_rocket_builder:record_registry to detect @Table were added in ("ORM").

Before these phases, the codegen was split across three separate packages (d_builder, d_serializer_build, d_rest_build) with three separate initializeD*() calls. All four (records, serializers, REST clients, ORM tables) are now unified here under a single initializeD().

Output namespaces

The four per-file builders use distinct PartBuilder suffixes so a single Dart file can use extends Record + @Serializable + @RestClient + @Table without any build error:

  • record โ†’ *.g.dart (the default source_gen suffix for extends Record classes).
  • serializer โ†’ *.d_rocket_serializer.g.dart ('s non-default suffix to avoid collision with the record builder; see HANDOFF.md ยง6).
  • rest_client โ†’ *.d_rocket_rest_client.g.dart ('s non-default suffix, same rationale).
  • rocket_table โ†’ *.d_rocket_orm.g.dart ('s non-default suffix, same rationale).

Classes

DRocketLintsPlugin
The d_rocket analyzer plugin. Registers both lint rules and one IDE quick-fix:
LinqClosureFix
The CorrectionProducer (quick-fix) associated with LinqClosureRule.code.
LinqClosureRule
The rule class. Registered in lib/main.dart's DRocketLintsPlugin.register.
NPlusOneRule
The rule class. Registered in lib/main.dart's DRocketLintsPlugin.register.

Functions

buildRealtime(BuilderOptions options) โ†’ Builder
Builder factory for d_rocket_builder:realtime.
buildRecord(BuilderOptions options) โ†’ Builder
Builder factory for d_rocket_builder:record.
buildRecordRegistry(BuilderOptions options) โ†’ Builder
Builder factory for d_rocket_builder:record_registry.
buildRestClient(BuilderOptions options) โ†’ Builder
Builder factory for d_rocket_builder:rest_client.
buildRocketMigration(BuilderOptions options) โ†’ Builder
Builder factory for d_rocket_builder:rocket_migration.
buildRocketTable(BuilderOptions options) โ†’ Builder
Builder factory for d_rocket_builder:rocket_table.
buildSerializer(BuilderOptions options) โ†’ Builder
Builder factory for d_rocket_builder:serializer.

Typedefs

LinqClosureLint = LinqClosureRule
Backward-compat re-exports. The 1.x + custom_lint_builder API exposed LinqClosureLint, LinqClosureFix, and DRocketLintsPlugin classes. The 2.0 migration renamed these to LinqClosureRule, LinqClosureFix (now a CorrectionProducer), and DRocketLintsPlugin (now an AnalysisServerPlugin Plugin).
NPlusOneLint = NPlusOneRule
Backward-compat alias. The 1.x + custom_lint_builder API exposed this rule as NPlusOneLint; the 2.0 + analysis_server_plugin version is NPlusOneRule. The old name continues to compile via this typedef so consumers don't have to update their imports.