Response.json constructor

Response.json(
  1. dynamic data, {
  2. int status = 200,
})

Creates a JSON response with the provided data and status code.

Implementation

Response.json(dynamic data, {int status = 200})
    : statusCode = status,
      body = jsonEncode(data),
      headers = _CaseInsensitiveMap({'content-type': 'application/json'}),
      _cookies = [];