# Request options

Canonical page: https://docs.ovok.com/flutter-sdk/reference/ovok_sdk/request-options

{/* Generated by scripts/generate_reference.dart; do not edit. */}

## CancelToken [#canceltoken]

```dart
class CancelToken
```

Ends the requests that carry it; the Dart counterpart of an `AbortSignal`.

### Constructors [#constructors]

#### CancelToken.new [#canceltokennew]

```dart
CancelToken()
```

### Properties [#properties]

#### CancelToken.isCancelled [#canceltokeniscancelled]

```dart
bool get isCancelled
```

Whether [`cancel`](#canceltokencancel) has been called.

#### CancelToken.whenCancelled [#canceltokenwhencancelled]

```dart
Future<Object?> get whenCancelled
```

Completes with the reason given to [`cancel`](#canceltokencancel).

### Methods [#methods]

#### CancelToken.cancel [#canceltokencancel]

```dart
void cancel([Object? reason])
```

Aborts every request carrying this token; later calls change nothing.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `reason` | `Object?` | optional positional |  |

Returns `void`.


## RequestOptions [#requestoptions]

```dart
class RequestOptions
```

Per-request limits, accepted by every network method that has them.

### Constructors [#constructors-1]

#### RequestOptions.new [#requestoptionsnew]

```dart
RequestOptions({Duration? timeout, CancelToken? cancelToken})
```

Limits one exchange to [`timeout`](#requestoptionstimeout) and ends it when [`cancelToken`](#requestoptionscanceltoken) is cancelled.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `timeout` | `Duration?` | named |  |
| `cancelToken` | `CancelToken?` | named |  |

### Properties [#properties-1]

#### RequestOptions.timeout [#requestoptionstimeout]

```dart
final Duration? timeout
```

Replaces the client's timeout for each exchange of the request.

#### RequestOptions.cancelToken [#requestoptionscanceltoken]

```dart
final CancelToken? cancelToken
```

Cancelling it throws `OvokCancelledException`, and the request is not retried.
