Skip to content
pubscout

riverpod_context

0.3.0, released 4 years ago by schultek.dev

Brings back context.read and context.watch extensions for Riverpod.

WASM-ready
$ flutter pub add riverpod_context
Source repository

What it does

Brings back context.read and context.watch extensions for Riverpod discontinued in version 1.0.0. Provides convenient context extensions like read, watch, refresh, invalidate, listen, and subscribe to interact with providers.

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

Use it when

  • You want to use context.read and context.watch style interactions with Riverpod
  • You want an alternative to ConsumerWidget and ConsumerStatefulWidget

Skip it when

  • You prefer using official Riverpod ConsumerWidgets without context extensions
  • You cannot add InheritedConsumer underneath the root ProviderScope

Strengths

  • Familiar context-based API for developers coming from Provider
  • Supports .select(), provider families, and autoDispose providers

Weaknesses

  • Requires adding InheritedConsumer under the root ProviderScope
  • Requires caution and rules (like context.prime) when conditionally watching providers

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
1

Add InheritedConsumer underneath the root ProviderScope.

ProviderScope(
  child: InheritedConsumer(
    child: MyApp(),
  ),
)

Alternatives

Packages that do the same job and could replace riverpod_context.

  • riverpod

    Use the official core package and standard Consumer widgets instead of context extensions.

  • provider

    Native context.read/watch state management solution without Riverpod.

Works with

Packages commonly used together with riverpod_context: ones it builds on, ones built on it, and its own family.