p-hatan/ mirror

pub repository

mirror.p-hatan.com

bloc_concurrency

0.3.0

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

Cached in Iran · upstream_checksum

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.com
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.12021-09-02T21:52:46.198828ZCached1e7262bb3496c55fd6a739ccec7e0c64e3157efa94de26a5e5b93f185b335100
0.1.0-dev.22021-09-09T22:54:14.519887ZCached7667846fe3430344e921159f86ab1d7336007130592f7324ae6f8310b4373492
0.1.02021-09-21T16:37:51.995992ZCachedb6a1bfb518d20cc3fa5c4b7837c337071c45ec07c8901acee3d8781860ab2151
0.2.0-dev.12021-10-15T01:50:01.734571ZCacheda3cdd815239e706f543446259cd30371d5dd354bb67bcd14f78f938aa95ed48a
0.2.0-dev.22021-11-14T23:08:16.718978ZCached26c77f3af30fe82ea30b2b5eb4cf3a76bf6508c820cc8da46a9500d9595b8c43
0.2.02021-11-18T15:57:10.639510ZCached0af76bfdbdcf21d897c743bb376fbe0d356e2b9e76dc787397077391074d985d
0.2.12023-02-05T20:39:28.626852ZCached9a94e05be7754ec9cfc6e7a68b340be63381a54cadabee25ec3296838646ad3e
0.2.22023-05-20T19:51:41.764178ZCached44535c9f429cd7e91d548cf89fde1c23a8b4b3637decdb1865bb583091a00d4e
0.2.32023-12-17T22:51:02.961850ZCachedd945b33641a3c3f12fa12a1437e77f784444dd9a3a66a3a4f5aaa6e049154d36
0.2.42024-02-12T05:59:21.544564ZCached5857eb6653b4dd5e30e1ffab91037957fd64a9b9c5e53d26714ef25a46c04679
0.2.52024-03-24T20:08:44.479987ZCached456b7a3616a7c1ceb975c14441b3f198bf57d81cb95b7c6de5cb0c60201afcd8
0.3.02025-01-12T21:00:54.768818ZCached86b7b17a0a78f77fca0d7c030632b59b593b22acea2d96972588f40d4ef53a94

Dependencies

bloc "^9.0.0"

stream_transform "^2.0.0"