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.

Inheritance

Constructors

HTTPRequestBody(HttpRequest request)

Creates a new instance of this type.

Properties

contentType → ContentType

@override, read-only
isEmpty → bool

@override, read-only
bytes → Stream<List<int>>

The stream of bytes to decode.

final, inherited
decodedData → Future<List>

Returns decoded data, decoding it if not already decoded.

read-only, inherited
decodedType → Type

The type of data bytes was decoded into.

read-only, inherited
hasBeenDecoded → bool

Whether or not bytes have been decoded yet.

read-only, inherited
hashCode → int

The hash code for this object.

read-only, inherited
retainOriginalBytes → bool

Whether or not bytes are available as a list after decoding has occurred.

read / write, 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.

inherited
asList() → List

Returns decoded data as List if decoding has already occurred.

inherited
asMap() → Map<String, dynamic>

Returns decoded data as Map if decoding has already occurred.

inherited
asString() → String

Returns decoded data as String if decoding as already occurred.

inherited
decodeAsBytes() → Future<List<int>>

Returns request body as List of bytes.

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

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

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

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

inherited
decodeAsString() → Future<String>

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

inherited
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