typed<T> method Null safety

  1. @Deprecated('Use stream.cast instead')
Stream<T> typed<T>(
  1. Stream stream
)
Deprecated('Use stream.cast instead')">@Deprecated('Use stream.cast instead')

Creates a wrapper which throws if stream's events aren't instances of T.

This soundly converts a Stream to a Stream<T>, regardless of its original generic type, by asserting that its events are instances of T whenever they're provided. If they're not, the stream throws a TypeError.

Implementation

@Deprecated('Use stream.cast instead')
static Stream<T> typed<T>(Stream stream) => stream.cast();