json static method
Implementation
static Response json(Object? data, {int status = 200, Headers? headers}) {
final h = headers ?? Headers();
if (!h.has('content-type')) {
h.set('content-type', 'application/json; charset=utf-8');
}
final payload = Uint8List.fromList(utf8.encode(jsonEncode(data)));
return Response(status, headers: h, body: Stream<List<int>>.value(payload));
}