Native Dart FFI bindings for the VITURE XR Glasses SDK.
| Platform | Support |
|---|---|
| macOS | ✅ Supported |
| iOS | ❌ Unsupported |
| Linux | ❌ Unsupported |
| Android | ✅ Supported |
| Windows | ✅ Supported |
| Web | ✅ Supported |
| Method / Property | Type | Description |
|---|---|---|
sdkVersion |
String |
Returns the native SDK version string. |
isConnected |
bool |
Indicates whether a persistent connection to the glasses is currently open. |
isHeadTrackingActive |
bool |
Indicates whether IMU data is currently streaming. |
sensorStream |
Stream<VitureSensorData> |
Broadcast stream delivering raw and parsed orientation updates. |
stateStream |
Stream<VitureStateEvent> |
Broadcast stream delivering hardware changes. |
connect({bool setDarwinOpenExclusive = false}) |
Future<void> |
Opens a persistent connection to the glasses, reused by all subsequent calls until disconnect() or dispose() is called. On web, must be called from inside a user-gesture handler (e.g. a button tap). |
disconnect() |
Future<void> |
Closes the persistent connection, stopping head tracking first if active. |
getBrightnessLevel({bool setDarwinOpenExclusive = false}) |
Future<int?> |
Reads the current brightness level from the connected device. |
setBrightnessLevel(int level, {bool setDarwinOpenExclusive = false}) |
Future<void> |
Sets the brightness level for the connected device. |
getVolumeLevel({bool setDarwinOpenExclusive = false}) |
Future<int?> |
Reads the current volume level from the connected device. |
setVolumeLevel(int level, {bool setDarwinOpenExclusive = false}) |
Future<void> |
Sets the volume level for the connected device. |
startHeadTracking({int imuFrequency = VitureImuFrequency.freq120Hz, bool setDarwinOpenExclusive = false}) |
Future<HeadTrackingResponse> |
Starts receiving IMU data on the shared connection. Returns status, message, and code (-7 if glasses not found, 0 if successful). |
releaseHeadTracking() |
Future<void> |
Stops IMU streaming without closing the underlying connection. |
setHeadTrackingEnabled(bool enabled) |
Future<void> |
Convenience toggle for starting or stopping head tracking. |
dispose() |
Future<void> |
Disconnects the device and closes the sensor and state stream controllers. |
| Field | Type | Description |
|---|---|---|
roll, pitch, yaw |
double |
Device orientation in Euler angles. |
quatW, quatX, quatY, quatZ |
double |
Device orientation as a quaternion. |
magX, magY, magZ |
double? |
Magnetometer axes, populated only on magnetometer-capable devices (Luma / Luma Pro / Beast / Pro 2). null on devices without a magnetometer. |
temperature |
double? |
Sensor temperature reading, populated alongside the magnetometer fields. null when unavailable. |
hasMagnetometer |
bool |
Convenience getter indicating whether magX/magY/magZ are present. |
timestamp |
int |
Timestamp associated with the pose sample. |
| Field | Type | Description |
|---|---|---|
status |
bool |
Indicates success or failure |
message |
String |
Status or error description |
code |
int |
Error code |
| Field | Type | Description |
|---|---|---|
stateId |
int |
Identifies which hardware setting changed. |
value |
String |
The new numeric level or status. |
Note
For local dev, use flutter run -d chrome --web-header Cross-Origin-Opener-Policy=same-origin --web-header Cross-Origin-Embedder-Policy=require-corp.
import 'dart:async';
import 'package:viture_kit/viture_kit.dart';
Future<void> main() async {
final viture = VitureKit();
print('VITURE SDK Version: ${VitureKit.sdkVersion}');
// 1. Listen to orientation events
final subscription = viture.sensorStream.listen((VitureSensorData pose) {
print('Roll: ${pose.roll}, Pitch: ${pose.pitch}, Yaw:${pose.yaw}');
print('Quat: [${pose.quatW},${pose.quatX}, ${pose.quatY},${pose.quatZ}]');
});
// 2. Claim ownership of the IMU
try {
final HeadTrackingResponse headTrackingResponse = await viture.startHeadTracking();
if (headTrackingResponse.status == false || headTrackingResponse.code == -7) {
print(headTrackingResponse.message);
return;
}
print('Head tracking started successfully.');
} catch (e) {
print('Failed to start head tracking: $e');
}
final subscription = viture.stateStream.listen((VitureStateEvent event) {
final stateId = VitureStateId.fromId(event.stateId);
print('State: $stateId, Value: ${event.value}');
});
// 3. Stop tracking and clean up
await subscription.cancel();
await viture.releaseHeadTracking();
await viture.dispose();
print('Head tracking released.');
}Important
When the Spacewalker App is open viture_kit will claim ownership of the IMU for head tracking, stopping head tracking on the Spacewalker app.
Notice: This project was initally created to be used in-house, as such the development is first and foremost aligned with the internal requirements.
