flutter-bloc

Implements BLoC and Cubit state management patterns in Flutter applications.

5|Updated Oct 14, 2025
One-click install
npx skills add https://github.com/reloveution/dart-flutter-rules --skill flutter-bloc
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: flutter-bloc
Source: https://github.com/reloveution/dart-flutter-rules/tree/main/skills/flutter-bloc
Command: npx skills add https://github.com/reloveution/dart-flutter-rules --skill flutter-bloc

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides comprehensive guidance and rules for implementing the BLoC (Business Logic Component) and Cubit patterns in Flutter applications, ensuring predictable state management, clean architecture, and robust testing.

Core Features & Use Cases

  • State Management Best Practices: Covers naming conventions for events and states, effective state modeling (Equatable, immutable, sealed classes), and the distinction between Cubit and Bloc.
  • Widget Integration: Explains how to use widgets like BlocBuilder, BlocListener, and BlocProvider for UI updates and dependency injection.
  • Architecture & Testing: Details how to structure your application by injecting dependencies into blocs and provides examples for unit testing state transitions using bloc_test.
  • Use Case: Ensure all your Flutter state management follows the official BLoC/Cubit guidelines, from initial setup to advanced testing and ecosystem integration.

Quick Start

Use the flutter-bloc skill to generate a new Cubit for managing user authentication state.

Frequently Asked Questions about flutter-bloc

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

FAQPage Schema
What is the best way to structure Flutter BLoC state management for clean architecture?

The best way to structure Flutter BLoC state management is by using immutable state classes, clear event naming conventions, and dependency injection to separate business logic from the UI layer.

How do I write unit tests for Flutter Cubit state transitions?

You write unit tests for Flutter Cubit state transitions using the bloc_test package, which allows you to assert that specific events trigger the expected sequence of state changes in your application.

When should I use Cubit instead of Bloc in Flutter applications?

You should use Cubit instead of Bloc in Flutter applications when you need simpler state management without the overhead of event classes, relying directly on method calls to emit new states.

How do I integrate BlocBuilder and BlocProvider for predictable UI updates in Flutter?

You integrate BlocBuilder and BlocProvider in Flutter to inject business logic components into the widget tree and rebuild specific child widgets predictably whenever the emitted state changes.

Does Flutter BLoC testing require sealed classes and Equatable for state modeling?

Flutter BLoC testing benefits from using Equatable and sealed classes for state modeling because they ensure value equality and exhaustive state coverage, making state transitions predictable and testable.