HttpClientResponseCompressionState enum Null safety

Enum that specifies the compression state of the byte stream of an HttpClientResponse.

The values herein allow callers to answer the following questions as they pertain to an HttpClientResponse:

  • Can the value of the response's Content-Length HTTP header be trusted?
  • Does the caller need to manually decompress the response's byte stream?

This enum is accessed via the HttpClientResponse.compressionState value.

Inheritance
Annotations
  • @Since("2.4")

Constants

compressed → const HttpClientResponseCompressionState

The body of the HTTP response contains compressed bytes.

In this state, the value of the Content-Length HTTP header, if specified (non-negative), should match the number of bytes produced by the response's byte stream.

If the caller wishes to manually uncompress the body of the response, it should consult the value of the Content-Encoding HTTP header to see what type of compression has been applied. See tools.ietf.org/html/rfc2616#section-14.11 for more information.

const HttpClientResponseCompressionState(2)
decompressed → const HttpClientResponseCompressionState

The body of the HTTP response was originally compressed, but by virtue of the HttpClient.autoUncompress configuration option, it has been automatically uncompressed.

HTTP headers are not modified, so when a response has been uncompressed in this way, the value of the Content-Length HTTP header cannot be trusted, as it will contain the compressed content length, whereas the stream of bytes produced by the response will contain uncompressed bytes.

const HttpClientResponseCompressionState(1)
notCompressed → const HttpClientResponseCompressionState

The body of the HTTP response was received and remains in an uncompressed state.

In this state, the value of the Content-Length HTTP header, if specified (non-negative), should match the number of bytes produced by the response's byte stream.

const HttpClientResponseCompressionState(0)
values → const List<HttpClientResponseCompressionState>

A constant List of the values in this enum, in order of their declaration.

const List<HttpClientResponseCompressionState>

Properties

hashCode int
The hash code for this object. [...]
read-only, inherited
index int

The integer index of this enum.

final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited