AdkFlutterClient class
Main client class for communicating with ADK-powered Gemini Live API via WebSocket
This class provides methods to establish WebSocket connection, send audio/text/image data, and receive responses from the ADK Gemini Live API in real-time. Supports advanced features like transcription, search integration, multi-agent conversations, and turn management.
Constructors
- AdkFlutterClient({required String serverUrl, String? apiKey, Duration connectionTimeout = const Duration(seconds: 30)})
Properties
- apiKey → String?
-
final
- channel → WebSocketChannel?
-
Provides direct access to the WebSocket channel for advanced use cases
no setter
- connectionTimeout → Duration
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- interactionMode → InteractionMode
-
no setter
- isConnected → bool
-
no setter
- isConnecting → bool
-
no setter
-
onAudio
→ Stream<
Uint8List> -
no setter
-
onConnectionState
→ Stream<
WebSocketConnectionState> -
no setter
-
onError
→ Stream<
String> -
no setter
-
onInterrupt
→ Stream<
bool> -
no setter
- onMessage → Stream
-
no setter
-
onSetupAck
→ Stream<
Map< String, dynamic> > -
no setter
-
onText
→ Stream<
String> -
no setter
-
onTranscription
→ Stream<
TranscriptionEvent> -
no setter
-
onTurnComplete
→ Stream<
Map< String, dynamic> > -
no setter
-
onTurnCompleteEvent
→ Stream<
TurnCompleteEvent> -
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- serverUrl → String
-
final
Methods
-
connect(
) → Future< void> - Establishes WebSocket connection to the server
-
disconnect(
) → Future< void> - Closes the WebSocket connection gracefully
-
dispose(
) → void - Cleans up all resources and closes connections
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
sendAudio(
Uint8List pcmAudioData) → Future< void> - Sends PCM audio data to the server
-
sendCameraStatus(
bool enabled, {bool autoProcess = false}) → void - Send camera status update to server NEW: Added auto_process flag for contextual image processing
-
sendContextUpdate(
Uint8List imageData) → Future< void> - Send context update (Image) before audio stream
-
sendText(
String text, {Uint8List? cameraImage}) → Future< void> - Sends text data to the server (Atomic Message)
-
setupSession(
{required String systemInstruction, String voice = 'Kore', String language = 'en-US', InteractionMode mode = InteractionMode.audio}) → Future< void> - Initializes a new session with the specified configuration
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited