catalyst_builder 7.0.0-beta.2
catalyst_builder: ^7.0.0-beta.2 copied to clipboard
A lightweight and easy to use dependency injection container builder for dart.
Catalyst Builder #
A dependency injection container builder for dart.
Click on the image for a video on YouTube:
Screenshot #

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 (asingletonthat depends on ascopedservice). - 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.

