googleai_dart
13.1.0, released 2 weeks ago by davidmiguel.com
Unofficial Dart client for Google AI Gemini, Vertex AI Gemini, and Live API WebSockets.
What it does
Provides a pure Dart, type-safe API client for Google AI Gemini and Vertex AI Gemini REST APIs, supporting text generation, image generation, audio, tool calling, embeddings, and Live API WebSocket sessions.
AI-written summary of version 13.1.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need a pure Dart Gemini client for backend services, CLIs, or cross-platform Flutter apps.
- You want to connect to both Google AI and Vertex AI using a single unified API client.
- You require advanced Gemini features like streaming, tool calling, grounding tools, and WebSocket Live API sessions.
Skip it when
- You are using Firebase AI and prefer the official Firebase package ecosystem.
- You only need on-device machine learning models rather than cloud-hosted LLM APIs.
Strengths
- Pure Dart with no Flutter dependency, working across mobile, web, desktop, and server.
- Comprehensive coverage of Gemini features including Live API WebSockets, tool calling, and structured outputs.
- Unified interface for both Google AI API keys and Vertex AI project routing.
Weaknesses
- It is an unofficial client, meaning it is not directly maintained or supported by Google.
- Requires managing API keys or GCP OAuth credentials manually.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 5
Requires Dart 3.12 or later and a valid Google AI API key or Vertex AI project configuration.
import 'package:googleai_dart/googleai_dart.dart';
Future<void> main() async {
final client = GoogleAIClient.fromEnvironment();
try {
final response = await client.models.generateContent(
model: 'gemini-3.5-flash',
request: GenerateContentRequest(
contents: [Content.text('Explain why Dart works well for APIs.')],
),
);
print(response.text);
} finally {
client.close();
}
}Alternatives
Packages that do the same job and could replace googleai_dart.
- firebase_ai
Official Firebase SDK for generative AI integration in Flutter applications.
86Compare
Works with
Packages commonly used together with googleai_dart: ones it builds on, ones built on it, and its own family.
- logginggoogleai_dart depends on itProvides configurable logging with levels and stream listeners for Dart apps.
- web_socketgoogleai_dart depends on itAn easy-to-use library for communicating with WebSockets that has multiple implementations.
- dartantic_aiBuilt on googleai_dartAgent framework for building client and server-side apps in Dart with generative AI.
- langchain_googleBuilt on googleai_dartLangChain.dart integration module for Google AI, Gemini, and VertexAI.