typed<S, T> method Null safety

  1. @Deprecated("Will be removed in future version")
StreamSinkTransformer<S, T> typed<S, T>(
  1. StreamSinkTransformer transformer
)
Deprecated("Will be removed in future version")">@Deprecated("Will be removed in future version")

Creates a wrapper that coerces the type of transformer.

This soundly converts a StreamSinkTransformer to a StreamSinkTransformer<S, T>, regardless of its original generic type. This means that calls to StreamSink.add on the returned sink may throw a TypeError if the argument type doesn't match the reified type of the sink.

Implementation

@Deprecated("Will be removed in future version")
// TODO remove TypeSafeStreamSinkTransformer
static StreamSinkTransformer<S, T> typed<S, T>(
        StreamSinkTransformer transformer) =>
    transformer is StreamSinkTransformer<S, T>
        ? transformer
        : TypeSafeStreamSinkTransformer(transformer);