RequestOptions class
Per-call knobs that are not part of the request's description.
ApiRequest describes what to call and is typically built once by an API class; these options describe how this particular call should behave, and belong to the caller:
repository.getPosts(options: RequestOptions(
cancelToken: _token,
retry: const RetryPolicy(maxAttempts: 5),
onReceiveProgress: (received, total) => setState(...),
));
Constructors
- RequestOptions({CancellationToken? cancelToken, RetryPolicy? retry, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, int? timeout, bool skipDeduplication = false})
-
const
Properties
- cancelToken → CancellationToken?
-
Cancels this call when triggered.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isPlain → bool
-
True when nothing here needs the transport to stream or watch the call.
no setter
- onReceiveProgress → ProgressCallback?
-
Fires as the response body is downloaded.
final
- onSendProgress → ProgressCallback?
-
Fires as the request body is uploaded.
final
- retry → RetryPolicy?
-
Overrides the repository's default retry behaviour for this call.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- skipDeduplication → bool
-
Skips in-flight de-duplication for this call, forcing a fresh request
even when an identical one is already running.
final
- timeout → int?
-
Overrides the request's own timeout, in seconds.
final
Methods
-
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