writeTo method

void writeTo(
  1. void sink(
    1. List<int> bytes
    )
)

Streams the ordered segments to sink (e.g. socket.add) and resets the writer. Equivalent to for (final s in takeChunks()) sink(s);.

Implementation

@pragma('vm:prefer-inline')
@pragma('dart2js:tryInline')
void writeTo(void Function(List<int> bytes) sink) {
  for (final seg in takeChunks()) {
    sink(seg);
  }
}