flutter_smkit 1.0.2
flutter_smkit: ^1.0.2 copied to clipboard
Flutter plugin for Sency SMKit (no-UI) — session/detection lifecycle and data streams for custom UI.
smkit #
SMKit Flutter Plugin (v1.0.0)
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 |
|---|---|
| ✅ 16.0+ | ✅ API 26+ |
Installation #
Add to your pubspec.yaml:
dependencies:
flutter_smkit: ^1.0.0
iOS setup #
Add SMKit (and SMBase) to your iOS app. The recommended way is via Swift Package Manager in Xcode — see smkit-ios-demo for reference.
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") }
}
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');
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}) |
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.