ok static method

dynamic ok(
  1. 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 Response with 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'});
}