asyncredux-persistence

Solid

Implement local state persistence using Persistor. Covers creating a custom Persistor class, implementing `readState()`, `persistDifference()`, `deleteState()`, using LocalPersist helper, throttling saves, and pausing/resuming persistence with app lifecycle.

Web & Frontend 238 stars 38 forks Updated 4 weeks ago NOASSERTION

Install

View on GitHub

Quality Score: 77/100

Stars 20%
79
Recency 20%
90
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

## Overview AsyncRedux provides state persistence by passing a `persistor` object to the Store. This maintains app state on disk, enabling restoration between sessions. ## Store Initialization with Persistor At startup, read any existing state from disk, create default state if none exists, then initialize the store: ```dart var persistor = MyPersistor(); var initialState = await persistor.readState(); if (initialState == null) { initialState = AppState.initialState(); await persistor.saveInitialState(initialState); } var store = Store<AppState>( initialState: initialState, persistor: persistor, ); ``` ## The Persistor Abstract Class The `Persistor<St>` base class defines these methods: ```dart abstract class Persistor<St> { /// Read persisted state, or return null if none exists Future<St?> readState(); /// Delete state from disk Future<void> deleteState(); /// Save state changes. Provides both newState and lastPersistedState /// so you can compare them and save only the difference. Future<void> persistDifference({ required St? lastPersistedState, required St newState }); /// Convenience method for initial saves Future<void> saveInitialState(St state) => persistDifference(lastPersistedState: null, newState: state); /// Controls save frequency. Return null to disable throttling. Duration get throttle => const Duration(seconds: 2); } ``` ## Creating a Custom Persistor Extend the abstract class and implement the requir...

Details

Author
marcglasberg
Repository
marcglasberg/async_redux
Created
6 years ago
Last Updated
4 weeks ago
Language
Dart
License
NOASSERTION

Similar Skills

Semantically similar based on skill content — not just same category

Web & Frontend Solid

aberdeen

Expert guidance for building reactive UIs with the Aberdeen library. Covers element creation, reactive state management, efficient list rendering, CSS integration, routing, transitions, and optimistic updates.

105 Updated 5 days ago
vanviegen
Web & Frontend Solid

apple-engineer-superpowers

Use when writing Swift code for Apple platforms - iOS, macOS, visionOS. Covers Swift 6 concurrency, actors, Sendable, async/await, SwiftUI, MVVM architecture, Metal GPU programming, RealityKit ECS, visionOS scenes, interpolation/animation, advanced collection types, property wrappers, Combine bridging, error handling, testing, and API design patterns.

23 Updated 2 months ago
piemonte
AI & Automation Solid

sync

Fast save-point: sync all session-context files and MEMORY.md with current progress. Zero questions, zero delay. Use when user says /sync, save progress, save state, sync context, or /sync --full for capability inventory.

87 Updated 4 weeks ago
anombyte93
Data & Documents Solid

short-term-memory

Maintain working context via current-context.md - read before and update after every response with timestamp YYYYMMDD-HHMMSS

21 Updated 2 months ago
Malaiac
Code & Development Solid

remotion-transitions

This skill should be used when the user asks to create custom Remotion transitions, asks about "cool transitions", "cinematic transitions", "striped transitions", "glitch transitions", "custom TransitionPresentation", or wants to build scene-to-scene transitions in Remotion beyond the built-in library. Also triggers for "how to make transitions in Remotion", "custom transition", "high-energy transitions", "energy transitions", "branded transitions".

63 Updated 2 months ago
Ashad001