๐Ÿ›ก๏ธ Simple Local Auth

A lightweight and developer-friendly Flutter plugin to authenticate users using local biometric methods such as Fingerprint, Face ID, and other platform-specific mechanisms.

โœจ Features

  • Check biometric hardware availability
  • Detect enrolled biometrics
  • Support for Fingerprint and Face ID
  • Simple API to trigger biometric authentication
  • Smooth integration for Android and iOS

๐Ÿ“ฆ Installation

Add the package to your pubspec.yaml:

dependencies:
  simple_local_auth: ^1.0.0

Then run:

flutter pub get

โš™๏ธ Platform Setup

Android

  1. Update your android/app/build.gradle:
minSdkVersion 23
  1. Add permissions to AndroidManifest.xml (usually not required, but ensure biometric support is enabled):
<uses-permission android:name="android.permission.USE_BIOMETRIC"/>
<uses-permission android:name="android.permission.USE_FINGERPRINT"/>

iOS

  1. Add the following to your Info.plist:
<key>NSFaceIDUsageDescription</key>
<string>This app uses Face ID to authenticate the user</string>
  1. Ensure your app has a Deployment Target of iOS 11.0+ in ios/Podfile.

๐Ÿš€ Getting Started

Import the package

import 'package:simple_local_auth/simple_local_auth.dart';
import 'package:simple_local_auth/models/auth_results.dart';

Check Biometric Availability

final availability = await SimpleLocalAuth.getAvailabilityDetails();
if (availability.hasHardware && availability.hasEnrolledBiometrics) {
  // Safe to prompt for authentication
}

Authenticate User

final result = await SimpleLocalAuth.authenticate(
  reason: 'Please authenticate to proceed',
  cancelButton: 'Cancel',
);

if (result.success) {
  // Authentication successful
} else {
  // Handle failure
}

๐Ÿงช Example App

A full-featured example is included in the example/ directory.

Run it:

cd example
flutter run

The app shows:

  • Biometric availability
  • Authentication status
  • Feedback on success/failure

๐Ÿ“ท UI Preview

โœ… Capabilities Checked

  • Hardware Availability โœ…
  • Biometrics Enrolled โœ…
  • Fingerprint Support โœ…
  • Face ID Support โœ…

๐Ÿ“Œ Notes

  • On some Android devices, users must manually enroll biometrics.
  • On iOS, make sure Face ID/Touch ID is configured in device settings.

๐Ÿค Contributing

Contributions are welcome! To contribute:

  1. Fork the repository
  2. Create a new branch
  3. Submit a pull request with a clear description

๐Ÿ“„ License

MIT License


Built with โค๏ธ by [Tamremariam Belete].


simple_local_auth/ โ”œโ”€โ”€ lib/ โ”‚ โ”œโ”€โ”€ simple_local_auth.dart # Main export file โ”‚ โ”œโ”€โ”€ models/ โ”‚ โ”‚ โ”œโ”€โ”€ auth_results.dart โ”‚ โ”‚ โ”œโ”€โ”€ biometric_availability.dart โ”‚ โ”œโ”€โ”€ exceptions/ โ”‚ โ”‚ โ”œโ”€โ”€ auth_exceptions.dart โ”‚ โ”œโ”€โ”€ src/ โ”‚ โ”‚ โ”œโ”€โ”€ simple_local_auth_impl.dart # Implementation โ”‚ โ”‚ โ”œโ”€โ”€ types.dart # Enums and types