Response.bytes constructor

Response.bytes(
  1. int status,
  2. Uint8List bytes, {
  3. Headers? headers,
})

A response whose body is bytes, already in memory.

The same response as one built with body: Stream.value(bytes), except that bufferedBytes hands the bytes over directly, so a server sends them as one copy rather than listening to a stream for them.

Implementation

Response.bytes(this.status, Uint8List bytes, {Headers? headers})
    : headers = headers ?? Headers(),
      _stream = null,
      _whole = bytes,
      isStream = false;