Skip to content

Please, clarify description of Stream.any() #29540

Open
@alsemenov

Description

@alsemenov

The description of method dart:async:Stream.any() reads:

Future any(
bool test(
T element
)
)
Checks whether test accepts any element provided by this stream.

Completes the Future when the answer is known.

If this stream reports an error, the Future reports that error.

Stops listening to the stream after the first matching element has been found.

Internally the method cancels its subscription after this element. This means that single-subscription (non-broadcast) streams are closed and cannot be reused after a call to this method.

Please, clarify:

  1. The value used to complete the returned Future instance. (Is it true if element is found and false otherwise?)
  2. If test throws error (Is the error used to complete the returned future with error?
  3. If stream is done and no value was found. (Is the returned future completed with false?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.core-atype-documentationA request to add or improve documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions