bloc-patterns

Manage Flutter state with BLoC/Cubit patterns for async data and CRUD.

1|1|Updated Jun 21, 2025
One-click install
npx skills add https://github.com/AdhamHashim/Flutter_Base --skill bloc-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bloc-patterns
Source: https://github.com/AdhamHashim/Flutter_Base/tree/main/.claude/skills/bloc-patterns
Command: npx skills add https://github.com/AdhamHashim/Flutter_Base --skill bloc-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill addresses the complexity of managing state in Flutter applications, providing standardized patterns and reusable components for efficient development and maintainability.

Core Features & Use Cases

  • Standardized State Management: Implements AsyncCubit for API calls and AsyncState for managing loading, success, and error states.
  • Efficient UI Updates: Utilizes AsyncBlocBuilder and AsyncSliverBlocBuilder for seamless UI rendering based on state changes.
  • Local Data Manipulation: Enforces non-negotiable rules for local state updates after CRUD operations to prevent unnecessary data refetches.
  • Action Handling: Employs BlocListener for managing side effects like showing snackbars or navigation.
  • Pagination: Integrates PaginatedCubit and PaginatedListWidget for handling infinite scrolling lists.
  • Use Case: Develop a product listing screen where data is fetched asynchronously, with clear loading, error, and empty states, and where adding or deleting a product updates the list instantly without a full refresh.

Quick Start

Use the bloc-patterns skill to create a new cubit for fetching products that extends AsyncCubit and handles loading, success, and error states.

Frequently Asked Questions about bloc-patterns

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

FAQPage Schema
How do I manage asynchronous data fetching states in Flutter using Cubit?

Asynchronous data fetching states in Flutter are managed by extending AsyncCubit and utilizing AsyncState to explicitly handle loading, success, and error conditions. This synchronizes API calls directly with UI rendering.

What is the best way to update a Flutter list locally after a CRUD operation without refetching?

The best way to update a Flutter list locally after a CRUD operation is by applying standardized BLoC patterns that enforce non-negotiable rules for local state updates. This prevents unnecessary data refetches and updates the UI instantly.

How do I implement infinite scrolling pagination in a Flutter BLoC architecture?

Implement infinite scrolling pagination in a Flutter BLoC architecture by integrating PaginatedCubit with a PaginatedListWidget. This handles asynchronous data fetching and efficiently manages list state for infinite scroll interfaces.

Can I handle side effects like showing snackbars in Flutter using BlocListener?

Yes, you can handle side effects like showing snackbars or triggering navigation in Flutter by employing BlocListener. This separates action handling from UI rendering to manage reactions to state changes cleanly.

Does this Flutter state management approach work for both BLoC and Cubit?

Yes, this state management approach works for both BLoC and Cubit architectures in Flutter. It provides comprehensive patterns and reusable components like AsyncBlocBuilder to streamline state handling across both paradigms.