LiveSession class
Manages asynchronous communication with Gemini model over a WebSocket connection.
- Available extensions
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- rawSession → LiveSession
-
Available on LiveSession, provided by the GeminiLiveSessionExtras extension
The underlying gemini_live core session, for features outside the firebase_ai API (for examplesendAudioStreamEnd).no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- tokenTracker → GeminiTokenUsageTracker
-
Available on LiveSession, provided by the GeminiLiveSessionExtras extension
Running token usage and cost for this session, fed by the server's usage metadata.no setter
Methods
-
close(
) → Future< void> - Closes the WebSocket connection.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
receive(
) → Stream< LiveServerResponse> - Receives messages from the server.
-
resumeSession(
{SessionResumptionConfig? sessionResumption}) → Future< void> - Resumes an existing live session with the server.
-
send(
{Content? input, bool turnComplete = false}) → Future< void> - Sends content to the server.
-
sendAudioRealtime(
InlineDataPart audio) → Future< void> - Sends audio data to the server in realtime.
-
sendMediaChunks(
{required List< InlineDataPart> mediaChunks}) → Future<void> - Sends realtime input (media chunks) to the server.
-
sendMediaStream(
Stream< InlineDataPart> mediaChunkStream) → Future<void> -
Starts streaming media chunks to the server from the provided
mediaChunkStream. -
sendStartActivityRealtime(
) → Future< void> - Manually marks the start of user activity, using the realtime API.
-
sendStopActivityRealtime(
) → Future< void> - Manually marks the end of user activity, using the realtime API.
-
sendTextRealtime(
String text) → Future< void> - Sends text data to the server in realtime.
-
sendToolResponse(
List< FunctionResponse> ? functionResponses) → Future<void> - Sends tool responses for function calling to the server.
-
sendVideoRealtime(
InlineDataPart video) → Future< void> - Sends video data to the server in realtime.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited