riverpod_community_extensions
3.0.0, released a year ago by bam.tech
Extends Riverpod ref types with helpers like caching, debouncing, and auto-refreshing.
What it does
Provides useful extension methods on Riverpod ref types to easily add common functionalities to providers. Features include caching data durations, debouncing computations, auto-refreshing intervals, and refreshing when returning to the foreground or when the network becomes available.
AI-written summary of version 3.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want to prevent a provider from being disposed immediately using cacheFor or cacheDataFor.
- You need automatic periodic refreshing or network-aware refreshing for your providers.
- You want to debounce provider computations or refresh AsyncNotifiers when the app returns to the foreground.
Skip it when
- You are using Riverpod version 2 (version 3.0.0 requires Riverpod 3).
- You do not use Riverpod in your application.
Strengths
- Simplifies common provider lifecycle and caching patterns in Riverpod.
- Includes helpful connectivity and lifecycle-aware refresh triggers.
- Compatible with both traditional providers and code generation.
Weaknesses
- Strictly tied to Riverpod 3 in version 3.0.0.
- Some methods are limited to specific ref types like AsyncNotifier.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 2
Simply add the package dependency and import it in your Dart files where Riverpod ref is used.
import 'package:riverpod_community_extensions/riverpod_community_extensions.dart';
import 'package:riverpod/riverpod.dart';
final dataProvider = AsyncNotifierProvider<DataNotifier, int>(
DataNotifier.new,
isAutoDispose: true,
);
class DataNotifier extends AutoDisposeAsyncNotifier<int> {
@override
Future<int> build() async {
ref.cacheDataFor(const Duration(minutes: 5));
return await fetchDataFromApi();
}
}Alternatives
Packages that do the same job and could replace riverpod_community_extensions.
- jaspr_riverpod
Riverpod‑style state management for Jaspr with BuildContext extensions and server‑client sync.
75Compare - refena
A state management and dependency injection library inspired by Riverpod and async_redux.
87Compare - refena_flutter
A state management and dependency injection library for Dart and Flutter.
82Compare - riverbloc
BlocProvider implementation with riverpod as alternative to provider.
62Compare
Works with
Packages commonly used together with riverpod_community_extensions: ones it builds on, ones built on it, and its own family.
- connectivity_plusriverpod_community_extensions depends on itDiscover the state of network connectivity (WiFi, mobile, ethernet) on Android, iOS, Web and desktops.
- riverpodriverpod_community_extensions depends on itA reactive caching and data-binding framework. Riverpod makes working with asynchronous code a breeze.