MethodChannelFlutterDeviceAi class
FlutterDeviceAiPlatform backed by platform channels (Android, iOS, macOS, Windows, Linux).
Wire protocol
- method channel
flutter_device_ai— request / response calls and theonToolCallcallback from native to Dart, - event channel
flutter_device_ai/events— one multiplexed stream of{sessionId, type: chunk|done|error, ...}events for streaming turns, - event channel
flutter_device_ai/download— model download progress.
- Inheritance
-
- Object
- PlatformInterface
- FlutterDeviceAiPlatform
- MethodChannelFlutterDeviceAi
Constructors
Properties
- downloadEventChannel → EventChannel
-
final
- eventChannel → EventChannel
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- methodChannel → MethodChannel
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
createSession(
{String? systemInstruction, List< OnDeviceAiTool> ? tools, GenerationConfig? config}) → Future<String> -
Creates a conversation and returns its id.
override
-
downloadModel(
) → Stream< ModelDownloadStatus> -
Asks the OS / browser to download the model, reporting progress.
override
-
getAvailability(
) → Future< OnDeviceAiAvailability> -
Current state of the native model, with a reason when it is not ready.
override
-
getPlatformInfo(
) → Future< OnDeviceAiPlatformInfo> -
What the native backend can do.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
openAICorePlayStore(
) → Future< bool> -
Opens the Google AICore page in Play Store (Android only).
override
-
sessionAddImage(
String sessionId, Uint8List imageBytes, {String mimeType = 'image/jpeg'}) → Future< void> -
Adds a user image part to the pending turn.
override
-
sessionAddQuery(
String sessionId, String text) → Future< void> -
Adds a user text part to the pending turn.
override
-
sessionClose(
String sessionId) → Future< void> -
Releases the session.
override
-
sessionCountTokens(
String sessionId, {String? text}) → Future< int> -
Token count of the whole conversation, or of
textwhen given.override -
sessionGetResponse(
String sessionId, {GenerationConfig? config}) → Future< AiResponse> -
Answers the pending turn.
override
-
sessionGetResponseStream(
String sessionId, {GenerationConfig? config}) → Stream< String> -
Answers the pending turn as a stream of text deltas.
override
-
sessionStopGeneration(
String sessionId) → Future< void> -
Cancels the generation in flight, if any.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited