Get started
The SDK requires Dart 3.6 or later. Flutter apps can use ovok_flutter, which re-exports
- Stable unknown
- Release candidate since 0.1.0-rc.1
- Development since 0.1.0-dev+12ee2b8
The SDK requires Dart 3.6 or later. Flutter apps can use ovok_flutter, which re-exports
the same Ovok client from ovok_sdk. Dart-only apps can depend on ovok_sdk alone.
Install
flutter pub add ovok_flutterFor Dart-only applications, add ovok_sdk instead:
dart pub add ovok_sdkDevelopment builds (0.1.0-dev.<N>+<sha7>) and release candidates (0.1.0-rc.<n>)
are pre-releases on pub.dev, so they are never picked by default. Pin one to try it:
flutter pub add "ovok_flutter:0.1.0-dev.<N>+<sha7>"Create a client
The client keeps the session in a secure store you provide. OvokSecureStore has the
same read, write and delete methods as flutter_secure_storage, so an adapter
only forwards them:
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:ovok_flutter/ovok_flutter.dart';
class SecureStore implements OvokSecureStore {
SecureStore(this._storage);
final FlutterSecureStorage _storage;
@override
Future<String?> read({required String key}) => _storage.read(key: key);
@override
Future<void> write({required String key, required String value}) =>
_storage.write(key: key, value: value);
@override
Future<void> delete({required String key}) => _storage.delete(key: key);
}
final ovok = Ovok(
baseUrl: 'https://api.sandbox.ovok.com',
tenantCode: 'your-tenant',
secureStore: SecureStore(const FlutterSecureStorage(
iOptions: IOSOptions(accessibility: KeychainAccessibility.first_unlock),
)),
);first_unlock lets a background launch read the session after the device's first
unlock. A bad option throws OvokConfigException from the constructor, not from the
first request. Every option is described on Ovok in the API reference.
There is no clientSecret: anything shipped inside an app can be extracted, so the
SDK has no machine client.
Sign in and read a resource
final result = await ovok.auth.login(
profileType: ProfileType.practitioner,
email: 'ada@example.com',
password: password,
);
if (result case MfaRequired(:final challenge)) {
await ovok.auth.verifyMfa(challenge, codeFromAuthenticatorApp);
}
final patient = await ovok.fhir.read('Patient', 'patient-id');From here, see Authentication for the rest of the session lifecycle and FHIR and paging for reading and writing data.
Last updated on