StreamTransformer.fromHandlers({void handleData(S data, EventSink<T> sink), void handleError(Object error, StackTrace stackTrace, EventSink<T> sink), void handleDone(EventSink<T> sink) })

Creates a StreamTransformer that delegates events to the given functions.

Example use of a duplicating transformer:

stringStream.transform(new StreamTransformer<String, String>.fromHandlers(
    handleData: (String value, EventSink<String> sink) {
      sink.add(value);
      sink.add(value);  // Duplicate the incoming events.
    }));

Source

factory StreamTransformer.fromHandlers({
    void handleData(S data, EventSink<T> sink),
    void handleError(Object error, StackTrace stackTrace, EventSink<T> sink),
    void handleDone(EventSink<T> sink)})
        = _StreamHandlerTransformer<S, T>;