StreamSinkTransformer<S, T>.fromHandlers constructor

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

Creates a StreamSinkTransformer that delegates events to the given handlers.

The handlers work exactly as they do for StreamTransformer.fromHandlers. They're called for each incoming event, and any actions on the sink they're passed are forwarded to the inner sink. If a handler is omitted, the event is passed through unaltered.

Implementation

factory StreamSinkTransformer.fromHandlers(
    {void handleData(S data, EventSink<T> sink),
    void handleError(Object error, StackTrace stackTrace, EventSink<T> sink),
    void handleDone(EventSink<T> sink)}) {
  return new HandlerTransformer<S, T>(handleData, handleError, handleDone);
}