asyncredux-persistence

Persist AsyncRedux AppState locally with a custom Persistor and throttled writes.

238|39|Updated Aug 4, 2019
One-click install
npx skills add https://github.com/marcglasberg/async_redux --skill asyncredux-persistence
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: asyncredux-persistence
Source: https://github.com/marcglasberg/async_redux/tree/main/.claude/skills/asyncredux-persistence
Command: npx skills add https://github.com/marcglasberg/async_redux --skill asyncredux-persistence

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Persisting app state locally, enabling resume across sessions for AsyncRedux apps.

Core Features & Use Cases

  • Custom Persistor class implementation
  • readState(), deleteState(), persistDifference() methods
  • LocalPersist helper usage and throttling
  • App lifecycle integration for pause/resume

Quick Start

  1. Create a custom Persistor by extending Persistor<AppState> and implementing readState(), deleteState(), persistDifference(), and throttle as needed.
  2. Initialize the Store with initialState and persistor, restoring from disk or using a default initial state when none exists.
  3. Optionally integrate an AppLifecycleManager to pause/persist on app lifecycle changes.

Frequently Asked Questions about asyncredux-persistence

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

FAQPage Schema
How do I persist AppState locally in Flutter using AsyncRedux?

To persist AppState locally in Flutter, you implement a custom Persistor class with AsyncRedux to handle readState(), deleteState(), and persistDifference() methods for saving and restoring app data across sessions. You initialize the Store with this persistor and a restored or default initial state.

What is throttling in local state persistence and why use it?

Throttling in local state persistence controls the frequency of disk writes to optimize performance. By applying throttle control via a custom Persistor, you prevent excessive I/O operations during rapid state changes while ensuring app state is eventually saved.

Does this local persistence approach support app lifecycle pause and resume?

Yes, this local persistence approach supports app lifecycle pause and resume. You can integrate an AppLifecycleManager to pause persistence operations during background states and resume or persist state actively when the app lifecycle changes.

How do I restore a default AppState when no saved state exists on disk?

To restore a default AppState when no saved state exists on disk, initialize the Store with a default initial state. The custom Persistor's readState() method returns null if no prior state is found, triggering the fallback to the default state.

What's the best way to save only changed state locally instead of the entire AppState?

The best way to save only changed state locally is to implement the persistDifference() method in your custom Persistor. This approach captures state deltas instead of serializing the entire AppState, reducing disk write overhead during updates.