flutterdartandroid-fingerprint-api

Is there a way in flutter to wait for fingerprint input


What I want to do is have a lock screen that is always listening for a fingerprint and which then switches page, and I am not sure how to implement this. I have tried around and found it it is easy to just have a button and then call a function with that button that checks for fingerprints.

My question basically is if I can constantly wait for the fingerprint sensor to be activated, and then automatically switches pages without anything else being done.

Edit: If possible, it would be great if I would not need a popup. Now, i call the fingerprint with

try {
  didAuthenticate = await _localAuthentication.authenticateWithBiometrics(
      localizedReason: 'Please authenticate to show account balance',
      useErrorDialogs: false);
} catch (e) {
  print(e);
}
if (!mounted) return;
if (didAuthenticate = true) {
  Navigator.pushReplacement(
    context,
    MaterialPageRoute(builder: (context) => MenuAppPage()),
  );
}

On https://pub.dev/packages/local_auth I didn't find another way to do this, so if anyone has any hints, that'd be great


Solution

  • You have two options: 1. Call LocalAuth or Touch_Method in init(). 2. You can use timer function to call LocalAuth function.