StreamSinkTransformer<S, T>.fromHandlers constructor

StreamSinkTransformer<S, T>.fromHandlers({
  1. void handleData(
    1. S,
    2. EventSink<T>
    )?,
  2. void handleError(
    1. Object,
    2. StackTrace,
    3. EventSink<T>
    )?,
  3. void handleDone(
    1. EventSink<T>
    )?,
})

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 Function(S, EventSink<T>)? handleData,
    void Function(Object, StackTrace, EventSink<T>)? handleError,
    void Function(EventSink<T>)? handleDone}) {
  return HandlerTransformer<S, T>(handleData, handleError, handleDone);
}