Skip to content
pubscout

bloc_concurrency

0.3.0, released 2 years ago by bloclibrary.dev

Custom event transformers for the bloc state management package.

WASM-readyQuiet but busy
$ flutter pub add bloc_concurrency
Source repository

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.

  • flutter_solidart

    A simple state management solution for Flutter inspired by SolidJS.

  • solidart

    A simple State Management solution for Dart applications inspired by SolidJS

  • refena

    A state management and dependency injection library inspired by Riverpod and async_redux.

Works with

Packages commonly used together with bloc_concurrency: ones it builds on, ones built on it, and its own family.