EmbeddingService class
Dart-based embedding service backed by a dedicated background isolate.
All ONNX inference runs on a long-lived worker isolate so that the main isolate (UI thread) is never blocked. The public API is unchanged:
await EmbeddingService.init(modelPath: '/path/to/model.onnx');
final embedding = await EmbeddingService.embed('Hello world');
await EmbeddingService.disposeAsync();
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
-
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
Static Properties
Static Methods
-
dispose(
) → void - Backward compatible, non-blocking dispose.
-
disposeAsync(
) → Future< void> - Release resources deterministically.
-
embed(
String text) → Future< List< double> > - Convert text to an embedding vector.
-
embedBatch(
List< String> texts, {int concurrency = 1, void onProgress(int completed, int total)?}) → Future<List< List< >double> > - Batch embed multiple texts (sequential processing).
-
init(
{Uint8List? modelBytes, String? modelPath, OrtSessionOptions? options, int? intraOpNumThreads}) → Future< void> - Initialize ONNX model on a background worker isolate.