LiveClient class

Client for the Gemini Live API.

Provides WebSocket-based real-time bidirectional streaming for audio, video, and text conversations.

Example

final client = GoogleAIClient(config: config);
final liveClient = client.createLiveClient();

final session = await liveClient.connect(
  model: 'gemini-2.0-flash-live-001',
  liveConfig: LiveConfig(
    generationConfig: LiveGenerationConfig(
      responseModalities: ['AUDIO', 'TEXT'],
    ),
  ),
);

// Use session for streaming...

await session.close();
await liveClient.close();

Constructors

LiveClient({required GoogleAIConfig config})
Creates a LiveClient.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

close() Future<void>
Closes all active sessions and cleans up resources.
connect({required String model, LiveConfig? liveConfig, String? accessToken}) Future<LiveSession>
Connects to the Live API and starts a new session.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resume({required String model, required String resumptionToken, LiveConfig? liveConfig, String? accessToken}) Future<LiveSession>
Resumes a previous session using a resumption token.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited