Handle `null` returns from cancelled subscriptions (dart-lang/stream_transform#97)

A call to `StreamSubscription.cancel` is allowed to return `null`,
though it never does using the `StreamController` from the SDK. If a
custom Stream implementation does synchronously cancel and return `null`
it could cause problems in a number of transformers which would attempt
to `Future.wait` on the results of the cancels.

- Update the places using `Future.wait` to filter out null results
  first.
- Refactor some places to use collection literals and conditional
  elements.
- Filter out nulls first, and if every canceled subscription was
  synchronous skip the call to `Future.wait` entirely.
- Add a custom Stream implementation which always returns `null` when
  it's subscription is canceled as a test utility.
- Add tests that would fail without the null filtering on each
  implementation that was updated.
14 files changed
tree: 4a2e27b39564ed3b484e098185c9d3c348fb859f
  1. pkgs/