add method

  1. @override
void add (T event)

Sends a data event.

Listeners receive this event in a later microtask.

Note that a synchronous controller (created by passing true to the sync parameter of the StreamController constructor) delivers events immediately. Since this behavior violates the contract mentioned here, synchronous controllers should only be used as described in the documentation to ensure that the delivered events always appear as if they were delivered in a separate microtask.

Implementation

@override
void add(T event) {
  if (_isAddingStreamItems) {
    throw StateError(
        "You cannot add items while items are being added from addStream");
  }

  _add(event);
}