felangel / felangel/stream_listener

[Feature proposal] Allow value to be emitted when error occurs

Open
#2 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Dart
Stars
21
Forks
7
PR merge metrics
No merged PRs in 30d

Description

This might be helpful in certain situations, say for example when handling a firebase auth stream and you want to emit null in case there's some kind of error happening on it, since you're probably aiming to deauthenticate the current user and have him log in again.

There's two ways we could do that:
1. Have an optional function `T Function()` returning the T we want to emit in case of an error. We might name it `valueOnError`.
2. Have another `onError` optional callback `T Function(dynamic error, StackTrace stackTrace)`. This might be named `onErrorEmit` and would be mutually exclusive with the existing `onError`.

Would like to hear your thoughts @felangel :)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.