A complete, production-ready Flutter application built to demonstrate the full capabilities of the flutter_face_liveness (v3.6.0) package.
This project serves as a practical, real-world reference implementation. It shows developers exactly how to wire up the flutter_face_liveness package into a beautifully structured, fully responsive app using modern Flutter architectural patterns.
This app isn't just a simple demo—it's a comprehensive testing sandbox for the flutter_face_liveness package. By running this app, you can test and interact with the following package features directly from the UI:
See how to use the underlying LivenessController for purely customized UI experiences.
- Quick Scan: A custom screen that detects a face and holds it for 1 second (pure presence detection) without requiring any blinks or smiles.
- Live Monitor: A custom screen that continuously streams the camera and triggers a red "No face detected" warning banner the moment the user steps out of frame.
Test how the package handles different verification challenges to ensure a live human is in front of the camera:
- Quick Check: Lowest friction (Blink only).
- Standard Verification: Blink · Turn Left · Turn Right.
- Extended Challenge: Blink · Look Up · Look Down · Smile.
- Full Challenge: All 7 supported actions including Open Mouth.
Test the package's local, offline Face Recognition pipeline. The app lets you toggle between ML Kit, YOLOv8, and SCRFD detector backends on the fly.
- Auto Mode: Matches known faces, automatically registers new ones.
- Registration Only: Strict one-time enrollment that rejects duplicate/already registered faces.
- Verification Only: Secure login flow that only accepts previously registered faces and never registers unknowns.
- (Includes a UI card to view all currently registered Face ID strings and a button to clear the local database).
Test the package's robust security models designed to defeat presentation attacks:
- TFLite Deepfake Detection: Leverages a lightweight
FaceAntiSpoofingmodel to catch printed photos or screen playbacks. - 8-Signal Video Replay Detection: Uses MiniFASNet-V2 combined with pure-Dart heuristic signals to specifically catch video replay attacks.
- Maximum Protection: Run Liveness Actions + Face ID + Deepfake Detection + Video Replay all at the exact same time.
See how the package can automatically evaluate frame quality during the session and extract a perfectly cropped, upright, high-quality JPEG of the user's face upon a successful verification.
- State Management & Routing:
get(GetX) for clean, imperative routing. - Responsive UI:
flutter_screenutil_plusfor pixel-perfect scaling across phones and tablets without hardcoded dimensions. - Camera Permissions:
permission_handler. - Architecture: Clean, modular structure separating resources (themes, strings, colors), routes, services, and UI components.
lib/
┣ resources/
┃ ┣ app_colors.dart # Centralized color palette
┃ ┣ app_theme.dart # ThemeData configurations
┃ ┣ m_strings.dart # All user-facing text/constants
┃ ┗ res.dart # Asset paths (e.g., logos)
┣ routes/
┃ ┗ app_routes.dart # GetX Route definitions
┣ screens/
┃ ┣ home_screen.dart # Main menu & feature toggles
┃ ┣ live_monitor_screen.dart
┃ ┣ liveness_screen.dart # Core flutter_face_liveness wrapper
┃ ┣ quick_scan_screen.dart
┃ ┗ splash_screen.dart # Animated logo entrance
┣ service/
┃ ┗ app_initializer.dart # Startup configuration block
┣ widgets/
┃ ┗ test_tile.dart # Reusable UI components
┗ main.dart # App bootstrap
- Flutter SDK (^3.12.2 or higher)
- Dart 3.4+ compatible environment
-
Clone the repository:
git clone https://github.com/yourusername/facelive.git cd facelive -
Install dependencies:
flutter pub get
Note: This project includes a specific
dependency_overridefortflite_flutterpulling from GitHubmainto ensure compatibility with Dart 3.4+, as required by the liveness package. -
Run the app:
flutter run
Contributions, issues, and feature requests are welcome! Feel free to check the issues page.
This project is open-source and available under the MIT License.