Get started with the Flutter SDK

Install ovok_flutter, connect to the sandbox, sign in, and make a first request.

Install

The SDK needs Dart 3.6 or later.

flutter pub add ovok_flutter

For a Dart-only app, run dart pub add ovok_sdk instead.

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()),
);

Sign in

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);
}

Make a first request

final patient = await ovok.fhir.read('Patient', 'patient-id');

Next: full Flutter SDK docs.

Last updated on

On this page