jaspr_riverpod
0.4.6, released 5 months ago by schultek.dev
Riverpod‑style state management for Jaspr with BuildContext extensions and server‑client sync.
What it does
Provides the full Riverpod API for Jaspr components, letting you read, watch, and listen to providers via BuildContext. Includes a sync feature to transfer provider state from server‑side pre‑rendering to the client.
AI-written summary of version 0.4.6, based on the package's README and metadata. Report an inaccuracy
Use it when
- You are building a Jaspr web or multi‑platform app and need reactive state management.
- You want Riverpod’s API without extra Consumer widgets.
- You need to share provider state between server‑side rendering and the client.
Skip it when
- You are developing a Flutter app (use flutter_riverpod).
- You require code‑generation based providers or advanced DI features.
Strengths
- Feature‑parity with Riverpod 3.
- Simple context‑based access eliminates Consumer boilerplate.
- Built‑in sync of provider state between server and client.
Weaknesses
- Works only with Jaspr, not Flutter or other frameworks.
- No code‑generation support; manual provider definitions required.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 3
Add jaspr_riverpod to pubspec, import the package, and wrap the root component with ProviderScope.
ProviderScope(
sync: [myProvider.syncWith('key')],
child: MyComponent(),
);
class MyComponent extends StatelessComponent {
@override
Component build(BuildContext context) {
final value = context.watch(myProvider);
return Text(value);
}
}Alternatives
Packages that do the same job and could replace jaspr_riverpod.
- flutter_riverpod
A reactive caching and data-binding framework for Flutter.
93Compare - hooks_riverpod
A reactive caching, data-binding, and state management framework with flutter_hooks integration.
93Compare - 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
Works with
Packages commonly used together with jaspr_riverpod: ones it builds on, ones built on it, and its own family.
- riverpodjaspr_riverpod depends on itA reactive caching and data-binding framework. Riverpod makes working with asynchronous code a breeze.
- jasprjaspr_riverpod depends on itA web framework for building websites in Dart with Flutter-like syntax and server-side rendering.
- jaspr_routerSame familyA simple routing component for Jaspr web applications adapted from go_router.
- jaspr_lintsSame familyA collection of lints and code assists for Jaspr projects.
- jaspr_contentSame familyJaspr plugin for building content-driven sites like documentation and blogs.