Skip to content

Stream.pipe should return a Future<void> #44510

Open
@srawlins

Description

@srawlins

The implementation for Stream.pipe is:

Future pipe(StreamConsumer<T> streamConsumer) {
  return streamConsumer.addStream(this).then((_) => streamConsumer.close());
}

Shouldn't this method return Future<void> rather than Future<dynamic>? My motivation is for #35825, where I'm catching code like:

myStream
  .pipe(something)
  .catchError((e) => print(e));

So Future<dynamic>.catchError's onError handler should return FutureOr<dynamic>, and returning void from the handler would be an error.

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.library-async

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions