WebTaskWorker class final

One of Google's tasks on its own worker, from the family's assets/worker.js.

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

cancelAll() → void
Cancels every request submitted so far, running or queued, as the family's worker script defines a cancel for each, without waiting; nothing once the worker has closed.
close() → Future<void>
Waits for queued requests, then closes the task and its worker.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
run(JSObject input) → Future<String>
Runs one request after every request submitted before it and returns the worker's JSON.
runObject(JSObject input) → Future<JSObject?>
Like run, for a worker that answers with an object, or with null.
stream(JSObject input) → Stream<JSObject>
Sends one request once listened to, after every request submitted before it, and streams the chunks the worker emits for it. Cancelling asks the worker to stop, at once where its script handles a cancel and otherwise after the chunk in progress, and waits for it. A failure arrives as a TaskException and closes the stream.
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

create(String family, Map<String, Object?> options, {bool longRequests = false}) → Future<WebTaskWorker>
Starts a worker from family's worker script (mediapipe_text or mediapipe_audio) and creates its task from options: the task's settings named as in Google's JavaScript API, plus modelBytes or modelPath, a URL resolved against the page.