Viewing version 0.2.0-dev.1. Open the latest package page.
bloc_concurrency
0.2.0-dev.1Custom event transformers inspired by ember concurrency. Built to be used with the bloc state management package.
Readme
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
Event Transformers
bloc_concurrency provides an opinionated set of event transformers:
concurrent- process events concurrentlysequential- process events sequentiallydroppable- ignore any events added while an event is processingrestartable- 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
Changelog
0.2.0-dev.1
- feat: upgrade to
bloc: ^8.0.0-dev.3
0.1.0
- feat: upgrade to
bloc: ^7.2.0
0.1.0-dev.2
- feat: upgrade to
bloc: ^7.2.0-dev.2
0.1.0-dev.1
- feat: initial development release
- includes
EventTransformeroptions:concurrent: process events concurrentlysequential: process events sequentiallydroppable: ignore any events added while an event is processingrestartable: process only the latest event and cancel previous handlers
- includes
Installing
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add 'bloc_concurrency:0.2.0-dev.1'pubspec.yaml
name: bloc_concurrency
description: Custom event transformers inspired by ember concurrency. Built to be used with the bloc state management package.
version: 0.2.0-dev.1
repository: https://github.com/felangel/bloc/tree/master/packages/bloc_concurrency
issue_tracker: https://github.com/felangel/bloc/issues
homepage: https://github.com/felangel/bloc
documentation: https://bloclibrary.dev
environment:
sdk: ">=2.12.0 <3.0.0"
dependencies:
bloc: ^8.0.0-dev.3
stream_transform: ^2.0.0
dev_dependencies:
mocktail: ^0.2.0
test: ^1.17.0
very_good_analysis: ^2.3.0
Version history
| Version | Published | Archive | SHA-256 |
|---|---|---|---|
| 0.1.0-dev.1 | Cached · Upstream SHA-256 matched | Download | 1e7262bb…335100 |
| 0.1.0-dev.2 | Cached · Upstream SHA-256 matched | Download | 7667846f…373492 |
| 0.1.0 | Cached · Upstream SHA-256 matched | Download | b6a1bfb5…ab2151 |
| 0.2.0-dev.1 | Cached · Upstream SHA-256 matched | Download | a3cdd815…5ed48a |
| 0.2.0-dev.2 | Cached · Upstream SHA-256 matched | Download | 26c77f3a…5b8c43 |
| 0.2.0 | Cached · Upstream SHA-256 matched | Download | 0af76bfd…4d985d |
| 0.2.1 | Cached · Upstream SHA-256 matched | Download | 9a94e05b…46ad3e |
| 0.2.2 | Cached · Upstream SHA-256 matched | Download | 44535c9f…a00d4e |
| 0.2.3 | Cached · Upstream SHA-256 matched | Download | d945b336…154d36 |
| 0.2.4 | Cached · Upstream SHA-256 matched | Download | 5857eb66…c04679 |
| 0.2.5 | Cached · Upstream SHA-256 matched | Download | 456b7a36…1afcd8 |
| 0.3.0 | Cached · Upstream SHA-256 matched | Download | 86b7b17a…f53a94 |
Dependencies
bloc "^8.0.0-dev.3"
stream_transform "^2.0.0"