TaskExecutor<NativeOptions extends Struct, Options extends TaskOptions<NativeOptions>, NativeResult extends Struct, Result extends IOTaskResult> constructor

TaskExecutor<NativeOptions extends Struct, Options extends TaskOptions<NativeOptions>, NativeResult extends Struct, Result extends IOTaskResult>(
  1. Options options
)

Instantiates and manages an object which can complete MediaPipe tasks. The managed task-completing object does not exist in Dart memory, but instead in platform-dependent native memory.

Extending classes should implement createResultsPointer, createWorker, closeWorker, and any additional task-specific methods. Applications will only call those extra task-specific methods, which will throw an exception on any error communicating with the native workers. It is the job of application code to surround those task-specific methods with try-catch clauses.

Executors are separated from their public API counterparts because FFI and MediaPipe have no concept of asynchrony or futures, so this pattern allows a public-facing task handler to create an executor on a separate isolate, and for Flutter apps to await the results of MediaPipe tasks.

Implementation

TaskExecutor(this.options);