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() {
  if (!_isDetached) {
    if (!_isClosed) {
      if (!isBuffered) {
        try {
          _openStream();
          rawResponse.close();
        } catch (_) {
          // This only seems to occur on `MockHttpRequest`, but
          // this try/catch prevents a crash.
        }
      } else {
        _buffer!.lock();
      }

      _isClosed = true;
    }

    super.close();
  }
  return Future.value();
}