capture method

EventStreamSubscription<T> capture(
  1. void onData(
    1. T event
    ), {
  2. int priority = 0,
})

Adds a subscription to this stream that processes the event during the capture phase.

In contrast, the listen method processes the event during the target or bubbling phase.

On each data event from this stream, the subscriber's onData handler is called.

The priority level of the event listener can be specified. The higher the number, the higher the priority. All listeners with priority n are processed before listeners of priority n-1. If two or more listeners share the same priority, they are processed in the order in which they were added. The default priority is 0.

Implementation

EventStreamSubscription<T> capture(void Function(T event) onData,
        {int priority = 0}) =>
    _subscribe(onData, true, priority);