sendCreatedResult static method
Creates a function that sends newly created object as JSON. That callack function call be called directly or passed as a parameter to business logic components.
If object is not null it returns 201 status code. For null results it returns 204 status code. If error occur it sends ErrorDescription with approproate status code.
req
a HTTP request object.result
a result object.
Implementation
static FutureOr<Response> sendCreatedResult(Request req, result) {
if (result == null) {
return Response(204);
} else {
return Response(201, body: json.encode(result));
}
}