jsonResponse method

Response jsonResponse(
  1. String body, {
  2. int statusCode = 200,
  3. Map<String, String> additionalHeaders = const {},
})

Creates a JSON response with proper headers.

Implementation

Response jsonResponse(
  String body, {
  int statusCode = 200,
  Map<String, String> additionalHeaders = const {},
}) {
  return Response(
    statusCode,
    body: body,
    headers: {
      'content-type': 'application/json; charset=utf-8',
      ...additionalHeaders,
    },
  );
}