created static method
dynamic
created(
- dynamic id
Creates a Response for a resource creation with a Created status.
Parameters:
id: The ID of the newly created resource.
Returns:
- A
Responsewith a 201 status code and the resource ID in the body.
Implementation
static created(dynamic id) {
// Convert the data to JSON
var jsonData = jsonEncode({'id': id});
// Create a Response object with a status code of 201 (OK)
return Response(jsonData, 201,
headers: {'Content-Type': 'application/json'});
}