LibraryActive

Bloc

A Dart library for predictable state management, with testing utilities via bloc_test.

Open source page ↗

Product features

Product features

Bloc

A more advanced state management class with event-driven state changes.

BlocListener

Widget to listen to bloc state changes and trigger events in other blocs.

BLoC Pattern

Implements the Business Logic Component pattern for state management.

BlocProvider

Provides blocs to the widget tree.

bloc_test

Provides blocTest function for testing bloc state emissions.

Core Dart APIs

Provides Bloc, Cubit, and related classes for state management.

Cubit

A simple state management class that extends BlocBase.

Equatable Support

Bloc works with Equatable to optimize state comparison and reduce rebuilds.

Error Handling

Bloc provides patterns for handling errors while retaining previous data.

Event Naming Convention

Events should be named in past tense, e.g., CounterStarted, CounterIncrementPressed.

Flutter Widgets

Provides Flutter widgets for Bloc integration.

Layered Architecture

Separates presentation, business logic, and data layers.

Migration Guide

Detailed migration guide for versions 5.0.0 to 11.0.0.

Powerful

Helps make amazing, complex applications by composing them of smaller components.

Simple

Easy to understand and can be used by developers with varying skill levels.

State Naming Convention

States should be nouns, with subclasses like CounterInitial, CounterLoadSuccess, or single class with status enum.

Testable

Easily test every aspect of an application so that we can iterate with confidence.

Unit Testing

Supports unit testing of blocs using test and bloc_test packages.