riverpod-offline

Persist Riverpod notifier state to local storage backends for offline restarts.

Updated Mar 28, 2026
One-click install
npx skills add https://github.com/masssi164/weave --skill riverpod-offline-masssi164
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: riverpod-offline
Source: https://github.com/masssi164/weave/tree/main/.agent/skills/riverpod-offline
Command: npx skills add https://github.com/masssi164/weave --skill riverpod-offline-masssi164

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Persist Riverpod notifier state offline by storing to a local Storage backend so it remains available across app restarts and in offline scenarios.

Core Features & Use Cases

  • Offline persistence: Persist Notifier-based provider state using Storage backends such as riverpod_sqflite or JsonPersist.
  • Keyed state management: Define a unique key and optional destroyKey to manage migrations and data lifecycles.
  • Testing and portability: Leverage in-memory storage for tests and configure cache duration for state durability.
  • Use Case: When building a Flutter app that must retain user preferences or session data when the device is offline or when the app restarts.

Quick Start

Configure a Storage (e.g., riverpod_sqflite) and call persist inside your Notifier's build to save and restore state.

Frequently Asked Questions about riverpod-offline

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I persist Riverpod notifier state offline across app restarts in Flutter?

To persist Riverpod notifier state offline, configure a local Storage backend like riverpod_sqflite or JsonPersist and call persist inside your Notifier's build method to save and restore state across restarts.

What storage backends can I use to save Riverpod state locally?

You can use storage backends such as riverpod_sqflite or JsonPersist to save Riverpod state locally, requiring a Storage instance, a unique key, and encode/decode functions to operate.

Does Riverpod offline persistence work with Notifier-based providers?

Yes, Riverpod offline persistence works specifically with Notifier-based providers by intercepting the build method to automatically save and restore state to your configured local storage.

How do I handle data migrations when persisting Flutter state locally?

Handle data migrations by defining an optional destroyKey alongside your unique storage key, allowing you to manage data lifecycles and invalidate persisted Flutter state when schema changes occur.

Can I set a cache duration for persisted Riverpod state?

Yes, you can set a cache duration for persisted Riverpod state by configuring optional StorageOptions, which controls state durability and automatically expires stale local storage data.

How do I test offline state persistence without a physical device?

Test offline state persistence without a physical device by leveraging in-memory storage implementations, allowing you to verify Riverpod state save and restore logic efficiently in tests.