resolve static method

HttpStatus? resolve(
  1. int statusCode
)

Resolve the given status code to an {status-code: HttpStatus}, if possible. @param statusCode the HTTP status code (potentially non-standard) @return the corresponding {status-code: HttpStatus}, or {status-code: null} if not found @since 0.0.1.beta

Implementation

static HttpStatus? resolve(int statusCode) {
  // Use cached VALUES instead of values() to prevent array allocation.
  return values.firstWhereOrNull(
    (element) => element.value == statusCode,
  );
}