Skip to content

Instantly share code, notes, and snippets.

@cdmunoz
Created July 24, 2023 01:20
Show Gist options
  • Save cdmunoz/92b1be345505544541660f4e329b4e63 to your computer and use it in GitHub Desktop.
Save cdmunoz/92b1be345505544541660f4e329b4e63 to your computer and use it in GitHub Desktop.
Response<T> buildFailureResponse<T>(
String message, {
int code = 400,
http.BaseRequest? request,
}) {
final body = jsonDecode(message) as Map<String, dynamic>;
final error = buildBackendError(statusCode: code, body: body);
return Response(
http.Response(message, code, request: request),
null,
error: error,
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment