ServerResponse.text constructor

ServerResponse.text(
  1. String text, {
  2. int status = 200,
  3. String contentType = 'text/plain; charset=utf-8',
  4. Headers? headers,
})

Creates a plain-text response.

Implementation

factory ServerResponse.text(
  String text, {
  int status = 200,
  String contentType = 'text/plain; charset=utf-8',
  Headers? headers,
}) => ServerResponse.bytes(
  utf8.encode(text),
  status: status,
  contentType: contentType,
  headers: headers,
);