Skip to content

Localization

The texts of the native prompt are set with a LocalizationModel. Set it once, for example when your widget is created, and again whenever the language of your app changes. The latest model is used for every following prompt.

import 'package:flutter_local_authentication/localization_model.dart';

auth.setLocalizationModel(
  LocalizationModel(
    promptDialogTitle: 'Unlock your vault',
    promptDialogReason: 'Confirm that it is you',
    cancelButtonTitle: 'Cancel',
  ),
);

Where each text is shown

Field Android iOS / macOS Windows Linux
promptDialogTitle Title of the prompt Not used, the system sets the title Not used —
promptDialogReason Subtitle of the prompt Reason shown in the prompt Message shown in the prompt —
cancelButtonTitle Negative button1 Cancel button System-provided cancel action —

1 Android does not show a negative button when the device credential is an allowed authenticator (biometricsOrDeviceCredential and deviceCredentialOnly). The system provides its own way to cancel.

Defaults

Without a model the prompt uses the title "Biometric Prompt" (Android), the reason "Validate that you have access to this device." and the cancel button "Cancel".

Android needs a title

Android rejects a prompt with an empty title, and an empty negative button when that button is shown. Always give promptDialogTitle and cancelButtonTitle a text.

Face ID

On iOS the text of the Face ID permission alert comes from NSFaceIDUsageDescription in your Info.plist, not from the model. Localize it with an InfoPlist.strings file.