Skip to content
pubscout

disco

2.0.0, released 10 months ago by mariuti.com

Scoped dependency injection library for Flutter, independent of state management solutions

WASM-ready
$ flutter pub add disco
Source repository

What it does

Disco provides a way to declare providers that are scoped to a widget tree. The state is created and disposed within a ProviderScope, keeping it local and testable.

AI-written summary of version 2.0.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • Need multiple providers of the same type without wrapper types
  • Want local state that is automatically disposed with the widget
  • Prefer a simple API that works with any state management library

Skip it when

  • Require compile‑time safety for provider lookup
  • Need built‑in reactivity methods like watch or listen
  • Need global provider architecture

Strengths

  • Supports multiple providers of the same type
  • Lifecycle tied to widget tree, no global scope
  • Very simple API, works with any state‑management solution

Weaknesses

  • No built‑in reactivity; must use external listeners
  • Runtime error if provider not found
  • No compile‑time safety for provider lookup

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
1
final modelProvider = Provider((context) => Model());
ProviderScope(
  providers: [modelProvider],
  child: MyWidget(),
);

Alternatives

Packages that do the same job and could replace disco.

  • provider

    If you need a simple, widget‑tree scoped DI without multiple same‑type providers

  • riverpod

    If you need compile‑time safety and built‑in reactivity