close method

  1. @override
Future close()
override

Prevents more data from being written to the response, and locks it entire from further editing.

Implementation

@override
Future close() async {
  if (!_isDetached && !_isClosed && !isBuffered) {
    // Finalizer failures propagate, leaving the response open for the
    // error handler.
    await _commitOrThrow();
    _openStream();
    _flushQueued();
    // Flushes the compression trailer, if any.
    _encoderSink?.close();
    await stream.outgoingMessages.close();
  }

  _isClosed = true;
  await super.close();
}