Overview
CherryPick is a lightweight, modular dependency injection toolkit for Dart and Flutter. You describe how to build your services in modules, install the modules into a scope, and resolve dependencies from that scope — synchronously or asynchronously, by type or by name. Scopes form a tree, so features and screens can get their own isolated dependencies and release them deterministically.
CherryPick works in pure Dart (CLI, server) and in Flutter apps, and you can wire it by
hand or let cherrypick_generator write the wiring from annotations.
Key features
Section titled “Key features”Scopes and composition
- Root scope and named subscopes, nested to any depth — see Hierarchical Subscopes
- Modular composition: group related bindings into modules
Bindings and resolution
- Synchronous and asynchronous providers
- Providers with runtime parameters
- Named instances for several implementations of one type
- Singleton lifecycle
- Null-safe resolution with
tryResolve/tryResolveAsync
Reliability and tooling
- Automatic cleanup of every registered
Disposable - Circular dependency detection, within one scope or across scopes
- Logging of DI state and events through observers
- Annotations and code generation to remove boilerplate
- IDE lint plugin (
cherrypick_lint) that catches API misuse as you type
Packages
Section titled “Packages”| Package | Purpose |
|---|---|
cherrypick |
Runtime DI core: scopes, modules, bindings |
cherrypick_flutter |
CherryPickProvider for the widget tree |
cherrypick_annotations + cherrypick_generator |
Annotation-driven code generation |
talker_cherrypick_logger |
DI event logging via Talker |
cherrypick_lint |
Analyzer plugin for the IDE and dart analyze |
More details and links are in Packages & Resources.
Where to go next
Section titled “Where to go next”- Install the packages.
- Follow the Quick Start to build your first module and scope.
- Read the Core Concepts once the basics click.