W3cubDocs

/Dart 2

castFrom<SS, ST, TS, TT> method

StreamTransformer<TS, TT> castFrom <SS, ST, TS, TT>(StreamTransformer<SS, ST> source)

Adapts source to be a StreamTransformer<TS, TT>.

This allows source to be used at the new type, but at run-time it must satisfy the requirements of both the new type and its original type.

Data events passed into the returned transformer must also be instances of SS, and data events produced by source for those events must also be instances of TT.

Implementation

static StreamTransformer<TS, TT> castFrom<SS, ST, TS, TT>(
    StreamTransformer<SS, ST> source) {
  return new CastStreamTransformer<SS, ST, TS, TT>(source);
}

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.5.0/dart-async/StreamTransformer/castFrom.html