add method

StreamBuilder<T> add(
  1. T element
)

Adds an element to the stream being built.

Throws NoGuaranteeException if the builder has already been built.

Example

builder.add('Hello');
builder.add('World');

Implementation

StreamBuilder<T> add(T element) {
  if (_built) {
    throw NoGuaranteeException('StreamBuilder has already been built');
  }
  _elements.add(element);
  return this;
}