Future cancel( )

Cancels the stream iterator (and the underlying stream subscription) early.

The stream iterator is automatically canceled if the moveNext future completes with either false or an error.

If a moveNext call has been made, it will complete with false as value, as will all further calls to moveNext.

If you need to stop listening for values before the stream iterator is automatically closed, you must call cancel to ensure that the stream is properly closed.

Returns a future if the cancel-operation is not completed synchronously. Otherwise returns null.

Source

/**
 * Cancels the stream iterator (and the underlying stream subscription) early.
 *
 * The stream iterator is automatically canceled if the [moveNext] future
 * completes with either `false` or an error.
 *
 * If a [moveNext] call has been made, it will complete with `false` as value,
 * as will all further calls to [moveNext].
 *
 * If you need to stop listening for values before the stream iterator is
 * automatically closed, you must call [cancel] to ensure that the stream
 * is properly closed.
 *
 * Returns a future if the cancel-operation is not completed synchronously.
 * Otherwise returns `null`.
 */
Future cancel();