availableBiometricsToolEntry function

DeveloperToolEntry availableBiometricsToolEntry({
  1. String? sectionLabel,
})

A DeveloperToolEntry that shows a detailed list of all biometric types currently enrolled on the device.

Each biometric type is shown with its icon, human-readable name, enum value, and a brief description of what it represents. Useful for verifying which biometric methods are available for authentication on the current device.

Implementation

DeveloperToolEntry availableBiometricsToolEntry({String? sectionLabel}) {
  return DeveloperToolEntry(
    title: 'Available Biometrics',
    sectionLabel: sectionLabel,
    description: 'View detailed list of enrolled biometric types',
    icon: Icons.security,
    debugInfo: (BuildContext context) async {
      try {
        final auth = LocalAuthentication();
        final biometrics = await auth.getAvailableBiometrics();
        if (biometrics.isEmpty) return 'No biometrics enrolled.';
        return 'Enrolled: ${biometrics.map((b) => b.name).join(", ")}';
      } catch (e) {
        return 'Error checking biometrics: $e';
      }
    },
    onTap: (BuildContext context) async {
      await showDialog<void>(
        context: context,
        builder: (BuildContext dialogContext) {
          return const _AvailableBiometricsDialog();
        },
      );
    },
  );
}