asyncredux-before-after

Coordinate before, reduce, and after steps in AsyncRedux actions.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

AsyncRedux actions often need precondition checks, deterministic side effects, and reliable cleanup. This skill provides a structured approach to coordinating before, reduce, and after methods to ensure safe, predictable execution.

Core Features & Use Cases

  • Before and after hooks support synchronous or asynchronous code for precondition checks and cleanup
  • Guarantees that after() runs even if before() or reduce() fail, enabling safe resource management
  • Supports modal barriers, loading indicators, and cleanup patterns through recommended usage
  • Works with common patterns like mixins to compose lifecycle behaviors across actions

Quick Start

Define a ReduxAction with before() to validate preconditions and show a loading indicator, implement reduce() for the main work, and override after() to hide the indicator and perform cleanup.

Frequently Asked Questions about asyncredux-before-after

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

FAQPage Schema
How do I ensure cleanup logic runs in AsyncRedux when an action fails?

AsyncRedux guarantees that the after() method runs even if before() or reduce() fails, ensuring reliable resource cleanup and side-effect management during the action lifecycle.

Can I run asynchronous precondition checks before a Redux action reduces in Flutter?

Yes, you can run asynchronous precondition checks by overriding the before() method in your AsyncRedux action, which supports both synchronous and asynchronous operations to validate conditions before reduce() executes.

What is the best way to show and hide a loading barrier during an async Redux action?

The best way to manage a loading barrier is to display it in the before() hook and dismiss it in the after() hook, leveraging AsyncRedux's guaranteed after() execution to prevent orphaned modal barriers even on failure.

How do I abort an AsyncRedux action if preconditions are not met?

You can abort an AsyncRedux action during the before() phase by utilizing abortDispatch semantics, which halts the action lifecycle and prevents the reduce() method from executing if the required preconditions are not satisfied.

Can I compose before and after lifecycle hooks across multiple AsyncRedux actions?

Yes, you can compose before and after lifecycle hooks across multiple AsyncRedux actions by using mixins, allowing you to share precondition checks, loading indicators, and cleanup patterns consistently throughout your Flutter app.

Why does my AsyncRedux action leave a modal barrier open after throwing an error?

A modal barrier remains open if the cleanup logic is placed in reduce() instead of the after() method, but moving the dismiss logic to after() guarantees it executes even when reduce() or before() encounters an error.