Instances of this class decode HTTP request bodies according to their content type.

Every instance of Request has a Request.body property of this type. HTTPControllers automatically decode Request.body prior to invoking a responder method. Other RequestControllers should use decodedData or one of the typed methods (asList, asMap, decodeAsMap, decodeAsList) to decode HTTP body data.

Default decoders are available for 'application/json', 'application/x-www-form-urlencoded' and 'text/*' content types.

Constructors

HTTPRequestBody(HttpRequest request)

Creates a new instance of this type.

Properties

decodedData → Future<List>

Returns decoded data, decoding it if not already decoded.

read-only
decodedType → Type

read-only
hasBeenDecoded → bool

Whether or not the data has been decoded yet.

read-only
isEmpty → bool

Whether or not this body is empty or not.

read-only
retainOriginalBytes → bool

Whether or not to keep the raw bytes of a request body.

read / write
hashCode → int

The hash code for this object.

read-only, inherited
runtimeType → Type

A representation of the runtime type of the object.

read-only, inherited

Operators

operator ==(other) → bool

The equality operator.

inherited

Methods

asBytes() → List<int>

Returns decoded data as a List of bytes if decoding has already been attempted.

asList() → List

Returns decoded data as List if decoding has already occurred.

asMap() → Map<String, dynamic>

Returns decoded data as Map if decoding has already occurred.

asString() → String

Returns decoded data as String if decoding as already occurred.

decodeAsBytes() → Future<List<int>>

Returns request body as List of bytes.

decodeAsList() → Future<List<Map<String, dynamic>>>

Returns decoded data as List, decoding it if not already decoded.

decodeAsMap() → Future<Map<String, dynamic>>

Returns decoded data as Map, decoding it if not already decoded.

decodeAsString() → Future<String>

Returns decoded data as String, decoding it if not already decoded.

noSuchMethod(Invocation invocation) → dynamic

Invoked when a non-existent method or property is accessed.

inherited
toString() → String

Returns a string representation of this object.

inherited