NumStatusCodeMapExtension<T extends num> extension
Extension on num?
types to provide additional immutable functionality when
working with HTTP status codes.
- on
-
- T?
Methods
-
mapToRegisteredStatusCode<
R> ({required R isInformational(StatusCode? informationalStatusCode), required R isSuccess(StatusCode? successStatusCode), required R isRedirection(StatusCode? redirectionStatusCode), required R isClientError(StatusCode? clientErrorStatusCode), required R isServerError(StatusCode? serverErrorStatusCode)}) → R - Maps the value to a new value based on its classification as an HTTP status code.
-
maybeMapToRegisteredStatusCode<
R> ({required R orElse(StatusCode? elseStatusCode, T? number), R isStatusCode(StatusCode? statusCode)?, R isInformational(StatusCode? informationalStatusCode)?, R isSuccess(StatusCode? successStatusCode)?, R isRedirection(StatusCode? redirectionStatusCode)?, R isClientError(StatusCode? clientErrorStatusCode)?, R isServerError(StatusCode? serverErrorStatusCode)?}) → R -
If the
num?
value is a valid HTTP status code, maps it to a result using the provided functions. If the value is not a valid HTTP status code, returns the result of callingorElse
.