Postor class abstract
the base class of Postor, a wrapper around http's Client which supports cancelling any HTTP request based on its request url.
it is by default sets Duration
of network timeout on every http request and
retries 3 times when fails.
Constructors
Properties
- baseUrl → String
-
no setter
-
defaultHeaders
→ Map<
String, String> ? -
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
cancel(
String url) → void -
cancels HTTP request of
url
-
cancelAll(
) → void - cancels all HTTP requests
-
get(
String endpoint, {Map< String, dynamic> ? parameters, Map<String, String> ? headers, Duration? timeLimit, ResponseTimeoutCallback? onTimeout, Client? testClient}) → Future<Response> -
Creates an HTTP Client GET request with the given headers to the given URL and
a default
timeLimit
of 10 seconds, and then closes it after completed/cancelled. -
multiPart(
String endpoint, {String method = 'POST', Map< String, String> ? fields, Map<String, PFile< ? files, Duration? timeLimit, ResponseTimeoutCallback? onTimeout, Client? testClient}) → Future<Object> >Response> - A shortcut to send with MultipartRequest. This is usually for uploading fields with files and/or images.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
post(
String endpoint, {Map< String, dynamic> ? parameters, Map<String, String> ? headers, Object? body, Encoding? encoding, Duration? timeLimit, ResponseTimeoutCallback? onTimeout, Client? testClient}) → Future<Response> -
Creates an HTTP Client POST request with the given headers and body to the given URL and
a default
timeLimit
of 10 seconds, and then closes it after completed/cancelled. -
put(
String endpoint, {Map< String, dynamic> ? parameters, Map<String, String> ? headers, Object? body, Encoding? encoding, Duration? timeLimit, ResponseTimeoutCallback? onTimeout, Client? testClient}) → Future<Response> -
Creates an HTTP Client PUT request with the given headers and body to the given URL and
a default
timeLimit
of 10 seconds, and then closes it after completed/cancelled. -
send(
BaseRequest request, {Duration? timeLimit, StreamedResponseTimeoutCallback? onTimeout, void onCancel()?, Client? testClient}) → Future< StreamedResponse> -
Creates an HTTP Client request with a default
timeLimit
of 10 seconds, and asynchronously returns the response, and then closes it after completed/cancelled. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited