AIResult class

The result returned by an on-device AI inference call.

All inference methods (OnDeviceAi.runText, OnDeviceAi.runImage) return an AIResult containing the model's top prediction, its confidence score, and how long the inference took to run on the device.

Example:

final result = await ai.runText("This SDK is amazing!");
print(result.output);          // "Positive [Negative=0.02, Positive=0.98]"
print(result.confidenceScore); // 0.98
print(result.inferenceTimeMs); // 12

Constructors

AIResult({required String output, required double confidenceScore, required int inferenceTimeMs})
Creates an AIResult with the given output, confidenceScore, and inferenceTimeMs.
const

Properties

confidenceScore double
The confidence score of the top prediction, in the range [0.0, 1.0].
final
hashCode int
The hash code for this object.
no setterinherited
inferenceTimeMs int
The wall-clock time taken to run inference on the native side, in milliseconds.
final
output String
The human-readable label of the top prediction returned by the model.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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