flutter_face_guide is a Flutter package for building guided face-capture flows
for onboarding and KYC-style experiences.
The package provides state orchestration and quality gating. It does not handle biometric identity verification or anti-fraud decisions.
This package exists to solve a common product gap in selfie capture UX:
- inconsistent guidance behavior across screens and apps
- weak capture validation before users submit an image
- UI and state logic tightly coupled and hard to test
flutter_face_guide separates these concerns into composable primitives:
- capture flow state machine via
FaceGuideController - quality policies via
FaceGuideConfig - quality evaluation via
FaceQualityChecker - standardized result model via
FaceCaptureResult
- lifecycle API:
start,pause,resume,stop,capture - explicit status transitions (
idle,aligning,ready,capturing, etc.) - configurable quality thresholds (
brightness,sharpness,faceCenterRatio) - optional challenge hold step before capture
- stream-based state updates for UI synchronization
- biometric identity matching
- enterprise liveness detection
- replacing server-side fraud and compliance systems
Add the dependency:
dependencies:
flutter_face_guide: ^0.1.0Install packages:
flutter pub getimport 'package:flutter_face_guide/flutter_face_guide.dart';
final controller = FaceGuideController(
config: const FaceGuideConfig(
enableChallenge: true,
minBrightness: 0.20,
minSharpness: 0.03,
minFaceCenterRatio: 0.20,
),
);
await controller.start();
controller.updateQuality(
const QualityInput(
brightness: 0.82,
sharpness: 0.79,
faceCenterRatio: 0.90,
),
);
final result = await controller.capture();
if (result.ok) {
// Continue your flow.
}See the runnable integration in example/lib/main.dart.
This package is intentionally detector-agnostic. If you want built-in ML Kit face detection integration, use the optional adapter package:
adapters/flutter_face_guide_mlkit
Adapter dependency example:
dependencies:
flutter_face_guide: ^0.1.0
flutter_face_guide_mlkit:
path: ../adapters/flutter_face_guide_mlkitAdapter usage example:
import 'package:flutter_face_guide/flutter_face_guide.dart';
import 'package:flutter_face_guide_mlkit/flutter_face_guide_mlkit.dart';
final adapter = MlKitFaceGuideAdapter();
final analysis = await adapter.analyze(
image: inputImage,
frameWidth: frameWidth,
frameHeight: frameHeight,
);
controller.updateQuality(
analysis.toQualityInput(
brightness: brightnessScore,
sharpness: sharpnessScore,
),
);Core flow:
- App calls
start()to enter alignment mode. - App feeds metrics to
updateQuality(QualityInput). - Controller emits
FaceGuideStateupdates onstatestream. - When quality passes, status becomes
ready. - App calls
capture()and receivesFaceCaptureResult.
Quality contract:
brightness: normalized 0.0 to 1.0sharpness: normalized 0.0 to 1.0faceCenterRatio: normalized 0.0 to 1.0 (higher means more centered)
FaceGuideController: state and capture orchestratorFaceGuideConfig: threshold and challenge policyQualityInput: input metrics modelFaceQualityReport: evaluation output and issue listFaceCaptureResult: final capture outcome model
- Thresholds are product and device dependent. Tune in your own environment.
- For real-time camera use, compute brightness and sharpness externally and pass
them through
QualityInput. - The optional ML Kit adapter computes face-center ratio from detected face boxes.
- Keep user messaging clear: this package provides guidance, not identity proof.
dart format .flutter analyzeflutter testdart pub publish --dry-run