Skip to content
pubscout

anthropic_sdk_dart

11.0.0, released 9 days ago by davidmiguel.com

Dart client for the Anthropic API with streaming and tool support

WASM-ready
$ flutter pub add anthropic_sdk_dart
Source repository

What it does

Provides type-safe access to Claude models, supporting messaging, streaming, tool calling, batch processing, and multimodal prompts. It works across Dart and Flutter platforms.

AI-written summary of version 11.0.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to integrate Claude AI models into your Dart or Flutter application.
  • You require advanced Anthropic features like streaming, tool use, and workload identity federation.

Skip it when

  • You are using a different LLM provider like OpenAI or Google Gemini and want a generic wrapper.
  • You only need a simple server-side implementation and prefer making raw HTTP requests.

Strengths

  • Pure Dart client supporting multiple platforms including mobile, web, and server-side.
  • Type-safe models mirroring the official Anthropic API specification closely.

Weaknesses

  • Tied exclusively to the Anthropic API ecosystem.
  • API updates or breaking changes from Anthropic require SDK version updates.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
4

Requires an Anthropic API key or OAuth access token, configured via environment variables or an explicit auth provider.

import 'package:anthropic_sdk_dart/anthropic_sdk_dart.dart';

Future<void> main() async {
  final client = AnthropicClient.fromEnvironment();

  try {
    final response = await client.messages.create(
      MessageCreateRequest(
        model: 'claude-sonnet-5-5',
        maxTokens: 1024,
        messages: [InputMessage.user('What is the capital of France?')],
      ),
    );

    print(response.text);
  } finally {
    client.close();
  }
}

Alternatives

Packages that do the same job and could replace anthropic_sdk_dart.

  • firebase_ai

    If you are already integrated with Firebase and want to access generative AI models through its ecosystem.

Works with

Packages commonly used together with anthropic_sdk_dart: ones it builds on, ones built on it, and its own family.