# builder<T> static method

StreamBuilder<T> builder<T>()

Returns a builder for a GenericStream.

## Example

    final stream = StreamSupport.builder<String>()
        .add('Hello')
        .add('World')
        .build();

A mutable builder for a GenericStream.

This allows the creation of a GenericStream by generating elements individually and adding them to the builder (without the copying overhead that comes from using a List as a temporary buffer.)

A stream builder has a lifecycle, which starts in a building phase, during which elements can be added, and then transitions to a built phase, after which no more elements can be added. The built phase begins begins when the `build` method is called, which creates an ordered GenericStream whose elements are the elements that were added to the stream builder, in the order they were added.

## Example Usage

    final builder = StreamBuilder<String>();
    builder.add('Hello');
    builder.add('World');
    final stream = builder.build();
    print(stream.toList()); // ['Hello', 'World']

## Implementation

    static StreamBuilder<T> builder<T>() {
      return StreamBuilder<T>();
    }