text static method
Implementation
static Response text(String s,
{int status = 200, Headers? headers, Encoding encoding = utf8}) {
final h = headers ?? Headers();
if (!h.has('content-type')) {
// The usual one written once rather than put together per response.
h.set(
'content-type',
identical(encoding, utf8)
? 'text/plain; charset=utf-8'
: 'text/plain; charset=${encoding.name}');
}
final data = encoding.encode(s);
return Response.bytes(
status, data is Uint8List ? data : Uint8List.fromList(data),
headers: h);
}