Skip to main content

genesis_generator 2.0.0 copy "genesis_generator: ^2.0.0" to clipboard
genesis_generator: ^2.0.0 copied to clipboard

Generates typed startup registrations and diagnostics graphs from Genesis task and provider annotations in Dart and Flutter packages.

genesis_generator #

Generates typed startup registrations and diagnostic graphs for Genesis. Use Dart 3.9 or later to run the generator.

Installation #

Once both packages are available on pub.dev, add these dependencies to your application.

dependencies:
  genesis: ^2.0.0

dev_dependencies:
  build_runner: ^2.7.1
  genesis_generator: ^2.0.0

Usage #

Define startup functions in lib/genesis.dart with @GenesisTask and @GenesisProvider. Include part 'genesis.g.dart'; in that library. From the application's package directory, generate the startup code.

dart run build_runner build

Import the application's genesis.dart and call await runGenesis() from the entry point. The quick start shows both files. The runnable example uses the workspace packages from a checkout.

The builder writes lib/genesis.g.dart for startup and .dart_tool/genesis_graph.json for genesis:doctor.

Generated registrations #

  • Typed provider registrars for @GenesisProvider functions.
  • Task descriptors for configure, init, and execution.
  • A GenesisPackageManifest used by runtime diagnostics.
  • Bootstrap functions for directly imported Genesis dependencies.

@GenesisProvider and @GenesisTask(phase: ...) methods may use required positional provider object parameters. The generator injects those values with genesisReadProvider<T>() and records the inferred parameter metadata. @GenesisTask(requires: ...) records order-only dependencies, and @GenesisTask(provides: ...) records readiness tokens that do not require a function return value.

@GenesisProvider(eager: true) is emitted into both provider descriptors and graph metadata. Task GenesisCondition values are emitted into task descriptors and the graph so runtime planning and doctor output stay aligned.

The builder checks that lib/genesis.dart imports each direct Genesis dependency. It checks for duplicate type sources, provider cycles, and invalid phase dependencies after applying task conditions for each platform and build mode. Mutually exclusive task outputs can share a type. Run Doctor on the resulting graph to check for missing dependencies.

Documentation #

0
likes
140
points
0
downloads

Documentation

API reference

Publisher

verified publisherbillbook.net.cn

Weekly Downloads

Generates typed startup registrations and diagnostics graphs from Genesis task and provider annotations in Dart and Flutter packages.

Repository (GitHub)
View/report issues

Topics

#startup #initialization #codegen

License

BSD-3-Clause (license)

Dependencies

analyzer, build, dart_style, genesis, glob, source_gen, yaml

More

Packages that depend on genesis_generator