bloc_concurrency 0.2.0-dev.2 copy "bloc_concurrency: ^0.2.0-dev.2" to clipboard
bloc_concurrency: ^0.2.0-dev.2 copied to clipboard

outdated

Custom event transformers inspired by ember concurrency. Built to be used with the bloc state management package.

Bloc Concurrency

Pub build codecov Star on Github style: effective dart Flutter Website Awesome Flutter Flutter Samples License: MIT Discord Bloc Library


A Dart package that exposes custom event transformers inspired by ember concurrency. Built to work with bloc.

Learn more at bloclibrary.dev!


Sponsors #

Our top sponsors are shown below! [Become a Sponsor]


Try the Flutter Chat Tutorial  💬

Event Transformers #

Event Transformers

bloc_concurrency provides an opinionated set of event transformers:

  • concurrent - process events concurrently
  • sequential - process events sequentially
  • droppable - ignore any events added while an event is processing
  • restartable - process only the latest event and cancel previous event handlers

Usage #

import 'package:bloc/bloc.dart';
import 'package:bloc_concurrency/bloc_concurrency.dart';

abstract class CounterEvent {}

class Increment extends CounterEvent {}

class CounterBloc extends Bloc<CounterEvent, int> {
  CounterBloc() : super(0) {
    on<Increment>(
      (event, emit) async {
        await Future.delayed(Duration(seconds: 1));
        emit(state + 1);
      },
      /// Specify a custom event transformer from `package:bloc_concurrency`
      /// in this case events will be processed sequentially.
      transformer: sequential(),
    );
  }
}

Dart Versions #

  • Dart 2: >= 2.12

Maintainers #

432
likes
0
pub points
99%
popularity

Publisher

verified publisherbloclibrary.dev

Custom event transformers inspired by ember concurrency. Built to be used with the bloc state management package.

Homepage
Repository (GitHub)
View/report issues

Documentation

Documentation

License

unknown (LICENSE)

Dependencies

bloc, stream_transform

More

Packages that depend on bloc_concurrency