Request class Null safety

Represents the request that will be sent to the http server.

Constructors

Request({required Uri uri, required String method, required Map<String, String> headers, ValidateCallback? validateStatus, List<int> bodyBytes = const [], required Duration timeout, ResponseType responseType = ResponseType.json, void onDownloadProgress(int total, int current)?})

Properties

bodyBytes List<int>
Buffer of data that will be sent to the server.
final
hashCode int
The hash code for this object.
read-only, inherited
headers Map<String, String>
Headers of request.
final
method String
Represents the request method. ex: GET, POST, PUT, DELETE, PATCH, HEAD.
final
onDownloadProgress → (void Function?(int total, int current)?)
Callback from API to client about request`s upload.
final
responseType ResponseType
Represents the Response data type. Could use:
final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
timeout Duration
Time that the server will wait for the response to the request. The connection will be interrupted if you hear timeout.
final
uri Uri
A parsed URI, such as a URL.
final
validateStatus ValidateCallback
Using the validateStatus config option, you can define HTTP code(s) that should throw an error.
late, final

Methods

copyWith({Uri? uri, Duration? timeout, String? method, Map<String, String>? headers, List<int>? bodyBytes, ResponseType? responseType, ValidateCallback? validateStatus, void onDownloadProgress(int total, int current)?}) Request
Create a new copy of request object.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

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