Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(single): add RxSingles.forkJoin3..forkJoin9 and RxSingles.forkJoinList #80

Merged
merged 9 commits into from
Nov 20, 2022
Merged
10 changes: 6 additions & 4 deletions lib/src/single/internal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ extension TakeFirstDataOrFirstErrorExtension<T> on Stream<T> {
controller.onListen = () {
subscription = listen(
(v) {
subscription!.cancel();
subscription = null;

controller.add(v);

// Closing also unsubscribes all subscribers, which unsubscribes
// this from source.
controller.close();
},
onError: (Object e, StackTrace s) {
subscription!.cancel();
// cancelOnError=true cause the subscription to be canceled before
// the error event is delivered to the listener.
subscription = null;

controller.addError(e, s);
Expand All @@ -35,6 +36,7 @@ extension TakeFirstDataOrFirstErrorExtension<T> on Stream<T> {
throw APIContractViolationError(
'Internal API error! Please file a bug at: https://github.com/hoc081098/rxdart_ext/issues/new');
},
cancelOnError: true,
);

if (!isBroadcast) {
Expand Down
Loading