Mu Biometric Auth

A highly customizable, responsive, and premium biometric authentication package for Flutter. Supports Fingerprint, FaceID, and TouchID on both Android and iOS with glassmorphic UI and smooth animations.

Pub Version Pub Points License: MIT

A premium, highly customizable, and fully responsive biometric authentication package for Flutter. Built for developers who want a wow factor and a seamless security experience on both Android and iOS.


Features

  • Premium UI: Stunning glassmorphic design out of the box.
  • Fully Responsive: Adapts perfectly to all screen sizes using flutter_screenutil.
  • Highly Customizable: Change gradients, blur, icons, text styles, and more.
  • Lottie Support: Easily integrate high-quality animations.
  • Robust Logic: Simplified wrapper around local_auth with built-in error handling.
  • Easy to Use: Open the entire prompt with just one line of code.

Getting Started

1. Installation

Add this to your pubspec.yaml:

dependencies:
  mu_biometric_auth: ^0.0.3

2. Platform Setup

Android

  1. Add permissions to android/app/src/main/AndroidManifest.xml:
    <uses-permission android:name="android.permission.USE_BIOMETRIC"/>
    
  2. Update MainActivity.kt to inherit from FlutterFragmentActivity:
    import io.flutter.embedding.android.FlutterFragmentActivity
    
    class MainActivity: FlutterFragmentActivity()
    

iOS

Add this to your ios/Runner/Info.plist:

<key>NSFaceIDUsageDescription</key>
<string>We use Face ID to securely authenticate you and unlock the app.</string>

Usage

Quick Trigger (Direct Auth)

import 'package:mu_biometric_auth/mu_biometric_auth.dart';

void _login() async {
  final success = await BiometricService.instance.authenticate(
    reason: 'Please authenticate to continue',
  );
  
  if (success) {
    // Authenticated!
  }
}

Premium Glassmorphic Prompt

MuBiometricPrompt.show(
  context,
  title: 'Secure Access',
  description: 'Use your biometrics to unlock the premium dashboard.',
  reason: 'Account security verification',
  gradientColors: [Color(0xFF8E2DE2), Color(0xFF4A00E0)],
  onAuthenticated: () {
    print('Welcome back!');
  },
  onError: (error) {
    print('Auth failed: $error');
  },
);

Customization Options

Property Description Default
title The main header text 'Secure Access'
description Subtext explaining why auth is needed 'Authenticate to continue'
reason The reason displayed by the OS prompt required
gradientColors Colors for the primary button and icons Purple, Blue
blurIntensity Intensity of the background blur 10.0
lottieAsset Path to a custom Lottie animation null
customIcon Custom IconData if Lottie is not used fingerprint

License

MIT License.

Libraries

mu_biometric_auth
A premium, highly customizable biometric authentication package for Flutter. Supports fingerprint, FaceID, and TouchID on both Android and iOS.