# Ovok js bridge

Canonical page: https://docs.ovok.com/flutter-sdk/reference/ovok_flutter/ovok-js-bridge

{/* Generated by scripts/generate_reference.dart; do not edit. */}

## OvokJsBridge [#ovokjsbridge]

```dart
class OvokJsBridge implements JsContract
```

Runs `@ovok/native/next` in an embedded JavaScript engine.

The engine does the contract's work; HTTP and the session store stay in
Dart and are reached through the host channel.

### Constructors [#constructors]

#### OvokJsBridge.new [#ovokjsbridgenew]

```dart
OvokJsBridge({
  required String baseUrl,
  required String tenantCode,
  required OvokSecureStore secureStore,
  String fhirPath = 'fhir',
  Client? httpClient,
  OvokJsBundleLoader? loadBundle,
})
```

Creates a bridge for [`tenantCode`](#ovokjsbridgetenantcode) on the API at [`baseUrl`](#ovokjsbridgebaseurl).

[`secureStore`](#ovokjsbridgesecurestore) must be the store the Dart `Ovok` client uses, so both
sides share one session. `httpClient` replaces the default `http.Client`.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `baseUrl` | `String` | required named |  |
| `tenantCode` | `String` | required named |  |
| `secureStore` | `OvokSecureStore` | required named |  |
| `fhirPath` | `String` | named | `'fhir'` |
| `httpClient` | `Client?` | named |  |
| `loadBundle` | `OvokJsBundleLoader?` | named |  |

### Properties [#properties]

#### OvokJsBridge.baseUrl [#ovokjsbridgebaseurl]

```dart
final String baseUrl
```

Absolute URL of the Ovok API.

#### OvokJsBridge.tenantCode [#ovokjsbridgetenantcode]

```dart
final String tenantCode
```

Code of the tenant the client works in.

#### OvokJsBridge.secureStore [#ovokjsbridgesecurestore]

```dart
final OvokSecureStore secureStore
```

Where the session lives.

#### OvokJsBridge.fhirPath [#ovokjsbridgefhirpath]

```dart
final String fhirPath
```

Path of the FHIR API under [`baseUrl`](#ovokjsbridgebaseurl).

### Methods [#methods]

#### OvokJsBridge.evaluate [#ovokjsbridgeevaluate]

```dart
Future<Object?> evaluate(String name, List<Object?> args)
```

Runs `ovokNative.<name>(...args)` and returns its decoded JSON result.

Throws [`OvokJsException`](/flutter-sdk/reference/ovok_flutter/ovok-js-exception#ovokjsexception) when the JavaScript call fails.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `name` | `String` | positional |  |
| `args` | `List<Object?>` | positional |  |

Returns `Future<Object?>`.

#### OvokJsBridge.dispose [#ovokjsbridgedispose]

```dart
void dispose()
```

Frees the engine.

Returns `void`.


## OvokJsBundleLoader [#ovokjsbundleloader]

```dart
typedef OvokJsBundleLoader = Future<String> Function()
```

Loads the bundle source; the default reads the asset shipped with this package.
