sendJson method

Future sendJson(
  1. dynamic message
)

Implementation

Future sendJson(message) async {
  if(message!=''){
    res?.statusCode = HttpStatus.ok;
    res?.headers.contentType = ContentType.json;
    res?.write(jsonEncode(message));
    await res!.close();
  }else{
    throw CustomException('[ Error ] Empty json data supplied!').showError();
  }
}