cast<S> method Null safety

StreamChannel<S> cast<S>()

Returns a copy of this with the generic type coerced to S.

If any events emitted by stream aren't of type S, they're converted into TypeError events (CastError on some SDK versions). Similarly, if any events are added to sink that aren't of type S, a TypeError is thrown.

Implementation

StreamChannel<S> cast<S>();