FlutterDeviceAiPlatform class abstract
The contract every platform implementation fulfils.
The surface is deliberately small: availability, model download and sessions. One-shot generation, tool-call emulation, structured-output repair and fallback routing are built on top of it in Dart, so they behave identically everywhere.
- Inheritance
-
- Object
- PlatformInterface
- FlutterDeviceAiPlatform
- Implementers
Constructors
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
-
createSession(
{String? systemInstruction, List< OnDeviceAiTool> ? tools, GenerationConfig? config}) → Future<String> - Creates a conversation and returns its id.
-
downloadModel(
) → Stream< ModelDownloadStatus> - Asks the OS / browser to download the model, reporting progress.
-
getAvailability(
) → Future< OnDeviceAiAvailability> - Current state of the native model, with a reason when it is not ready.
-
getPlatformInfo(
) → Future< OnDeviceAiPlatformInfo> - What the native backend can do.
-
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).
-
sessionAddImage(
String sessionId, Uint8List imageBytes, {String mimeType = 'image/jpeg'}) → Future< void> - Adds a user image part to the pending turn.
-
sessionAddQuery(
String sessionId, String text) → Future< void> - Adds a user text part to the pending turn.
-
sessionClose(
String sessionId) → Future< void> - Releases the session.
-
sessionCountTokens(
String sessionId, {String? text}) → Future< int> -
Token count of the whole conversation, or of
textwhen given. -
sessionGetResponse(
String sessionId, {GenerationConfig? config}) → Future< AiResponse> - Answers the pending turn.
-
sessionGetResponseStream(
String sessionId, {GenerationConfig? config}) → Stream< String> - Answers the pending turn as a stream of text deltas.
-
sessionStopGeneration(
String sessionId) → Future< void> - Cancels the generation in flight, if any.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance ↔ FlutterDeviceAiPlatform
-
The active platform-specific implementation.
getter/setter pair