cancel method Null safety

Future<void> cancel()

Cancel the underlying chunked stream.

If a future from readChunk or readStream is still pending then cancel behaves as if the underlying stream ended early. That is a future from readChunk may return a partial chunk smaller than the request size.

It is always safe to call cancel, even if the underlying stream was read to completion.

It can be a good idea to call cancel in a finally-block when done using the ChunkedStreamReader, this mitigates risk of leaking resources.


Future<void> cancel() async => await _input.cancel();