bloc_concurrency

Creator: coderz1093

Last updated:

0 purchases

bloc_concurrency Image
bloc_concurrency Images

Languages

Categories

Add to Cart

Description:

bloc concurrency

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]



























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';

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);
},
/// Specify a custom event transformer from `package:bloc_concurrency`
/// in this case events will be processed sequentially.
transformer: sequential(),
);
}
}
copied to clipboard
Dart Versions #

Dart 2: >= 2.12

Maintainers #

Felix Angelov

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.