Skip to content

Commit 62af370

Browse files
authored
Fix type check and cast in onError
1 parent 3b35aca commit 62af370

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pkgs/async/lib/src/subscription_stream.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ class _CancelOnErrorSubscriptionWrapper<T>
7676
super.onError((Object error, StackTrace stackTrace) {
7777
// Wait for the cancel to complete before sending the error event.
7878
super.cancel().whenComplete(() {
79-
if (handleError is ZoneBinaryCallback) {
80-
handleError(error, stackTrace);
81-
} else if (handleError != null) {
82-
(handleError as ZoneUnaryCallback)(error);
79+
if (handleError is ZoneBinaryCallback<void, Object, StackTrace> || handleError is ZoneBinaryCallback) {
80+
handleError?.call(error, stackTrace);
81+
} else if (handleError is ZoneUnaryCallback<void, Object> || handleError is ZoneUnaryCallback) {
82+
handleError?.call(error);
8383
}
8484
});
8585
});

0 commit comments

Comments
 (0)