ensureInitialized method

  1. @override
Future<void> ensureInitialized()
override

Loads the native core, if it is not loaded already. Idempotent.

This exists because of web. Native targets resolve their code asset at startup and have nothing to wait for, but instantiating a WASM module is inherently asynchronous. The alternative - making every method return a Future - would put an event-loop turn in front of reduceMinMax, which is called once per frame while scrubbing and once per hop while capturing. One await up front is the cheaper shape.

Every other method throws MonowaveUnavailable until this completes.

Implementation

@override
Future<void> ensureInitialized() async => initializeCount++;