felangel / felangel/stream_listener
[Feature proposal] Allow value to be emitted when error occurs
- 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.