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

# Dart SDK

> The ButterCMS Dart SDK provides a typed interface for Dart and Flutter apps, with support for pages, collections, and blog posts.

## Installation

Add the package to your `pubspec.yaml`:

```yaml theme={null}
dependencies:
  buttercms_dart: ^1.0.0
```

Then run:

```bash theme={null}
dart pub get
```

Or for Flutter projects:

```bash theme={null}
flutter pub add buttercms_dart
```

## Initialization

Initialize the SDK with your Read API token from the [ButterCMS Settings](https://buttercms.com/settings/).

```dart theme={null}
import 'package:buttercms_dart/buttercms_dart.dart';

final butter = Butter('your_api_token');
```

## API methods

### Pages

```dart theme={null}
// Retrieve a single page
final page = await butter.page.retrieve(
  'landing_page',
  'home-page',
  {'locale': 'en', 'levels': '2'},
);
print(page);

// List all pages of a type
final pages = await butter.page.list(
  'landing_page',
  {'page': '1', 'page_size': '10'},
);
print(pages);
```

### Collections

```dart theme={null}
// Retrieve collection content
final content = await butter.content.retrieve(
  ['faq', 'navigation'],
  {'locale': 'en'},
);
print(content);
```

### Blog Posts

```dart theme={null}
// List blog posts
final posts = await butter.post.list(
  {'page': '1', 'page_size': '10', 'exclude_body': 'true'},
);

// Retrieve a single post
final post = await butter.post.retrieve('my-post-slug');
print(post);
```

### Authors

```dart theme={null}
// List all authors
final authors = await butter.author.list(
  {'include': 'recent_posts'},
);

// Note: this SDK version has no per-slug author lookup; `retrieve()` takes
// only optional query params and returns the same data as `list()`.
```

### Categories

```dart theme={null}
// List all categories
final categories = await butter.category.list(
  {'include': 'recent_posts'},
);

// Note: this SDK version has no per-slug category lookup; `retrieve()` takes
// only optional query params and returns the same data as `list()`.
```

### Tags

```dart theme={null}
// List all tags
final tags = await butter.tag.list(
  {'include': 'recent_posts'},
);
```

## Resources

> [card] [GitHub Repository](https://github.com/ButterCMS/buttercms-dart)
>
> View source code, report issues, and contribute

> [card] [pub.dev Package](https://pub.dev/packages/buttercms_dart)
>
> Package documentation and version history


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.