close method

  1. @override
void close()
override

Closes the sink.

This signals the end of the chunked conversion. This method is called when converters are used as StreamTransformer's.

Implementation

@override
void close() {
  if (_closed) return;
  if (_empty) _filter.process(const [], 0, 0);
  try {
    while (true) {
      final out = _filter.processed(end: true);
      if (out == null) break;
      _sink.add(out);
    }
  } on Exception {
    _closed = true;
    _filter.close();
    rethrow;
  }
  _closed = true;
  _filter.close();
  _sink.close();
}