biometric_auth 0.1.2

  • Readme
  • Changelog
  • Installing
  • new69

biometric_auth #

This package provides a stateful widget to perform local, on-device authentication of the user referring to biometric authentication on iOS (Touch ID or lock code) and the fingerprint APIs on Android (introduced in Android 6.0).

Getting Started #

To use this widget, add biometric_auth as a dependency in your pubspec.yaml file.

The widget implementation uses the StatefulWidget named BiometricWidget which receives a title which gets displayed on the dialog of the native biometric interface when popped up.

Checkout the sample below for usage of the widget.

Example #

import 'package:flutter/material.dart';
import 'package:biometric_auth/biometric_auth.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return BiometricWidget(
      title: "Confirm your Fingerprint now",
      child: MaterialApp(
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Fingerprint Authentication'),
    )
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {

  @override
  Widget build(BuildContext context) {
    var biometric = BiometricWidget.of(context);
    bool hasFingerPrintSupport = biometric.hasFingerPrintSupport;
    String authorizedOrNot = biometric.authorizedOrNot;
    var availableBiometricType = biometric.availableBiometricType;
    var authenticateMe = biometric.authenticateMe;

    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text("Has FingerPrint Support : $hasFingerPrintSupport"),
            Text(
                "List of Biometrics Support: ${availableBiometricType.toString()}"),
            Text("Authorized : $authorizedOrNot"),
            RaisedButton(
              child: Text("Authorize Now"),
              color: Colors.green,
              onPressed: authenticateMe,
            ),
          ],
        ),
      ),
    );
  }
}

[0.0.1] - Initial Release: 22/06/2020. #

  • local_auth: BiometricWidget is implemented on local_auth plugin
  • biometric.dart: Implemented BiometricWidget logic for local authentication.
  • readme.md: Includes package description, usage and example
  • pubspec.yaml: configuration file for flutter package

[0.0.2] - TODO: Add release date. #

  • pubspec.yaml: Removed author from pubspec.yaml as recommended by (flutter packages pub publish --dry-run).

[0.1.0] - Updated project metadata: 22/06/2020. #

  • pubspec.yaml: Added homepage link to pubspec.yaml.

[0.1.1] - Refactored example in readme.md: 22/06/2020. #

  • Refactored Example: Modified sample source code in readme.md.

[0.1.2] - Refactored example in readme.md: 22/06/2020. #

  • Refactored Example: Modified sample source code in readme.md.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  biometric_auth: ^0.1.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:biometric_auth/biometric_auth.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
46
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
69
Learn more about scoring.

We analyzed this package on Jul 10, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.15
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform Linux

Because:

  • package:biometric_auth/biometric_auth.dart that imports:
  • package:biometric_auth/src/biometric.dart that imports:
  • package:local_auth/local_auth.dart that declares support for platforms: Android, iOS

Package does not support Flutter platform Web

Because:

  • package:biometric_auth/biometric_auth.dart that imports:
  • package:biometric_auth/src/biometric.dart that imports:
  • package:local_auth/local_auth.dart that declares support for platforms: Android, iOS

Package does not support Flutter platform Windows

Because:

  • package:biometric_auth/biometric_auth.dart that imports:
  • package:biometric_auth/src/biometric.dart that imports:
  • package:local_auth/local_auth.dart that declares support for platforms: Android, iOS

Package does not support Flutter platform macOS

Because:

  • package:biometric_auth/biometric_auth.dart that imports:
  • package:biometric_auth/src/biometric.dart that imports:
  • package:local_auth/local_auth.dart that declares support for platforms: Android, iOS

Package not compatible with SDK dart

Because:

  • biometric_auth that is a package requiring null.

Health suggestions

Format lib/src/biometric.dart.

Run flutter format to format lib/src/biometric.dart.

Format lib/src/biometricinheritedwidget.dart.

Run flutter format to format lib/src/biometricinheritedwidget.dart.

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (local_auth).

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and biometric_auth.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
flutter 0.0.0
local_auth ^0.4.0+1 0.4.0+1 0.6.2+3
Transitive dependencies
collection 1.14.12 1.14.13
intl 0.15.8 0.16.1
meta 1.1.8 1.2.2
path 1.7.0
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test