json method
Implementation
HttpResponse json(Object? data, {int statusCode = HttpStatus.ok}) {
response.statusCode = statusCode;
response.headers.contentType = ContentType.json;
response.write(data); // you can wrap with jsonEncode if needed
return response;
}