simplify-state

Migrate Cubit state from isLoading and error fields to context.isWaiting() and context.isFailed().

7|Updated Jan 27, 2026
One-click install
npx skills add https://github.com/marcglasberg/bloc_superpowers --skill simplify-state
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: simplify-state
Source: https://github.com/marcglasberg/bloc_superpowers/tree/main/.claude/skills/simplify-state
Command: npx skills add https://github.com/marcglasberg/bloc_superpowers --skill simplify-state

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

The skill helps teams migrate Bloc/Cubit state management by removing isLoading and error-related fields from state classes and updating copies and UI logic to rely on context.isWaiting() and context.isFailed().

Core Features & Use Cases

  • Detects and removes isLoading, loading, isProcessing, errorMessage, error, and related fields from state classes.
  • Updates copyWith methods and Cubit methods to use mix keys and remove explicit loading/error emissions.
  • Replaces widget checks with context.isWaiting(key) and context.isFailed(key), and surfaces exceptions via context.getException(key).
  • Use case: Upgrading an existing Flutter app that uses legacy loading/error fields to a cleaner, predictable UI flow across screens.

Quick Start

Apply the migration steps to a sample Cubit and its widgets to remove loading and error fields and replace checks with context.isWaiting and context.isFailed.

Frequently Asked Questions about simplify-state

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

FAQPage Schema
How do I migrate Flutter Cubit state to remove isLoading and error fields?

Migrating Flutter Cubit state involves removing isLoading and error fields from state classes, updating copyWith methods, wrapping cubit methods with mix, and replacing UI checks with context.isWaiting() and context.isFailed().

What is the best way to handle loading and error states in Flutter Bloc without explicit fields?

Handling loading and error states in Flutter Bloc without explicit fields uses context.isWaiting(key) for loading checks and context.getException(key) to surface exceptions directly within UI widgets.

Can I use this state management refactor for typical CRUD list-loading scenarios in Dart?

Yes, this state management refactor applies to Dart/Flutter projects using Bloc/Cubit patterns in typical CRUD or list-loading scenarios, updating state classes, cubits, and UI widgets.

How does context.isFailed replace errorMessage checks during a Flutter state refactor?

context.isFailed replaces errorMessage checks by detecting failure states through mix keys, allowing widgets to use context.getException(key) to retrieve actual exception details without explicit error fields.

What are the limitations of migrating state management with mix keys in existing Flutter apps?

Migrating state management with mix keys requires refactoring state classes, updating copyWith methods, and adopting context.isWaiting and context.isFailed, strictly applying to Flutter projects using Bloc/Cubit patterns.