Response.json constructor
Response.json({})
Create a Response with a json encoded body.
Implementation
Response.json({
int statusCode = 200,
Object? body = const <String, dynamic>{},
Map<String, Object> headers = const <String, Object>{},
}) : this(
statusCode: statusCode,
body: body != null ? jsonEncode(body) : null,
headers: {
...headers,
if (!headers.containsKey(HttpHeaders.contentTypeHeader))
HttpHeaders.contentTypeHeader: ContentType.json.value,
},
);