bloc_concurrency

0.3.0

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

Download archive

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 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(),
    );
  }
}

Dart Versions

  • Dart 2: >= 2.14

Maintainers

Changelog

0.3.0

  • chore(deps): upgrade to package:bloc v9.0.0
  • chore: update sponsors
  • chore: add funding to pubspec.yaml

0.2.5

  • docs: improve diagrams
  • chore: update copyright year
  • chore: update sponsors

0.2.4

  • chore: update sponsors

0.2.3

  • chore: fix require_trailing_commas
  • chore(deps): upgrade to package:mocktail v1.0.0
  • chore: add topics to pubspec.yaml

0.2.2

  • docs: upgrade to Dart 3
  • refactor: standardize analysis_options

0.2.1

  • chore: add screenshots to pubspec.yaml
  • refactor: upgrade to Dart 2.19
    • deps: upgrade to very_good_analysis 3.1.0
  • docs: update example to follow naming conventions

0.2.0

  • feat: upgrade to bloc: ^8.0.0

0.2.0-dev.2

  • feat: upgrade to bloc: ^8.0.0-dev.5

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 EventTransformer options:
      • 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 handlers

Installing

export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add bloc_concurrency
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.3.0
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
topics: [bloc, concurrency, state-management]
funding: [https://github.com/sponsors/felangel]

environment:
  sdk: ">=2.14.0 <4.0.0"

dependencies:
  bloc: ^9.0.0
  stream_transform: ^2.0.0

dev_dependencies:
  mocktail: ^1.0.0
  test: ^1.17.0

screenshots:
  - description: The bloc concurrency package logo.
    path: screenshots/logo.png

Version history

VersionPublishedArchiveSHA-256
0.1.0-dev.1Cached · Upstream SHA-256 matchedDownload1e7262bb…335100
0.1.0-dev.2Cached · Upstream SHA-256 matchedDownload7667846f…373492
0.1.0Cached · Upstream SHA-256 matchedDownloadb6a1bfb5…ab2151
0.2.0-dev.1Cached · Upstream SHA-256 matchedDownloada3cdd815…5ed48a
0.2.0-dev.2Cached · Upstream SHA-256 matchedDownload26c77f3a…5b8c43
0.2.0Cached · Upstream SHA-256 matchedDownload0af76bfd…4d985d
0.2.1Cached · Upstream SHA-256 matchedDownload9a94e05b…46ad3e
0.2.2Cached · Upstream SHA-256 matchedDownload44535c9f…a00d4e
0.2.3Cached · Upstream SHA-256 matchedDownloadd945b336…154d36
0.2.4Cached · Upstream SHA-256 matchedDownload5857eb66…c04679
0.2.5Cached · Upstream SHA-256 matchedDownload456b7a36…1afcd8
0.3.0Cached · Upstream SHA-256 matchedDownload86b7b17a…f53a94

Dependencies

bloc "^9.0.0"

stream_transform "^2.0.0"