HttpStatus class

Each HttpStatusCode is described below, including a description of which method(s) it can follow and any metainformation required in the response.

  • Informational 1xx

    This class of status code indicates a provisional response, consisting only of the Status-Line and optional headers, and is terminated by an empty line. There are no required headers for this class of status code. Since HTTP/1.0 did not define any 1xx status codes, servers MUST NOT send a 1xx response to an HTTP/1.0 client except under experimental conditions.

    A client MUST be prepared to accept one or more 1xx status responses prior to a regular response, even if the client does not expect a 100 (Continue) status message. Unexpected 1xx status responses MAY be ignored by a user agent.

    Proxies MUST forward 1xx responses, unless the connection between the proxy and its client has been closed, or unless the proxy itself requested the generation of the 1xx response. (For example, if a proxy adds a "Expect: 100-continue" field when it forwards a request, then it need not forward the corresponding 100 (Continue) response(s).)

  • Successful 2xx

    This class of status code indicates that the client's request was successfully received, understood, and accepted.

  • Redirection 3xx

    This class of status code indicates that further action needs to be taken by the user agent in order to fulfill the request. The action required MAY be carried out by the user agent without interaction with the user if and only if the method used in the second request is GET or HEAD. A client SHOULD detect infinite redirection loops, since such loops generate network traffic for each redirection.

    Note: previous versions of this specification recommended a maximum of five redirections. Content developers should be aware that there might be clients that implement such a fixed limitation.

  • Client Error 4xx

    The 4xx class of status code is intended for cases in which the client seems to have erred. Except when responding to a HEAD request, the server SHOULD include an entity containing an explanation of the error situation, and whether it is a temporary or permanent condition. These status codes are applicable to any request method. User agents SHOULD display any included entity to the user.

    If the client is sending data, a server implementation using TCP SHOULD be careful to ensure that the client acknowledges receipt of the packet(s) containing the response, before the server closes the input connection. If the client continues sending data to the server after the close, the server's TCP stack will send a reset packet to the client, which may erase the client's unacknowledged input buffers before they can be read and interpreted by the HTTP application.

  • Server Error 5xx

    Response status codes beginning with the digit "5" indicate cases in which the server is aware that it has erred or is incapable of performing the request. Except when responding to a HEAD request, the server SHOULD include an entity containing an explanation of the error situation, and whether it is a temporary or permanent condition. User agents SHOULD display any included entity to the user. These response codes are applicable to any request method.

Annotations
  • @immutable

Constructors

HttpStatus({required int code, required String name, required String description})
Creates a new instance of HttpStatus with the provided code, name, and description. The constructor validates the status code to ensure it is within the acceptable range of 0 to 999, inclusive. If the given code falls outside this range, it throws an ArgumentError.
HttpStatus.fromCode(int code)
Constructs an instance of HttpStatus based on a predefined list of status codes.
factory

Properties

code int
The numeric HTTP status code (e.g., 200, 404).
final
description String
A more detailed description of what the status code means.
final
hashCode int
The hash code for this object.
no setteroverride
isClientErrorHttpStatusCode bool
Returns true if this ranges between 400 and 499
no setter
isInformationHttpStatusCode bool
Returns true if this ranges between 100 and 199
no setter
isRedirectHttpStatusCode bool
Returns true if this ranges between 300 and 399
no setter
isServerErrorHttpStatusCode bool
Returns true if code ranges between 500 and 599
no setter
isSuccessfulHttpStatusCode bool
Returns true if code ranges between 200 and 299
no setter
name String
A string name for quick identification of the status (e.g., "OK", "Not Found").
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(covariant HttpStatus other) bool
The equality operator.
override

Constants

