ok static method
dynamic
ok(
- dynamic data
Creates a Response for a successful request with an OK status.
Parameters:
data: The data to include in the response body.
Returns:
- A
Responsewith a 200 status code and the provided data.
Implementation
static ok(dynamic data) {
// Convert the data to JSON
var jsonData = jsonEncode(data);
// Create a Response object with a status code of 200 (OK)
return Response(jsonData, 200,
headers: {'Content-Type': 'application/json'});
}