ApiException.fromStatusCode constructor

ApiException.fromStatusCode(
  1. int statusCode, {
  2. String? message,
  3. Map<String, dynamic>? response,
})

Create an ApiException from HTTP status code

Implementation

factory ApiException.fromStatusCode(
  int statusCode, {
  String? message,
  Map<String, dynamic>? response,
}) {
  final defaultMessage = _getDefaultMessage(statusCode);
  return ApiException(
    message ?? defaultMessage,
    code: statusCode.toString(),
    statusCode: statusCode,
    response: response,
  );
}