> For the complete documentation index, see [llms.txt](https://dnotifier.gitbook.io/product-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dnotifier.gitbook.io/product-docs/reference/chat-methods/dart-flutter.md). Agents can also search and read this documentation through its [MCP server](https://dnotifier.gitbook.io/product-docs/~gitbook/mcp).

# Dart / Flutter

## `fetchChatHistory()`

```dart
Future<dynamic> fetchChatHistory({
  required String senderId,
  required List<String> receiverIds,
})
```

| Parameter     | Type           | Required | Description                 |
| ------------- | -------------- | -------- | --------------------------- |
| `senderId`    | `String`       | ✅        | Requesting user id          |
| `receiverIds` | `List<String>` | ✅        | Participant ids (non-empty) |

**Server metadata:** `type: 'text'`, `code: 201`

**Returns:** `Future<dynamic>` — direct response over HTTP; `onMessage` over WebSocket.

```dart
await notifier.fetchChatHistory(
  senderId: 'user-alice',
  receiverIds: ['user-bob'],
);
```

## `deleteChatHistoryMessage()`

```dart
Future<dynamic> deleteChatHistoryMessage({
  required String senderId,
  required String messageId,
})
```

| Parameter   | Type     | Required | Description          |
| ----------- | -------- | -------- | -------------------- |
| `senderId`  | `String` | ✅        | Requesting user id   |
| `messageId` | `String` | ✅        | Message id to delete |

**Server metadata:** `type: 'text'`, `code: 202`

```dart
await notifier.deleteChatHistoryMessage(
  senderId: 'user-alice',
  messageId: 'msg-uuid-here',
);
```

## Errors

| Error                                   | Cause               |
| --------------------------------------- | ------------------- |
| `StateError('Not connected')`           | Not connected       |
| `ArgumentError('senderId required')`    | Missing sender      |
| `ArgumentError('receiverIds required')` | Empty `receiverIds` |
| `ArgumentError('messageId required')`   | Delete without id   |