accepted → const HttpStatus
202 ACCEPTED.
alreadyReported → const HttpStatus
208 ALREADY REPORTED.
badGateway → const HttpStatus
502 BAD GATEWAY.
badRequest → const HttpStatus
400 BAD REQUEST.
clientClosedRequest → const HttpStatus
499 CLIENT CLOSED REQUEST.
code100Continue → const HttpStatus
An alias representing the continue_ constant, offering a direct substitute for it.
code101SwitchingProtocols → const HttpStatus
An alias representing the switchingProtocols constant, offering a direct substitute for it.
code102Processing → const HttpStatus
An alias representing the processing constant, offering a direct substitute for it.
code103EarlyHints → const HttpStatus
An alias representing the earlyHints constant, offering a direct substitute for it.
code200Ok → const HttpStatus
An alias representing the ok constant, offering a direct substitute for it.
code201Created → const HttpStatus
An alias representing the created constant, offering a direct substitute for it.
code202Accepted → const HttpStatus
An alias representing the accepted constant, offering a direct substitute for it.
code203NonAuthoritativeInformation → const HttpStatus
An alias representing the nonAuthoritativeInformation constant, offering a direct substitute for it.
code204NoContent → const HttpStatus
An alias representing the noContent constant, offering a direct substitute for it.
code205ResetContent → const HttpStatus
An alias representing the resetContent constant, offering a direct substitute for it.
code206PartialContent → const HttpStatus
An alias representing the partialContent constant, offering a direct substitute for it.
code207MultiStatus → const HttpStatus
An alias representing the multiStatus constant, offering a direct substitute for it.
code208AlreadyReported → const HttpStatus
An alias representing the alreadyReported constant, offering a direct substitute for it.
code226ImUsed → const HttpStatus
An alias representing the imUsed constant, offering a direct substitute for it.
code300MultipleChoices → const HttpStatus
An alias representing the multipleChoices constant, offering a direct substitute for it.
code301MovedPermanently → const HttpStatus
An alias representing the movedPermanently constant, offering a direct substitute for it.
code302Found → const HttpStatus
An alias representing the found constant, offering a direct substitute for it.
code302MovedTemporarily → const HttpStatus
An alias representing the movedTemporarily constant, offering a direct substitute for it.
code303SeeOther → const HttpStatus
An alias representing the seeOther constant, offering a direct substitute for it.
code305NotModified → const HttpStatus
An alias representing the notModified constant, offering a direct substitute for it.
code305UseProxy → const HttpStatus
An alias representing the useProxy constant, offering a direct substitute for it.
code307TemporaryRedirect → const HttpStatus
An alias representing the temporaryRedirect constant, offering a direct substitute for it.
code308PermanentRedirect → const HttpStatus
An alias representing the permanentRedirect constant, offering a direct substitute for it.
code400BadRequest → const HttpStatus
An alias representing the badRequest constant, offering a direct substitute for it.
code401Unauthorized → const HttpStatus
An alias representing the unauthorized constant, offering a direct substitute for it.
code402PaymentRequired → const HttpStatus
An alias representing the paymentRequired constant, offering a direct substitute for it.
code403Forbidden → const HttpStatus
An alias representing the forbidden constant, offering a direct substitute for it.
code404NotFound → const HttpStatus
An alias representing the notFound constant, offering a direct substitute for it.
code405MethodNotAllowed → const HttpStatus
An alias representing the methodNotAllowed constant, offering a direct substitute for it.
code406NotAcceptable → const HttpStatus
An alias representing the notAcceptable constant, offering a direct substitute for it.
code407ProxyAuthenticationRequired → const HttpStatus
An alias representing the proxyAuthenticationRequired constant, offering a direct substitute for it.
code408RequestTimeout → const HttpStatus
An alias representing the requestTimeout constant, offering a direct substitute for it.
code409Conflict → const HttpStatus
An alias representing the conflict constant, offering a direct substitute for it.
code410Gone → const HttpStatus
An alias representing the gone constant, offering a direct substitute for it.
code411LengthRequired → const HttpStatus
An alias representing the lengthRequired constant, offering a direct substitute for it.
code412PreconditionFailed → const HttpStatus
An alias representing the preconditionFailed constant, offering a direct substitute for it.
code413RequestEntityTooLarge → const HttpStatus
An alias representing the requestEntityTooLarge constant, offering a direct substitute for it.
code414RequestUriTooLong → const HttpStatus
An alias representing the requestUriTooLong constant, offering a direct substitute for it.
code415UnsupportedMediaType → const HttpStatus
An alias representing the unsupportedMediaType constant, offering a direct substitute for it.
code416RequestedRangeNotSatisfiable → const HttpStatus
An alias representing the requestedRangeNotSatisfiable constant, offering a direct substitute for it.
code417ExpectationFailed → const HttpStatus
An alias representing the expectationFailed constant, offering a direct substitute for it.
code418ImATeapot → const HttpStatus
An alias representing the imATeapot constant, offering a direct substitute for it.
code419InsufficientSpaceOnResource → const HttpStatus
An alias representing the insufficientSpaceOnResource constant, offering a direct substitute for it.
code420MethodFailure → const HttpStatus
An alias representing the methodFailure constant, offering a direct substitute for it.
code421MisdirectedRequest → const HttpStatus
An alias representing the misdirectedRequest constant, offering a direct substitute for it.
code422UnprocessableEntity → const HttpStatus
An alias representing the unprocessableEntity constant, offering a direct substitute for it.
code423Locked → const HttpStatus
An alias representing the locked constant, offering a direct substitute for it.
code424FailedDependency → const HttpStatus
An alias representing the failedDependency constant, offering a direct substitute for it.
code426UpgradeRequired → const HttpStatus
An alias representing the upgradeRequired constant, offering a direct substitute for it.
code428PreconditionRequired → const HttpStatus
An alias representing the preconditionRequired constant, offering a direct substitute for it.
code429TooManyRequests → const HttpStatus
An alias representing the tooManyRequests constant, offering a direct substitute for it.
code431RequestHeaderFieldsTooLarge → const HttpStatus
An alias representing the requestHeaderFieldsTooLarge constant, offering a direct substitute for it.
code444ConnectionClosedWithoutResponse → const HttpStatus
An alias representing the connectionClosedWithoutResponse constant, offering a direct substitute for it.
code451UnavailableForLegalReasons → const HttpStatus
An alias representing the unavailableForLegalReasons constant, offering a direct substitute for it.
code499ClientClosedRequest → const HttpStatus
An alias representing the clientClosedRequest constant, offering a direct substitute for it.
code500InternalServerError → const HttpStatus
An alias representing the internalServerError constant, offering a direct substitute for it.
code501NotImplemented → const HttpStatus
An alias representing the notImplemented constant, offering a direct substitute for it.
code502BadGateway → const HttpStatus
An alias representing the badGateway constant, offering a direct substitute for it.
code503ServiceUnavailable → const HttpStatus
An alias representing the serviceUnavailable constant, offering a direct substitute for it.
code504GatewayTimeout → const HttpStatus
An alias representing the gatewayTimeout constant, offering a direct substitute for it.
code505HttpVersionNotSupported → const HttpStatus
An alias representing the httpVersionNotSupported constant, offering a direct substitute for it.
code506VariantAlsoNegotiates → const HttpStatus
An alias representing the variantAlsoNegotiates constant, offering a direct substitute for it.
code507InsufficientStorage → const HttpStatus
An alias representing the insufficientStorage constant, offering a direct substitute for it.
code508LoopDetected → const HttpStatus
An alias representing the loopDetected constant, offering a direct substitute for it.
code510NotExtended → const HttpStatus
An alias representing the notExtended constant, offering a direct substitute for it.
code511NetworkAuthenticationRequired → const HttpStatus
An alias representing the networkAuthenticationRequired constant, offering a direct substitute for it.
code599NetworkConnectTimeoutError → const HttpStatus
An alias representing the networkConnectTimeoutError constant, offering a direct substitute for it.
conflict → const HttpStatus
409 CONFLICT.
connectionClosedWithoutResponse → const HttpStatus
444 CONNECTION CLOSED WITHOUT RESPONSE.
continue_ → const HttpStatus
100 CONTINUE.
created → const HttpStatus
201 CREATED.
earlyHints → const HttpStatus
103 EARLY_HINTS.
expectationFailed → const HttpStatus
417 EXPECTATION FAILED.
failedDependency → const HttpStatus
424 FAILED DEPENDENCY.
forbidden → const HttpStatus
403 FORBIDDEN.
found → const HttpStatus
302 FOUND.
gatewayTimeout → const HttpStatus
504 GATEWAY TIMEOUT.
gone → const HttpStatus
410 GONE.
httpVersionNotSupported → const HttpStatus
505 HTTP VERSION NOT SUPPORTED.
imATeapot → const HttpStatus
418 I'm A Teapot.
imUsed → const HttpStatus
226 IM USED.
insufficientSpaceOnResource → const HttpStatus
419 Insufficient Space On Resource.
insufficientStorage → const HttpStatus
507 INSUFFICIENT STORAGE.
internalServerError → const HttpStatus
500 INTERNAL SERVER ERROR.
lengthRequired → const HttpStatus
411 LENGTH REQUIRED.
locked → const HttpStatus
423 LOCKED.
loopDetected → const HttpStatus
508 LOOP DETECTED.
methodFailure → const HttpStatus
420 Method Failure.
methodNotAllowed → const HttpStatus
405 METHOD NOT ALLOWED.
misdirectedRequest → const HttpStatus
421 MISDIRECTED REQUEST.
movedPermanently → const HttpStatus
301 MOVED PERMANENTLY.
movedTemporarily → const HttpStatus
302 MOVED TEMPORARILY.
multipleChoices → const HttpStatus
300 MULTIPLE CHOICES.
multiStatus → const HttpStatus
207 MULTI-STATUS.
networkAuthenticationRequired → const HttpStatus
511 NETWORK AUTHENTICATION REQUIRED.
networkConnectTimeoutError → const HttpStatus
599 NETWORK CONNECT TIMEOUT ERROR.
noContent → const HttpStatus
204 NO CONTENT.
nonAuthoritativeInformation → const HttpStatus
203 NON-AUTHORITATIVE INFORMATION.
notAcceptable → const HttpStatus
406 NOT ACCEPTABLE.
notExtended → const HttpStatus
510 NOT EXTENDED.
notFound → const HttpStatus
404 NOT FOUND.
notImplemented → const HttpStatus
501 NOT IMPLEMENTED.
notModified → const HttpStatus
305 NOT MODIFIED.
ok → const HttpStatus
103 EARLY_HINTS.
partialContent → const HttpStatus
206 PARTIAL CONTENT.
paymentRequired → const HttpStatus
402 PAYMENT REQUIRED.
permanentRedirect → const HttpStatus
308 PERMANENT REDIRECT.
preconditionFailed → const HttpStatus
412 PRECONDITION FAILED.
preconditionRequired → const HttpStatus
428 PRECONDITION REQUIRED.
processing → const HttpStatus
102 PROCESSING.
proxyAuthenticationRequired → const HttpStatus
407 PROXY AUTHENTICATION REQUIRED.
requestedRangeNotSatisfiable → const HttpStatus
416 REQUESTED RANGE NOT SATISFIABLE.
requestEntityTooLarge → const HttpStatus
413 PAYLOAD TOO LARGE.
requestHeaderFieldsTooLarge → const HttpStatus
431 REQUEST HEADER FIELDS TOO LARGE.
requestTimeout → const HttpStatus
408 REQUEST TIMEOUT.
requestUriTooLong → const HttpStatus
414 REQUEST-URI TOO LONG.
resetContent → const HttpStatus
205 RESET CONTENT.
seeOther → const HttpStatus
303 SEE OTHER.
serviceUnavailable → const HttpStatus
503 SERVICE UNAVAILABLE.
switchingProtocols → const HttpStatus
101 SWITCHING PROTOCOLS.
temporaryRedirect → const HttpStatus
307 TEMPORARY REDIRECT.
tooManyRequests → const HttpStatus
429 TOO MANY REQUESTS.
unauthorized → const HttpStatus
401 UNAUTHORIZED.
unavailableForLegalReasons → const HttpStatus
451 UNAVAILABLE FOR LEGAL REASONS.
unprocessableEntity → const HttpStatus
422 UNPROCESSABLE ENTITY.
unsupportedMediaType → const HttpStatus
415 UNSUPPORTED MEDIA TYPE.
upgradeRequired → const HttpStatus
426 UPGRADE REQUIRED.
useProxy → const HttpStatus
305 USE PROXY.
variantAlsoNegotiates → const HttpStatus
506 VARIANT ALSO NEGOTIATES.