isSuccessStatusCode static method
Checks if the given HTTP status code indicates a successful response.
statusCode: The HTTP status code to check.
Returns: true if the status code is in the range 200–299, otherwise false.
Implementation
static bool isSuccessStatusCode(int statusCode,
{List<int>? allowSuccessStatusCodes}) {
if (allowSuccessStatusCodes != null) {
return allowSuccessStatusCodes.contains(statusCode);
}
return statusCode >= 200 && statusCode < 300;
}