> ## Documentation Index
> Fetch the complete documentation index at: https://docs.clariodesk.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Flutter API reference

> The headless public surface of the Flutter SDK.

All methods are static on `ClarioDesk`. Reads are exposed as `Stream`s that
auto-prime and then live-update.

## Lifecycle

### `init`

```dart theme={null}
Future<void> ClarioDesk.init({
  required String apiKey,
  ClarioDeskTheme? theme,
  IdentityTokenProvider? identityTokenProvider,
})
```

Call once at app start. Generates the hardware key + registers the device on
first launch; reuses it afterward. Pass a `theme` only if you use the
[prebuilt UI](/flutter/prebuilt-ui).

### `identify`

```dart theme={null}
Future<void> ClarioDesk.identify({
  String? externalId,
  String? name,
  String? email,
  Map<String, Object?> traits,
  String? identityToken,
  IdentityMode? identityMode,
})
```

Without a token, attach unverified display metadata. With a token/provider,
perform [Verified identity](/concepts/verified-identity). Proof failures never
fall back to labels.

```dart theme={null}
Future<String> get ClarioDesk.deviceThumbprint
Future<void> ClarioDesk.clearIdentity()
```

Use `clearIdentity()` before Verified-identity logout/account switch.

### `reset`

```dart theme={null}
Future<void> ClarioDesk.reset()
```

Acknowledged one-installation revoke, followed by hardware-key/cache wipe. It
is not logout or customer erase. The next `init()` registers a fresh device.

## Tickets & messages

### `createTicket`

```dart theme={null}
Future<Ticket> ClarioDesk.createTicket({
  required String subject,
  required String body,
  List<OutgoingAttachment> attachments,
})
```

### `sendMessage`

```dart theme={null}
Future<Message> ClarioDesk.sendMessage(
  String ticketId,
  String body, {
  List<OutgoingAttachment> attachments,
})
```

Optimistic: the message appears as pending immediately and settles on success.

### `ticketsStream`

```dart theme={null}
Stream<List<Ticket>> ClarioDesk.ticketsStream()
```

Reactive inbox. Auto-primes from cache, then streams live updates.

### `messagesStream`

```dart theme={null}
Stream<List<Message>> ClarioDesk.messagesStream(String ticketId)
```

Reactive thread for one ticket.

## CSAT

### `submitCsat`

```dart theme={null}
Future<void> ClarioDesk.submitCsat(
  String ticketId, {
  required int score,   // 1 (😔) … 5 (😄)
  String? comment,
})
```

See [CSAT](/concepts/csat).

## Attachments

### `attachmentUploadProgress`

```dart theme={null}
ValueListenable<double> ClarioDesk.attachmentUploadProgress(String localId)
```

Per-upload progress, from `0.0` to `1.0`.

### `refreshAttachmentUrl`

```dart theme={null}
Future<Attachment> ClarioDesk.refreshAttachmentUrl(String attachmentId)
```

Re-presign an expired GET URL. See [Attachments](/concepts/attachments).

## Push

### `handlePushPayload`

```dart theme={null}
void ClarioDesk.handlePushPayload(Map<String, dynamic> payload)
```

Call from your push handler to deep-link to the relevant ticket. See
[Push notifications](/concepts/push-notifications).

## Connection

### `connectionStream`

```dart theme={null}
Stream<ConnectionState> ClarioDesk.connectionStream()
```

Observe realtime connection state: `connecting`, `connected`, `reconnecting`,
`disconnected`, `fatal`. See [Realtime](/concepts/realtime).

<Note>
  The React Native SDK mirrors this surface 1:1 with the same method names and
  semantics, and the Swift SDK implements the same contract in Swift idioms. If
  a capability behaves differently across the SDKs, it's a bug. See the
  [RN API reference](/react-native/api-reference) and the
  [Swift API reference](/swift/api-reference).
</Note>
