kamera-flutter
usesmileid_kamera, the Flutter wrapper for kamera. It embeds the two native cores rather than
reimplementing them, and it depends on no third-party camera plugin. It replaced the camera
plugin in the Smile ID Flutter SDK.
In production: 1.0.6 in the Smile ID v12 Flutter SDK (12.1.1).
How it works
- The control plane is Pigeon (
pigeons/kamera_api.dart, generated code committed and drift-gated): configuration, lifecycle, capture and controls. Events (session state, analysis results, metrics, errors) come over one event channel, which every Dart listener shares. - Preview: a
Texturefed by the Android core'sSurfaceTexture, counter-rotated and cover-fit in Dart; on iOS, aUiKitViewhosting the native preview layer, which is GPU-composited and copy-free. - Pixels never cross the bridge. Frames go to
KameraFrameHubnatively, where the host SDK's analyzers take them. Dart receives results and file paths only. - One native session per engine. Every Dart
KameraSessiondrives it, so the one that calledstart()last owns the camera, and astop()orrelease()from a superseded session does nothing (SPEC.md §6.3). - iOS is SPM-only: the glue is a Swift package that pins kamera-spm exactly (docs/design/18).
The Android glue defaults to the ML Kit adapter:
-PkameraMlBackend=huaweiswitches it to HMS, andnoneadds no adapter.
Layout
lib/ Dart API: KameraSession, KameraPreviewView, KameraConfig, events
pigeons/ The Pigeon schema
android/ Kotlin glue over kamera-android
ios/ Swift package glue over kamera-spm
sample/ The Kamera Lab (docs/design/36, 37)
The replay kit is the separate usesmileid_kamera_testing package
(../kamera-flutter-testing).
Build and test
cd kamera-flutter
flutter analyze && flutter test
cd sample && flutter build apk --release # the Lab; install it with adb install -r -g
Against locally built cores: ../docs/local-dev.md.
Requirements
Dart ^3.11 · Flutter stable · Android minSdk 24 · iOS 15.0, the production Smile ID Flutter SDK's floors.
Libraries
- usesmileid_kamera
- kamera — Smile ID's purpose-built camera SDK (Flutter surface).