on method

void on(
  1. void onData(
    1. T data
    )?, {
  2. void onError(
    1. Object error, [
    2. StackTrace? stackTrace
    ])?,
  3. void onDone()?,
})

Attaches the provided handlers to the stream subscription.

Implementation

void on(
  void Function(T data)? onData, {
  void Function(Object error, [StackTrace? stackTrace])? onError,
  void Function()? onDone,
}) {
  streamSubscription
    ..onData(onData)
    ..onError(onError)
    ..onDone(onDone);
}