Ultimate Liveliness Detector
A Flutter package for face liveness detection with configurable tasks (Smile, Blink, Motion).
Features
- 👁 Real-time face detection using ML Kit
- 😊 Smile detection
- 👀 Blink detection (accumulative)
- 🔄 Head motion detection
- ⚙️ Fully configurable tasks
- 🎨 Built-in UI with customizable callbacks
Installation
Add to your pubspec.yaml:
dependencies:
ultimate_liveliness_detector: ^1.0.0
Usage
import 'package:ultimate_liveliness_detector/liveness_detection.dart';
// Navigate to the liveness detection screen
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => LivenessDetection(
config: LivenessConfig(
enableSmile: true,
enableBlink: true,
enableMotion: false,
requiredDetections: 10,
requiredBlinks: 3,
showDefaultSuccessScreen: true,
onSuccess: () {
print('Verification successful!');
},
onCancel: () {
Navigator.pop(context);
},
),
),
),
);
Configuration Options
| Property | Type | Default | Description |
|---|---|---|---|
enableSmile |
bool |
true |
Enable smile detection task |
enableBlink |
bool |
true |
Enable blink detection task |
enableMotion |
bool |
true |
Enable head motion task |
requiredDetections |
int |
10 |
Frames needed for smile/motion |
requiredBlinks |
int |
3 |
Blinks needed (accumulative) |
showDefaultSuccessScreen |
bool |
true |
Show built-in success screen |
onSuccess |
VoidCallback? |
null |
Called when verification passes |
onCancel |
VoidCallback? |
null |
Called when user cancels |
Android Setup
Requires native Android code for camera preview and ML Kit integration. See the example project for the complete Android setup.
License
MIT
Libraries
- app
- liveness_detection
- Liveness Detection Package
- main