gemini_live 2026.9.11 copy "gemini_live: ^2026.9.11" to clipboard
gemini_live: ^2026.9.11 copied to clipboard

A Flutter package for using the experimental Gemini Live API, enabling real-time, multimodal conversations with Google's Gemini models.

Flutter Gemini Live #

pub version License Platform

English | 한국어 | 日本語 | 简体中文


  • A Flutter package for the experimental Gemini Live API, enabling real-time, multimodal conversations with Google's Gemini models.
  • Zero Firebase Dependency: Direct WebSocket connection without Firebase or Firebase AI Logic.
  • Supports latest Gemini Live models (gemini-3.1-flash-live-preview, gemini-2.5-flash-native-audio-preview-12-2025).
  • Supports TEXT, AUDIO, and VIDEO response modalities.

https://github.com/user-attachments/assets/7d826f37-196e-4ddd-8828-df66db252e8e

Installation #

Add the package to your Flutter project:

flutter pub add gemini_live

Import the package in Dart:

import 'package:gemini_live/gemini_live.dart';

Quick Start #

Get up and running in under 20 lines of code:

import 'package:gemini_live/gemini_live.dart';

void main() async {
  // 1. Initialize Gemini Live client
  final genAI = GoogleGenAI(apiKey: 'YOUR_GEMINI_API_KEY', logger: print);

  // 2. Connect to the Live API
  final session = await genAI.live.connect(
    LiveConnectParameters(
      model: 'gemini-3.1-flash-live-preview',
      config: GenerationConfig(responseModalities: [Modality.TEXT]),
      callbacks: LiveCallbacks(
        onOpen: () => print('Live Session Connected!'),
        onMessage: (message) {
          if (message.text != null) {
            print('Gemini: ${message.text}');
          }
        },
        onError: (error, st) => print('Error: $error'),
        onClose: (code, reason) => print('Closed: $code - $reason'),
      ),
    ),
  );

  // 3. Send a message
  session.sendText('Hello Gemini, tell me a quick joke!');
}

Documentation & Guides #

For deep dives and complete references, see the modular guides in the doc/ directory:

  • AI Agent Skill Guide: Agent instructions & prompt rules for AI coding assistants (Antigravity, Cursor, Windsurf, Claude Code, etc.) to integrate this package.
  • API Reference: Complete class & method documentation for GoogleGenAI, LiveSession, LiveServerMessage, etc.
  • Widgets Guide & UI Specification: Detailed specification and interactive code examples for GeminiLiveStatusBadge, GeminiLiveMicButton, and GeminiLiveVoiceIndicator.
  • Advanced Configuration Guide: Guides for Function Calling, VAD, Session Resumption, Audio Transcription, Translation, Grounding, and Ephemeral Tokens.
  • Error Codes & Specifications: Complete error codes, close codes, TurnCompleteReason enums, and troubleshooting strategies.
  • Runnable Examples: Dedicated CLI scripts for basic usage, function calling, audio/video streaming, and Google Maps grounding.

Key Features Overview #

  • Real-time Communication: Low-latency WebSocket interaction.
  • Multimodal Input & Streaming Output: Text, audio, and camera frame input with live streaming responses.
  • Function Calling: Synchronous and asynchronous function execution.
  • Session Resumption: Resume dropped connections via session handles.
  • Google Maps & Search Grounding: Location and routing-aware responses.
  • Voice Activity Detection: Automatic and manual VAD.
  • Live Speech Translation: Real-time speech-to-speech translation (TranslationConfig).
  • Pre-built Flutter Widgets: Drop-in UI widgets (GeminiLiveStatusBadge, GeminiLiveMicButton, GeminiLiveVoiceIndicator) for seamless app integration.
Demo 1: Chihuahua vs muffin Demo 2: Labradoodle vs fried chicken
Live Conversation Demo Multimodal Demo
Chihuahua vs muffin Labradoodle vs fried chicken

Pre-built UI Widgets #

The package ships with ready-to-use Flutter Material widgets to accelerate building Live conversational interfaces:

// 1. Status Badge with live interaction tracking
GeminiLiveStatusBadge.fromFlags(
  isConnected: isConnected,
  isConnecting: isConnecting,
  interactionStatus: sessionStatus, // IN_PROGRESS / IDLE
)

// 2. Animated Mic Button with pulse ripples
GeminiLiveMicButton(
  isRecording: isRecording,
  onPressed: toggleVoice,
)

// 3. Dancing Voice Waveform Bars
GeminiLiveVoiceIndicator(
  isSpeaking: isSpeaking,
  barCount: 5,
  color: Colors.blueAccent,
)

License #

This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.

9
likes
160
points
547
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A Flutter package for using the experimental Gemini Live API, enabling real-time, multimodal conversations with Google's Gemini models.

Repository (GitHub)
View/report issues

License

BSD-3-Clause (license)

Dependencies

flutter, http, json_annotation, web_socket_channel, web_socket_client

More

Packages that depend on gemini_live