Request class

An HTTP request.

Constructors

Request(String method, Uri uri, {Map<String, Object>? headers, Object? body, Encoding? encoding})
An HTTP request.
Request.delete(Uri uri, {Map<String, Object>? headers, Object? body, Encoding? encoding})
An HTTP DELETE request.
Request.get(Uri uri, {Map<String, Object>? headers, Object? body, Encoding? encoding})
An HTTP GET request.
Request.patch(Uri uri, {Map<String, Object>? headers, Object? body, Encoding? encoding})
An HTTP PATCH request.
Request.post(Uri uri, {Map<String, Object>? headers, Object? body, Encoding? encoding})
An HTTP POST request.
Request.put(Uri uri, {Map<String, Object>? headers, Object? body, Encoding? encoding})
An HTTP PUT request.

Properties

connectionInfo HttpConnectionInfo
Connection information for the associated HTTP request.
no setter
hashCode int
The hash code for this object.
no setterinherited
headers Map<String, String>
The HTTP headers with case-insensitive keys. The returned map is unmodifiable.
no setter
method HttpMethod
The HttpMethod associated with the request.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
uri Uri
The original requested Uri.
no setter
url Uri
The requested url relative to the current handler path.
no setter

Methods

body() Future<String>
Returns a Future containing the body as a String.
bytes() Stream<List<int>>
Returns a Stream representing the body.
copyWith({Map<String, Object?>? headers, String? path, Object? body}) Request
Creates a new Request by copying existing values and applying specified changes.
formData() Future<FormData>
Returns a Future containing the form data as a Map.
json() Future
Returns a Future containing the body text parsed as a json object. This object could be anything that can be represented by json e.g. a map, a list, a string, a number, a bool...
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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