send method
Implementation
void send(HttpResponse response) {
response.statusCode = statusCode;
response.headers.set(HttpHeaders.contentTypeHeader, contentType);
headers.forEach((key, value) => response.headers.set(key, value));
final responseData =
contentType == 'application/json' ? toJson() : data.toString();
if (responseData.isNotEmpty) {
response.write(responseData);
}
response.close();
}