Sitemap

Biometric Login in Flutter

2 min readAug 24, 2026

--

Press enter or click to view image in full size

A complete guide to implementing secure Face ID and fingerprint authentication in Flutter using the local_auth package.

Step 1: Add local_auth

Step 2: Configuration

Android Setup

Get Ritik’s stories in your inbox

Join Medium for free to get updates from this writer.

Update MainActivity.kt

import io.flutter.embedding.android.FlutterActivity X remove
import io.flutter.embedding.android.FlutterFragmentActivity +add…..

class MainActivity: FlutterActivity() X remove
class MainActivity: FlutterFragmentActivity() + add…..
{
}

Add this permission in manifest.xml file

<!-- Biometric Authentication Permission Start -->
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
<!-- Biometric Authentication Permission End -->

update android/app/src/main/res/values/styles.xml

 <style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar"> X remove 
<style name="LaunchTheme" parent="Theme.AppCompat.DayNight"> + add….

<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar"> X remove
<style name="NormalTheme" parent="Theme.AppCompat.DayNight"> + add…

IOS Setup

To support Face ID on iOS devices, you must add an NSFaceIDUsageDescription entry to your Info.plist file:


NSFaceIDUsageDescription
Explain why your app needs Face ID access here.

Source Code

class BiometricService {
static final LocalAuthentication localAuth = LocalAuthentication();



static Future<bool> authenticateLocally() async {
bool isAuthenticate = false;
try {
isAuthenticate = await localAuth.authenticate(
localizedReason: 'We need to authenticate for using this app',
options: const AuthenticationOptions(
stickyAuth: true,
biometricOnly: true,
sensitiveTransaction: false,
useErrorDialogs: true));
} catch (e) {
AppSnackbar.showSnackBar(message: e.toString());
}
return isAuthenticate;
}


static Future<void> checkBiometrics() async {
try {
final bool canCheck = await localAuth.canCheckBiometrics;
final bool isSupported = await localAuth.isDeviceSupported();

final List<BiometricType> biometrics =
await localAuth.getAvailableBiometrics();

debugPrint('================================');
debugPrint('canCheckBiometrics: $canCheck');
debugPrint('isDeviceSupported: $isSupported');
debugPrint('availableBiometrics: $biometrics');
debugPrint('================================');
} catch (e) {
debugPrint('Biometric error: $e');
}
}
}

--

--

Ritik
Ritik

Written by Ritik

App Developer || Flutter || Dart