flutter_biometric_auth 0.0.1 copy "flutter_biometric_auth: ^0.0.1" to clipboard
flutter_biometric_auth: ^0.0.1 copied to clipboard

PlatformiOS

Flutter plugin for Face ID and Touch ID authentication. This plugin uses the LocalAuthentication package to authenticate users with Face ID or Touch ID on iOS

example/lib/main.dart

import 'dart:developer';

import 'package:flutter/material.dart';

import 'package:flutter/services.dart';
import 'package:faceid/faceid.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final _faceidPlugin = Faceid();

  bool _isAuthenticated = false;

  void _authenticate() async {
    try {
      final isAuthenticated = await _faceidPlugin.authenticate();
      setState(() {
        _isAuthenticated = isAuthenticated;
      });
    } on PlatformException catch (e) {
      log('Failed to authenticate: ${e.message}', error: e);
    }
  }

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Column(
            children: [
              InkWell(
                onTap: _authenticate,
                child: const Text('Tap to get access'),
              ),
              _isAuthenticated
                  ? const Text('Authenticated')
                  : const Text('Not authenticated'),
            ],
          ),
        ),
      ),
    );
  }
}
0
likes
160
pub points
27%
popularity

Publisher

unverified uploader

Flutter plugin for Face ID and Touch ID authentication. This plugin uses the LocalAuthentication package to authenticate users with Face ID or Touch ID on iOS

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

flutter, plugin_platform_interface, rename

More

Packages that depend on flutter_biometric_auth