StatusCodeConfig class
Configurable status code mapping that frontend devs can customize
Constructors
-
StatusCodeConfig({Set<
int> successCodes = const {200, 201, 202, 204}, Set<int> errorCodes = const {400, 401, 402, 403, 404, 405, 408, 409, 410, 422, 429, 500, 501, 502, 503, 504}, Set<int> redirectCodes = const {301, 302, 303, 304, 307, 308}, Set<int> clientErrorCodes = const {400, 401, 402, 403, 404, 405, 408, 409, 410, 422, 429}, Set<int> serverErrorCodes = const {500, 501, 502, 503, 504}}) -
Default configuration following standard HTTP
const
-
StatusCodeConfig.custom({required Set<
int> successCodes, required Set<int> errorCodes, required Set<int> redirectCodes, required Set<int> clientErrorCodes, required Set<int> serverErrorCodes}) -
Create custom configuration based on API documentation
const
-
StatusCodeConfig.forApi({bool uses200ForErrors = false, Set<
int> ? customSuccessCodes, Set<int> ? customRedirectCodes}) -
Factory for common API patterns
factory
Properties
-
clientErrorCodes
→ Set<
int> -
final
-
errorCodes
→ Set<
int> -
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
redirectCodes
→ Set<
int> -
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
serverErrorCodes
→ Set<
int> -
final
-
successCodes
→ Set<
int> -
final
Methods
-
copyWith(
{Set< int> ? successCodes, Set<int> ? errorCodes, Set<int> ? redirectCodes, Set<int> ? clientErrorCodes, Set<int> ? serverErrorCodes}) → StatusCodeConfig -
getCategory(
int statusCode) → String -
isClientError(
int statusCode) → bool -
isError(
int statusCode) → bool -
isRedirect(
int statusCode) → bool -
isServerError(
int statusCode) → bool -
isSuccess(
int statusCode) → bool - Helper methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited