scoped_deps
0.2.1, released 4 months ago by mrgnhnt.com
A simple DI library using Dart Zones for scoped dependencies.
WASM-readySingle maintainer
What it does
Provides a way to register and resolve values within a zone‑based scope. Overrides can be applied per‑scope and are automatically respected in async code. No code generation or Flutter‑specific widgets are required.
AI-written summary of version 0.2.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need lightweight, runtime‑only dependency injection in pure Dart or Flutter projects.
- You want scoped overrides that work across async boundaries without extra boilerplate.
Skip it when
- You require compile‑time safety or code‑generated bindings.
- You need integration with Flutter widget trees or provider‑style APIs.
Strengths
- Zero code‑generation, works out of the box.
- Scoped overrides are easy to test and work with async code.
- Pure Dart, no platform‑specific setup.
Weaknesses
- Relies on Zones, which can be confusing for newcomers.
- No compile‑time checks for missing bindings.
- Smaller ecosystem compared to more popular DI packages.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
import 'package:scoped_deps/scoped_deps.dart';
final value = create(() => 42);
void main() {
runScoped(() {
print(read(value)); // 42
}, values: {value});
}Alternatives
Packages that do the same job and could replace scoped_deps.
Works with
Packages commonly used together with scoped_deps: ones it builds on, ones built on it, and its own family.