Skip to main content

Overview

The Synheart Session Dart SDK provides a stream-based API for running timed biometric sessions. Sessions emit session frames with HR metrics at configurable intervals and deliver a final summary when complete. Frames can optionally include behavioral signal data (typing, scrolling, taps, app switches, idle gaps, stability/fragmentation indices) when a BehaviorProvider is configured. A built-in mock engine lets you develop and test without hardware. Key Features:
  • Stream-based session lifecycle (SessionStarted -> SessionFrame* / BiosignalFrame* -> SessionSummary)
  • Optional behavioral signal fusion via BehaviorProvider (mock or native)
  • Built-in mock engine with deterministic output
  • Apple Watch connectivity with transparent local fallback
  • Configurable session modes, duration, and compute profile

Installation

Add to your pubspec.yaml:
Install dependencies:

Requirements

  • Dart SDK >=3.8.0 <4.0.0
  • Flutter >=3.22.0

Quick Start

Mock Mode (Development)

Native Mode (Production)

In native mode, the SDK automatically routes sessions to Apple Watch when connected. If the watch is not reachable, it falls back to the local engine transparently.

Apple Watch Connectivity

Query watch connectivity status from your Flutter app:
WatchStatus fields:
getWatchStatus() returns null in mock mode and on Android. The watch must be paired, the companion app installed, and the watch app in the foreground for reachable to be true.

Session Configuration

SessionConfig

ComputeProfile

Session Events

All events extend the sealed SessionEvent class and include a sessionId.

SessionStarted

Emitted when the engine begins capturing data.

SessionFrame

Emitted at each emitIntervalSec with computed session metrics.

BiosignalFrame

Emitted at each rawEmitIntervalSec when includeRawSamples is true. Contains raw biosignal samples for live display.
BiosignalSample fields:

SessionSummary

Emitted when the session completes (duration elapsed or stopped manually). Contains aggregate metrics for the full session.

SessionError

Emitted when the session encounters an error. The stream closes after this event.
Error codes:

Behavioral Signals

The SDK supports optional behavioral signal fusion. In mock mode, pass a BehaviorProvider to SynheartSession.mock(). In production mode, behavioral data flows automatically from the native SessionEngine when a BehaviorProvider is configured on the native side.

Mock Mode

Behavioral Fields

When present, the behavior map on SessionFrame and SessionSummary includes:
The behavior key is only present when a BehaviorProvider is configured and returns data. Null optional fields are omitted from the map.

Complete Example

API Reference

SynheartSession

Resources