streamTo method

Future<void> streamTo(
  1. StreamSink<List<int>> sink
)

Streams the file bytes into a StreamSink.

This is useful when piping the upload into another stream destination.

Example:

final controller = StreamController<List<int>>();
await file.streamTo(controller.sink);
await controller.close();

Implementation

Future<void> streamTo(StreamSink<List<int>> sink) async {
  final bytes = await _cachedBytes;
  sink.add(bytes);
}