biometric_auth_package

Features

User can able to authenticate with biometric on android and ios application

Getting started

Local Auth wall redirect user to a widget when authenticated and another if not.

Usage

class _MyHomePageState extends State

@override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Biometric Authentication Demo'), ), body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children:

            print("authenticated");
            print(authenticated);
            if (authenticated) {
              // User successfully authenticated
            } else {
              // Authentication failed
            }
          },
          child: Text('Authenticate with Biometrics'),
        ),
        SizedBox(height: 20),
        // FutureBuilder<List<BiometricType>>(
        //   future: biometricAuth.getAvailableBiometrics(),
        //   builder: (context, snapshot) {
        //     if (snapshot.connectionState == ConnectionState.waiting) {
        //       return CircularProgressIndicator();
        //     } else if (snapshot.hasData) {
        //       // Display available biometric types
        //       List<BiometricType> availableBiometrics = snapshot.data!;
        //       return Text('Available biometrics: $availableBiometrics');
        //     } else {
        //       return Text('Unable to fetch available biometrics');
        //     }
        //   },
        // ),
      ],
    ),
  ),
);

} }

Additional information

In this example we use MaterialApp.builder to encapsulate all app routes bellow our ChangeNotifierProvider, so anytime its possible to call context.read

However, you can use LocalAuthWall in any place, with the limitation that only widgets bellow will be able to call context.read