Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The function passed to Stream.handleError needs to accept either a
single argument of type
Object
, or anObject
and aStackTrace
.Since this can't be expressed by the type system, it's checked at
runtime. As a result, the
check
function (as previously written)would fail if ever instantiated with a type
T
that was narrower thanObject
.Prior to implementation of
dart-lang/language#731 (improved inference
for fold etc.), this worked fine, because type inference always
supplied an argument type of
dynamic
orObject
for the functionliterals passed to
check
. However, with the inference improvementenabled, it starts to infer other types, causing runtime failures.
The correct fix is to give the
event
argument ofonError
anappropriate type.