Request class

This Fetch API interface represents a resource request.

MDN reference

Constructors

Request(Object input, {RequestCache? cache, RequestCredentials? credentials, RequestDestination? destination, String? integrity, String? method, RequestMode? mode, RequestRedirect? redirect, String? referrer, ReferrerPolicy? referrerPolicy, Object? headers, Object? body})
MDN Reference
factory

Properties

body Stream<Uint8List>?
A Stream of the body content.
no setter
bodyUsed bool
Stores true or false to indicate whether or not the body has been used in a request yet.
no setter
cache RequestCache
Contains the cache mode of the request (e.g., default, reload, no-cache).
no setter
credentials RequestCredentials
Contains the credentials of the request (e.g., omit, same-origin, include). The default is same-origin.
no setter
destination RequestDestination
A string describing the type of content being requested.
no setter
hashCode int
The hash code for this object.
no setterinherited
headers Headers
Contains the associated Headers object of the request.
no setter
integrity String
Returns request's subresource integrity metadata, which is a cryptographic hash of the resource being fetched. Its value consists of multiple hashes separated by whitespace. SRI
no setter
method String
Contains the request's method (GET, POST, etc.)
no setter
mode RequestMode
Contains the mode of the request (e.g., cors, no-cors, same-origin, navigate.)
no setter
redirect RequestRedirect
Contains the mode for how redirects are handled. It may be one of follow, error, or manual.
no setter
referrer String
Contains the referrer of the request (e.g., client).
no setter
referrerPolicy ReferrerPolicy
Contains the referrer policy of the request (e.g., no-referrer).
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
url String
Contains the URL of the request.
no setter

Methods

arrayBuffer() Future<ArrayBuffer>
Returns a promise that resolves with an ArrayBuffer representation of the request body.
blob() Future<Blob>
Returns a promise that resolves with a Blob representation of the request body.
clone() Request
Creates a copy of the current Request object.
formData() Future<FormData>
Returns a promise that resolves with a FormData representation of the request body.
json() Future<Object>
Returns a promise that resolves with the result of parsing the request body as JSON.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
text() Future<String>
Returns a promise that resolves with a text representation of the request body.
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

jsonCodec JsonCodec
Global helper, used Codec to encode or decode json.
getter/setter pair