Skip to main content

catalyst_builder 7.0.0-beta.2 copy "catalyst_builder: ^7.0.0-beta.2" to clipboard
catalyst_builder: ^7.0.0-beta.2 copied to clipboard

A lightweight and easy to use dependency injection container builder for dart.

GitHub license GitHub issues GitHub Workflow Status Pub Pub Points Pub Publisher Pub Likes

Catalyst Builder #

A dependency injection container builder for dart.

Click on the image for a video on YouTube:

YouTube Video

Screenshot #

minimal.png

Background #

Since Catalyst is only for Dart and Flutter Catalyst supports Flutter, but a mess to configure I decided to do something cooler.

Catalyst Builder is a dependency injection container builder for both, Dart and Flutter. It's easy to use and dependency injection is almost done automatically. You only have to decorate your services with @Service and the build_runner will create a service container for you.

Installation & Documentation #

You can find a quick start guide and further documentation for this package in the wiki on GitHub.

Upgrading from 6.x to 7.x? Read the upgrade guide.

Build time validation #

The generator validates the service graph while it generates the plugin:

  • Errors (abort the build): circular dependencies (A -> B -> A) and captive dependencies (a singleton that depends on a scoped service).
  • Warnings (logged): required constructor parameters whose type is not a known service in this plugin (it may come from parameters, register() or another plugin) and two services that are exposed as the same type.

Configure the behavior with the validation option of the builder in your build.yaml:

targets:
  $default:
    builders:
      catalyst_builder:buildServiceContainerPlugin:
        options:
          validation: strict   # strict | warn | off   (default: warn)
  • strict: errors and warnings abort the build.
  • warn (default): errors abort the build, warnings are logged.
  • off: the service graph is not validated.
9
likes
150
points
665
downloads
screenshot

Documentation

Documentation
API reference

Publisher

verified publishermintware.de

Weekly Downloads

A lightweight and easy to use dependency injection container builder for dart.

Homepage
Repository (GitHub)
View/report issues

Topics

#code-generation #builder #dependency-injection #annotations #service-provider

Funding

Consider supporting this project:

github.com

License

MIT (license)

Dependencies

analyzer, build, catalyst_builder_runtime, code_builder, dart_style, glob

More

Packages that depend on catalyst_builder