Skip to content
pubscout

local_auth

3.0.2, released 4 months ago by flutter.dev

Flutter plugin for on‑device authentication using biometrics, PIN, pattern or passcode.

Rock solid
$ flutter pub add local_auth
Source repository

What it does

Provides a unified API to check device authentication capabilities and to prompt the user for biometric or device‑level authentication. It abstracts platform‑specific implementations for Android, iOS, macOS and Windows. Errors are returned as structured LocalAuthException codes.

AI-written summary of version 3.0.2, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need local, on‑device authentication without a backend
  • You want biometric, face, fingerprint or fallback PIN/passcode support across mobile and desktop
  • You require a simple API to check enrollment and authenticate the user

Skip it when

  • Your app targets web platforms
  • You need social or OAuth based sign‑in flows
  • You require server‑side token validation

Strengths

  • Native biometric and device‑level authentication on multiple platforms
  • Fallback to PIN/pattern/passcode when biometrics unavailable
  • Clear error handling with LocalAuthException codes
  • Simple, synchronous‑style API

Weaknesses

  • No web support
  • Requires native setup and permissions per platform
  • Windows cannot enforce biometric‑only authentication

Setup

Kind
Plugin (native code)
Effort
Medium
Code generation
No
Direct dependencies
4

Add local_auth and platform packages to pubspec, configure Android manifest (USE_BIOMETRIC permission), iOS Info.plist (NSFaceIDUsageDescription), and follow platform‑specific README links for additional steps.

import 'package:local_auth/local_auth.dart';

final LocalAuthentication auth = LocalAuthentication();
final bool canAuth = await auth.canCheckBiometrics || await auth.isDeviceSupported();
if (canAuth) {
  final bool didAuth = await auth.authenticate(
    localizedReason: 'Please authenticate to continue',
    biometricOnly: true,
  );
  // proceed based on didAuth
}

Alternatives

Packages that do the same job and could replace local_auth.

  • google_sign_in

    Provides Google OAuth sign‑in and works on web as well as mobile

  • firebase_auth

    Offers a full suite of authentication methods (email/password, social, anonymous) with server‑side token handling

Works with

Packages commonly used together with local_auth: ones it builds on, ones built on it, and its own family.