# Dart

The Dart SDK is the Dart client for the `antd` daemon.

## Install

```bash
dart pub add antd
```

## Connect to the daemon

```dart
import 'package:antd/antd.dart';

void main() async {
  final client = AntdClient(baseUrl: 'http://localhost:8082');
  final health = await client.health();
  print(health.network);
  client.close();
}
```

## Store and retrieve data

```dart
import 'dart:convert';
import 'dart:typed_data';

import 'package:antd/antd.dart';

void main() async {
  final client = AntdClient();
  final result = await client.dataPutPublic(Uint8List.fromList(utf8.encode('Hello, Autonomi!')));
  print(result.address);

  final data = await client.dataGetPublic(result.address);
  print(utf8.decode(data));
  client.close();
}
```

## Type mappings

| Autonomi type  | Dart type       |
| -------------- | --------------- |
| `HealthStatus` | Dart model type |
| `PutResult`    | Dart model type |
| Raw data       | `Uint8List`     |

## Error handling

```dart
try {
  final data = await client.dataGetPublic('bad-address');
  print(data);
} on NotFoundError {
  print('Data not found');
} on PaymentError {
  print('Insufficient funds');
} on AntdError catch (error) {
  print(error);
}
```

## Full API reference

For all available daemon endpoints, see the [REST API](/developers/sdk/install/reference/rest-api.md).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.autonomi.com/developers/sdk/install/reference/language-bindings/dart.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
