Refactor to avoid `.cast<S>()` (dart-lang/stream_transform#105) Keeps us at a single type check with `event is S`.