riverpod-offline

Persist Riverpod notifier state offline using SQFlite storage.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill enables the persistence of Riverpod notifier state, ensuring that data survives application restarts and remains accessible even when offline.

Core Features & Use Cases

  • Offline State Persistence: Stores provider state on the device using packages like riverpod_sqflite.
  • Notifier Support: Only Notifier-based providers can be persisted.
  • Key Management: Uses unique and stable keys for state identification and restoration.
  • Code Generation: Supports @JsonPersist() for automatic key, encode, and decode generation.
  • Cache Duration Control: Allows for long-lived data storage with StorageOptions.
  • Migration Handling: Provides destroyKey for discarding old data shapes.
  • Testing: Facilitates testing by overriding storage with Storage.inMemory().

Quick Start

Use the riverpod-offline skill to persist the 'todo_list' provider state using the 'todo_list' key and a custom JSON encoder and decoder.

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 in Flutter?

Flutter offline state persistence for Riverpod is achieved by storing notifier state in local databases like SQFlite. This skill manages state survival across application restarts using unique keys and custom JSON encoding.

Can I use code generation to handle Riverpod state persistence?

Yes, code generation simplifies Riverpod state persistence by using the @JsonPersist() annotation to automatically generate unique keys, encoders, and decoders for your notifier state.

Does Riverpod offline persistence support all provider types?

No, Riverpod offline persistence only supports Notifier-based providers. State from other provider types cannot be persisted locally using this mechanism.

How do I discard old Riverpod state shapes during app updates?

Discard old Riverpod state shapes during app updates by using the destroyKey option. This handles data migration by permanently removing previously stored state that no longer matches the current structure.

What is the best way to test offline persistence for Riverpod providers?

Test offline persistence for Riverpod providers by overriding the default storage with Storage.inMemory(). This facilitates fast testing without requiring an actual physical database like SQFlite.

How do I control cache duration for long-lived Flutter state storage?

Control cache duration for long-lived Flutter state storage by configuring StorageOptions. This allows you to specify exactly how long persisted Riverpod state remains valid before it expires.