felangel / felangel/bloc

feat: Add emitForEach / emitOnEach Methods (or something similar) to Cubit

Open
#3,555 12 comments 20 reactions 1 assignee Claimed by @felangel View on GitHub
enhancement feedback wanted pkg:bloc
Dominant language
Dart
Stars
12.5k
Forks
3.4k
PR merge metrics
No merged PRs in 30d

Description

**Description**

When working with a `Cubit` that consume some other `Stream` you need to maintain a `StreamSubscription` during the life of the `Cubit` and close it etc. This comes with some extra work which is handled well in `Bloc` via `emit.forEach` / `emit.onEach` but no similar solution exists for that when using `Cubit`.

**Desired Solution**

Adding the methods `emitForEach` and `emitOnEach` with same signatures and functionality as their counter part in `Emitter`.

**Alternatives Considered**

Maybe give a `Cubit` its own `Emitter`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.