JS-engine bridge

Run the shared Ovok TypeScript contract inside a Flutter app with the OvokJsBridge.

  • Stable unknown
  • Release candidate not available
  • Development since 0.2.0-dev.51+80996d9

OvokJsBridge runs the @ovok/native/next contract in an embedded JavaScript engine, so Flutter calls the same code as the Native SDK instead of a Dart copy. HTTP and the secure store stay in Dart; Bluetooth, health import and background sync never enter the engine.

Route a call through the engine

Give the bridge and the client the same secure store, so both read one session, then pass the bridge to Ovok:

final bridge = OvokJsBridge(baseUrl: baseUrl, tenantCode: 'acme', secureStore: store);
final ovok = Ovok(
  baseUrl: baseUrl,
  tenantCode: 'acme',
  secureStore: store,
  jsContract: bridge,
);
final patient = await ovok.fhir.read('Patient', 'p1');

Today only fhir.read uses the bridge, and only when called without RequestOptions. A failure inside the engine throws an OvokJsException with the JavaScript error name, message and stack. See the OvokJsBridge reference.

Last updated on

On this page