close method

  1. @override
void close()
override

Closes the sink.

The add method must not be called after this method.

Calling this method more than once is allowed, but does nothing.

Implementation

@override
void close() {
  if (_closed) {
    return;
  }
  _closed = true;
  _decoder.closeInput();
  final status = _pump();
  if (status == BrotliStatus.needMoreInput) {
    throw StateError(
      'BrotliDecoder requested input after the stream was closed',
    );
  }
  if (!_done) {
    throw StateError('BrotliDecoder did not finish after closeInput');
  }
  _sink.close();
}