sendText method

void sendText(
  1. String text
)

Sends a plain text response.

Implementation

void sendText(String text) {
  if (_sent) return;

  _headers.setContentType(ContentType('text', 'plain', charset: 'utf-8'));
  if (_compression) {
    _response.add(gzip.encode(_safeUtf8Encode(text)));
  } else {
    _response.add(_safeUtf8Encode(text));
  }
  _closeResponse();
}