smkit

SMKit Flutter Plugin (v1.0.5)

Flutter plugin for Sency SMKit (no-UI) — session/detection lifecycle and data streams so you can build your own UI on top of Sency's body-tracking engine.

Platform support

iOS Android
✅ 17.2+ ✅ API 26+

Installation

Add to your pubspec.yaml:

dependencies:
  flutter_smkit: ^1.0.5

iOS setup

Add SMKit (and SMBase) to your iOS app with CocoaPods:

source 'https://bitbucket.org/sencyai/ios_sdks_release.git'

target 'Runner' do
  pod 'SMKit', '1.8.3'
end

Add camera usage description to ios/Runner/Info.plist:

<key>NSCameraUsageDescription</key>
<string>Camera is required for motion analysis.</string>

Android setup

SMKit for Android is distributed as an AAR via a Maven repository. Add the following to your app-level android/build.gradle:

repositories {
    maven { url = uri("https://your-maven-repo/smkit") }
}

This plugin currently targets com.sency.smkit:smkit:1.6.4 and com.sency.smbase.nativeclient:smbase-native-client:1.6.4.

Ensure minSdkVersion is at least 26 and camera permission is declared in AndroidManifest.xml:

<uses-permission android:name="android.permission.CAMERA" />

Usage

1. Configure the SDK

Call once before starting a session (e.g. in main() or app init):

await SmKit.configure(
  authKey: 'YOUR_AUTH_KEY',
  poseModelChoice: SmKitPoseModelChoice.adaptiveChoice,
);

Available Android pose choices: adaptiveChoice, prime, pro, lite, ultraLite, basic. On iOS this parameter is accepted for API parity and currently ignored.

2. Add the camera view

final int viewId = 1;

SmKitCameraView(viewId: viewId)

3. Start a session

await SmKit.startSession(
  viewId: viewId,
  settings: SessionSettings(/* ... */),
);

4. Listen to events

SmKit.sessionEventStream.listen((event) {
  switch (event.type) {
    case SmKitSessionEventType.captureSessionReady:
      // Camera is ready — you can start detection
      break;
    case SmKitSessionEventType.detectionData:
      final rep = event.repData;
      // handle rep data
      break;
    case SmKitSessionEventType.staticData:
      final pos = event.staticData;
      // handle static position data
      break;
    case SmKitSessionEventType.bodyCalibration:
      final cal = event.bodyCalibrationData;
      // handle calibration (bounding box, in-frame status, etc.)
      break;
    case SmKitSessionEventType.sessionError:
      final err = event.sessionError;
      break;
    default:
      break;
  }
});

5. Start / stop detection

final info = await SmKit.startDetection(exercise: 'SquatRegular');
// ... user performs exercise ...
final result = await SmKit.stopDetection();

6. Stop session

final sessionResult = await SmKit.stopSession();

API reference

Method Description
SmKit.configure({authKey, support3D, poseModelChoice}) One-time SDK authentication and configuration
SmKit.startSession({viewId, settings}) Start camera and detection session
SmKit.stopSession() Stop session and return DetectionSessionResultData
SmKit.stopCamera() Stop camera without ending the session
SmKit.startDetection({exercise, configString}) Begin exercise detection
SmKit.stopDetection() Stop detection and return SMExerciseInfo
SmKit.setFeedbacksToExclude(feedbacks) Exclude specific feedback types
SmKit.setConfigString(configString) Set config outside of detection
SmKit.sessionEventStream Stream<SmKitSessionEvent> of all session events

See the example/ app for a complete assessment and session flow.

License

MIT — see LICENSE.

Libraries

flutter_smkit
smkit