07675de0c0
The constructor was wrapping the onData handler to hide the type-mismatch. This copies the same logic to the onData handler. In non-nnbd code this code was not exercised. The migration of dart:async made this code reachable on our tests. That's because Stream.first used to do: var subscription; this.listen(() => ... cancel subscription here, ...) it now avoids making subscription nullable by registering the onData handler later: var subscrition = stream.listen(null, ...); subscription.onData(() => ... cancel subscription here); This change fixes the following 6 html tests under nnbd: html/history_test/history/history html/transferables_test html/transition_event_test html/websocket_test html/worker_test/functional/functional html/xhr_test Change-Id: I095ea8d545e65b047504af0367586884bba84d72 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134120 Commit-Queue: Sigmund Cherem <sigmund@google.com> Reviewed-by: Srujan Gaddam <srujzs@google.com>