A simple Flutter application that showcases the biometric authentication process. This app demonstrates how to implement biometric authentication using the device's built-in capabilities.
- Flutter
- Dart
- Implements biometric authentication (fingerprint and facial recognition).
- Provides a user-friendly interface to demonstrate the authentication process.
To run the project locally, follow these steps:
-
Clone the repository:
git clone https://github.com/your-username/biometric-authentication.git cd biometric-authentication -
Install dependencies:
flutter pub get
-
Set up Android files:
Update your
MainActivity.ktfile located atandroid/app/src/main/kotlin/com/example/password_manager/MainActivity.kt:package com.example.password_manager import io.flutter.embedding.android.FlutterFragmentActivity class MainActivity: FlutterFragmentActivity() { // ... }
Update your
AndroidManifest.xmllocated atandroid/app/src/main/AndroidManifest.xml:<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.password_manager"> <uses-permission android:name="android.permission.USE_BIOMETRIC"/> <application android:label="password_manager" android:name="${applicationName}" android:icon="@mipmap/ic_launcher"> <!-- Other configurations --> </application> </manifest>
-
Run the app:
flutter run
lib/
├── service/
│ └── local_auth.dart # Service for handling biometric authentication
├── widgets/
│ ├── button.dart # Custom button widget
│ ├── icon_button.dart # Custom icon button widget
│ └── textfield.dart # Custom text field widget
├── auth.dart # Authentication logic
└── main.dart # Entry point of the application
└── pubspec.yaml # Project configuration and dependenciesThe app uses the Local Authentication Plugin to access biometric sensors like fingerprint or face ID. Upon launching the app, users can tap a button to initiate biometric authentication. If the device supports biometrics and the user has registered their biometrics (e.g., fingerprint), the app prompts the user to authenticate.
If the authentication is successful, a success message is displayed.
If the authentication fails, an error message is shown.
Make sure biometric authentication is enabled on your device:
Android: Go to Settings > Security > Fingerprint/Face Unlock to enable biometrics.
iOS: Go to Settings > Face ID & Passcode or Settings > Touch ID & Passcode.

