authenticate static method

Future<bool> authenticate({
  1. String reason = 'Please authenticate to proceed',
  2. bool sticky = true,
  3. bool biometricOnly = false,
})

Authenticate the user with biometrics.

reason is the message shown to the user (e.g. "Scan to pay").

Implementation

static Future<bool> authenticate({
  String reason = 'Please authenticate to proceed',
  bool sticky = true,
  bool biometricOnly = false,
}) async {
  try {
    return await _auth.authenticate(
      localizedReason: reason,
      options: AuthenticationOptions(
        stickyAuth: sticky,
        biometricOnly: biometricOnly,
      ),
    );
  } on PlatformException catch (e) {
    // Log error using CleanLogger if available or print
    print('Biometric Error: $e');
    return false;
  }
}