StreamSupport class

Low-level utility methods for creating and manipulating streams.

This class is primarily intended for library writers presenting stream views of data structures; most static stream methods intended for end users are in the various stream classes.

Example Usage

// Create a stream from an iterable
final stream = StreamSupport.stream(someIterable);

// Create a parallel stream
final parallelStream = StreamSupport.stream(someIterable, parallel: true);

// Create streams from various sources
final intStream = StreamSupport.intStream([1, 2, 3, 4, 5]);
final doubleStream = StreamSupport.doubleStream([1.1, 2.2, 3.3]);

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

builder<T>() StreamBuilder<T>
Returns a builder for a GenericStream.
concat<T>(GenericStream<T> a, GenericStream<T> b) GenericStream<T>
Creates a lazily concatenated stream whose elements are all the elements of the first stream followed by all the elements of the second stream.
doubleStream(Iterable<double> source, {bool parallel = false}) DoubleStream
Creates a new sequential or parallel DoubleStream from an Iterable of doubles.
empty<T>() GenericStream<T>
Creates an empty GenericStream.
emptyDoubleStream() DoubleStream
Creates an empty DoubleStream.
emptyIntStream() IntStream
Creates an empty IntStream.
generate<T>(T supplier()) GenericStream<T>
Creates an infinite sequential unordered stream where each element is generated by the provided supplier function.
intStream(Iterable<int> source, {bool parallel = false}) IntStream
Creates a new sequential or parallel IntStream from an Iterable of integers.
iterate<T>(T seed, T f(T)) GenericStream<T>
Creates an infinite sequential ordered stream produced by iterative application of a function to an initial element.
of<T>(T first, [T? second, T? third, T? fourth, T? fifth]) GenericStream<T>
Creates a stream whose elements are the specified values.
ofAll<T>(List<T> values) GenericStream<T>
Creates a stream from a variable number of arguments.
ofSingle<T>(T value) GenericStream<T>
Creates a GenericStream containing a single element.
stream<T>(Iterable<T> source, {bool parallel = false}) GenericStream<T>
Creates a new sequential or parallel GenericStream from an Iterable.