Skip to content
pubscout

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.

WASM-ready
$ flutter pub add jaspr_riverpod
Source repository

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.

  • hooks_riverpod

    A reactive caching, data-binding, and state management framework with flutter_hooks integration.

  • refena

    A state management and dependency injection library inspired by Riverpod and async_redux.

  • refena_flutter

    A state management and dependency injection library for Dart and Flutter.

Works with

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