Biometric Unlock

Loading preview

Starting the Flutter app

A Flutter biometric unlock screen with Face ID and fingerprint prompts and a passcode fallback.

Get the source

Add it to your project

Copies the Dart source into your app, so you own it. Flutter SDK only, no extra packages.

First time? Run dart pub global activate fluttertemplates_dev, or read the CLI guide.

How it works

Nothing touches a biometric API. _scan sets _scanning, waits 1200 ms with Future.delayed, then always succeeds by setting _unlocked, so no failure state exists. The AnimatedContainer ring and status Text react to those two booleans, and taps are ignored while scanning or once unlocked. ‘Use passcode instead’ calls onUsePasscode, or shows a demo SnackBar without it.

Adapting it

  • Replace the delay in _scan with LocalAuthentication().authenticate() from local_auth, plus that package’s platform setup.
  • Add an error flag beside _unlocked for failed or cancelled attempts.
  • Navigate away on success instead of stopping at Icons.lock_open_rounded, and point onUsePasscode at your PIN screen.