bloc

Implement Flutter state management with Bloc and Cubit patterns.

2|Updated Aug 13, 2023
One-click install
npx skills add https://github.com/NNPopov/movie-theater-tickets --skill bloc-nnpopov
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bloc
Source: https://github.com/NNPopov/movie-theater-tickets/tree/main/src/clients/.claude/skills/bloc
Command: npx skills add https://github.com/NNPopov/movie-theater-tickets --skill bloc-nnpopov

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you design, implement, and test predictable Flutter state management with bloc and flutter_bloc instead of mixing business logic into widgets.

Core Features & Use Cases

  • Cubit vs Bloc decisions: Choose the simplest pattern for the job, from lightweight state updates to event-driven workflows.
  • State modeling: Structure state with sealed classes or a single immutable state class and status enum.
  • Widget integration: Wire BlocProvider, BlocBuilder, BlocListener, BlocConsumer, and related widgets into the UI tree.
  • Testing and refactoring: Write bloc_test coverage, mock repositories, and modernize existing state logic with clearer conventions.
  • Use case: Build a login, checkout, or seat-selection flow that reacts to loading, success, and failure states without duplicating logic.

Quick Start

Use the bloc skill to design a new Flutter feature with a Cubit or Bloc, connect it to the widget tree, and add tests for its state transitions.

Frequently Asked Questions about bloc

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

FAQPage Schema
How do I manage Flutter state with bloc and cubit for predictable UI rebuilding?

Flutter state management with bloc and cubit structures UI-driven application logic through predictable state transitions, event handling, and reactive rebuilding. It separates business logic from widgets using repository-based dependency injection and immutable state modeling.

When should I use a Cubit versus a Bloc for Flutter state management?

Choose Cubit for lightweight state updates and simpler logic flows, while Bloc is better suited for complex, event-driven workflows. The decision depends on whether your feature screen requires simple function calls or structured event handling for predictable state transitions.

How do I wire BlocProvider and BlocBuilder into a Flutter widget tree?

Wire Flutter widgets by integrating BlocProvider, BlocBuilder, BlocListener, and BlocConsumer into the UI tree. This connects your cubit or bloc to the widget layer, enabling reactive UI updates and side-effect execution based on state changes.

How do I write bloc_test coverage for Flutter state transitions?

Write bloc_test coverage by mocking repositories and testing state transitions for loading, success, and failure states. This ensures your Flutter bloc and cubit logic handles events correctly and produces predictable, immutable state sequences without duplicating logic.

What is the best way to model immutable state for a Flutter Bloc?

Model immutable Flutter bloc state using either sealed classes or a single immutable state class paired with a status enum. This approach ensures predictable state transitions and clearly represents loading, success, and failure conditions across feature screens.

Can I refactor existing Flutter state logic into flutter_bloc conventions?

Yes, you can modernize existing Flutter state logic by refactoring it into clearer bloc and cubit conventions. This process applies standardized naming, immutable state modeling, widget wiring, and bloc_test coverage to update production apps.