Skip to content

Instantly share code, notes, and snippets.

@cdmunoz
Created July 24, 2023 01:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cdmunoz/b9c4b3f24f42e23b33092fd4a232e866 to your computer and use it in GitHub Desktop.
Save cdmunoz/b9c4b3f24f42e23b33092fd4a232e866 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