Bloc is a Dart library that implements the BLoC pattern to separate presentation from business logic. Companion packages extend it to Flutter, AngularDart, testing, persistence, and concurrency control.
Overview
Bloc is a state management library for Dart that helps implement the BLoC design pattern. Its purpose is to make presentation logic easy to test and reuse by routing UI events through clearly defined components that emit states over time.
The core bloc package can be used in pure Dart programs, while flutter_bloc connects the pattern to Flutter widgets. Related packages add hydrated persistence, replay of past states, lint rules, testing utilities, tooling, and transformers for concurrent event handling.
Official documentation and tutorials cover architecture, naming conventions, testing practices, and FAQs. Editor integrations exist for VS Code, IntelliJ, and Neovim, and Mason templates can scaffold bloc-based projects.
Sample applications demonstrate counters, forms, authentication flows, infinite lists, weather and search apps, timers, wizards, and shared code between Flutter and AngularDart web clients.
Key features
- BLoC pattern for Dart
- Flutter integration package
- AngularDart bloc package
- Bloc concurrency transformers
- Hydrated and replay persistence
- Bloc test and lint tooling
- Official tutorials and examples
- Editor and Mason integrations
Use cases
- Flutter app state management
- Testable business logic layers
- Form validation flows
- Async list and login UIs
- AngularDart web applications