bloc_concurrency
0.3.0, released 2 years ago by bloclibrary.dev
Custom event transformers for the bloc state management package.
What it does
Exposes opinionated event transformers like sequential, concurrent, droppable, and restartable for the bloc state management library. Built to work directly with bloc to control how events are processed over time.
AI-written summary of version 0.3.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to handle concurrent events sequentially in a bloc
- You want to drop or restart incoming events during an async operation in a bloc
Skip it when
- You are not using the bloc state management package
- You do not require custom concurrency control for events
Strengths
- Easy integration with the bloc package
- Provides pre-built transformers for common patterns like debouncing or restarting
Weaknesses
- Strictly tied to the bloc ecosystem
- Limited scope
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 2
import 'package:bloc/bloc.dart';
import 'package:bloc_concurrency/bloc_concurrency.dart';
sealed class CounterEvent {}
final class CounterIncrementPressed extends CounterEvent {}
class CounterBloc extends Bloc<CounterEvent, int> {
CounterBloc() : super(0) {
on<CounterIncrementPressed>(
(event, emit) async {
await Future.delayed(Duration(seconds: 1));
emit(state + 1);
},
transformer: sequential(),
);
}
}Alternatives
Packages that do the same job and could replace bloc_concurrency.
- yx_state
A state management library for Dart and Flutter applications.
82Compare - flutter_solidart
A simple state management solution for Flutter inspired by SolidJS.
75Compare - solidart
A simple State Management solution for Dart applications inspired by SolidJS
75Compare - refena
A state management and dependency injection library inspired by Riverpod and async_redux.
87Compare
Works with
Packages commonly used together with bloc_concurrency: ones it builds on, ones built on it, and its own family.
- stream_transformbloc_concurrency depends on itExtension methods adding common stream transform operators
- blocbloc_concurrency depends on itA Dart library for implementing the BLoC pattern with Cubits and Blocs.
- flutter_blocSame familyFlutter widgets to easily integrate blocs and cubits for state management.
- bloc_testSame familyA testing library that makes it easy to test blocs and cubits.
- hydrated_blocSame familyAutomatically persists and restores bloc and cubit states.
- bloc_lintSame familyOfficial lint rules for development when using the bloc state management library.
- bloc_toolsSame familyCommand-line tools for generating and linting bloc and cubit components.
- replay_blocSame familyAdds automatic undo and redo support to bloc and cubit states.