FLUTTER ECOSYSTEM

riverpod_context

This package brings back context.read and context.watch for riverpod

Latest version
0.3.0
30-day downloads
1.2K
Likes
18
Pub points
150

Package Overview

Selection guidance generated from public package information. For reference only.

Overview

The riverpod_context package restores the convenient context.read and context.watch methods in Riverpod, which were removed in newer versions. It enables developers to access providers directly from a BuildContext without needing to use the more verbose ProviderContainer or other workarounds. This improves code readability and developer experience when working with Riverpod's state management system across multiple platforms.

Use cases
  • Accessing providers within widgets
  • Simplifying state consumption in UI
  • Improving code clarity in complex widget trees
  • Enabling watch and read patterns in non-ProviderContainer contexts
  • Reducing boilerplate when using Riverpod
Key features
  • Reintroduces context.read()
  • Reintroduces context.watch()
  • Works with all Riverpod providers
  • Supports all major platforms
  • Minimal setup required
Suitable for
  • Developers using Riverpod who miss context.read/watch
  • Projects requiring clean, readable state access
  • Teams prioritizing developer ergonomics
  • Apps targeting multiple platforms
  • Flutter apps with heavy state management usage
Considerations
  • Requires careful use to avoid performance issues
  • Not needed if using ProviderContainer directly
  • May conflict with future Riverpod updates
  • Best used in conjunction with proper provider scoping
  • Avoid in deeply nested or frequently rebuilt widgets
Supported platformsAndroidiOSWebmacOSWindowsLinux

Install package

flutter pub add riverpod_context

Categories

Source repository

Related projects

No data available yet.