For the complete documentation index, see llms.txt. This page is also available as Markdown.

Flutter

Connection

enum Connection {
  ble,          // Bluetooth Low Energy
  apple,        // iPhone's built-in sensors (iOS only)
  wearOs,       // Wear OS watches (Android only)
  android,      // Phone's built-in sensors (Android only)
  ant,          // ANT+ protocol (Android only)
  watchOs,      // Apple Watch via WatchConnectivity (iOS only)
  allDevices,   // Combined BLE + ANT scanning (Android only)
}

Platform availability:

Value
iOS
Android

ble

Yes

Yes

apple

Yes

No

watchOs

Yes

No

wearOs

No

Yes

android

No

Yes

ant

No

Yes

allDevices

No (maps to ble)

Yes

DataType

Types

Update

Data points delivered via streaming callbacks.

Device

Callbacks


Initialization

init

Creates and authenticates the RT SDK instance. Makes a network call.

  • devId ➡ Your developer ID.

  • referenceId ➡ Optional user identifier in your system.

initConnection

Authenticates the SDK user. Makes a network call. Token should be generated server-side.

getUserId

Returns the Terra user ID, or null if not initialized.

disconnect

Disconnects from the given connection type.

Device Scanning

startDeviceScan

Starts scanning with the built-in UI. On iOS, this renders a native SwiftUI BLE scanner view (use the iOSScanView widget). On Android, this uses the native device picker.

  • connection ➡ The connection type to scan for.

  • useCache ➡ Reconnect to a previously paired device if available.

  • connectionCallback ➡ Optional callback fired when a device connection changes.

startDeviceScanToCallback

Starts scanning and delivers discovered devices via deviceCallback. Use connectDevice() to connect to a chosen device.

connectDevice

Connects to a specific Device discovered via startDeviceScanToCallback.

iOSScanView (iOS only)

A Flutter widget that embeds the native iOS BLE scanner UI. Renders an empty Container on non-iOS platforms.

Usage:

Data Streaming

startRealtimeToServer

Streams data to Terra's websocket server. Data is sent to the server but not delivered locally.

startRealtimeToApp

Streams data to a local callback only. No server connection.

stopRealtime

Stops streaming for the given connection type.

WatchOS (iOS only)

These methods return false on Android.

connectWatchOS

Establishes a WatchConnectivity session with the paired Apple Watch.

resumeWatchOSWorkout

Resumes a paused workout on the Apple Watch.

pauseWatchOSWorkout

Pauses the current workout on the Apple Watch.

stopWatchOSWorkout

Stops the current workout on the Apple Watch.

Last updated

Was this helpful?