OrtIsolateSession class
An ONNX Runtime session that runs entirely in a background Isolate.
All heavy operations (model loading, inference) happen off the main thread, so the Flutter UI never freezes.
final session = await OrtIsolateSession.create(
OrtIsolateSessionConfig(modelPath: 'path/to/model.onnx'),
);
final results = await session.runFloat(
{'input': OrtIsolateInput(shape: [1, 1, 28, 28], data: inputData)},
[10],
);
await session.dispose();
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- inputCount → int
-
no setter
-
inputNames
→ List<
String> -
no setter
- isDisposed → bool
-
no setter
- outputCount → int
-
no setter
-
outputNames
→ List<
String> -
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
dispose(
) → Future< void> - Disposes the session and kills the background isolate.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
runFloat(
Map< String, OrtIsolateInput> inputs, List<int> outputElementCounts) → Future<List< Float32List> > - Runs inference in the background isolate.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
create(
OrtIsolateSessionConfig config) → Future< OrtIsolateSession> - Creates a session in a background isolate.