listen abstract method

StreamSubscription<T> listen(
  1. void onData(
    1. T data
    )?, {
  2. void onDone()?,
})

Adds a subscription to this stream.

Returns a StreamSubscription which handles events from this stream using the provided onData and onDone handlers. The handlers can be changed on the subscription, but they start out as the provided functions.

Implementation

StreamSubscription<T> listen(void Function(T data)? onData, {void Function()? onDone});