Prerequisites
- An iPhone on iOS 15 or later, or an Android 9 (API 28) or later phone. Simulators and emulators cannot take a reading.
- Flutter 3.35 or newer and Android
minSdk28. - Xcode 27 or newer, which needs the UIScene life cycle (Requirements).
- From NEUROFIT: a license key and a download token. The key lists every bundle identifier you run, development ones included (Debug builds).
- The pre-built flow ships in English (localize it).
Install
pubspec.yaml
flutter pub get. The plugin supports both Swift Package Manager and CocoaPods, so it builds with whichever
your app uses, with nothing to configure. Before Flutter 3.41, keep Swift Package Manager off (the default there),
and the plugin installs with CocoaPods. Set the iOS deployment target to 15.0 or later (in ios/Podfile too
when your app uses CocoaPods) and minSdk = 28 in android/app/build.gradle.kts. The package carries both native
SDKs, so iOS and Android need no further repository. On CI, see Download token.
Offline builds, your own repository or a source license: Install from source or manually.
Camera usage
Add the two keys from the iOS quickstart toios/Runner/Info.plist. Android needs
nothing: the plugin’s manifest declares CAMERA.
Activate
Pass the key at build time, from a file you keep out of git (--dart-define-from-file).
activate throws licenseInvalid with a reason (reasons and fixes). An
Android debug build also accepts a key that does not list your app id, then returns a warning in warnings and
prints it in flutter run, because release builds refuse that key (Debug builds).
Option A: pre-built reading flow
onComplete, onCancel, onError fires when the user leaves the flow
(callbacks and options). It locks portrait on Android. On iOS, restrict your app’s
orientations (Orientation and screen).
Option B: your own screens
Ask for camera access, subscribe to events, then callstart()
(Starting a session).
reading_controller.dart
VitalsCameraPreview and start once it is ready
(Camera preview rules):
dispose(), which calls stop(), when the screen goes away. Lock portrait and keep the
screen on (Orientation and screen). Every event:
Reading lifecycle.