dsShelfJsonResponse function

Response dsShelfJsonResponse(
  1. Object data, {
  2. int statusCode = 200,
})

Wrap data in a JSON response.

Implementation

Response dsShelfJsonResponse(Object data, {int statusCode = 200}) {
  final body = data is String ? data : json.encode(data);
  return Response(
    statusCode,
    body: body,
    headers: {'content-type': 'application/json'},
  );
}