json method

FutureOr<void> json(
  1. Object data, {
  2. int? statusCode,
})

Implementation

FutureOr<void> json(
  Object data, {
  int? statusCode,
}) async {
  /// set the Response contentType to Json
  response.headers.contentType = ContentType.json;

  // / set the default status code
  response.statusCode = statusCode ?? defStatusCode;

  /// append the data to the response
  send(toJson(data));
}