baidu_face_plugin 1.0.2 copy "baidu_face_plugin: ^1.0.2" to clipboard
baidu_face_plugin: ^1.0.2 copied to clipboard

A Flutter plugin for baidu face recognization and liveness.

example/lib/main.dart

import 'dart:async';

import 'package:baidu_face_plugin/baidu_face_plugin.dart';
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';

Future<void> main() async {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
          appBar: AppBar(
            title: const Text('Plugin example app'),
          ),
          body: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: <Widget>[
              RaisedButton(
                  child: Text("打开liveness"),
                  onPressed: () {
                    _liveness();
                  }),
              RaisedButton(
                  child: Text("打开detect"),
                  onPressed: () {
                    _detect();
                  }),
            ],
          )),
    );
  }

  _liveness() async {
    LivenessResult result = await new BaiduFacePlugin().liveness();

    debugPrint('LivenessResult: $result');
    Fluttertoast.showToast(msg: result.toString(), timeInSecForIosWeb: 4);

    // setState
  }

  _detect() async {
    DetectResult result = await new BaiduFacePlugin().detect();

    debugPrint('DetectResult: $result');
    Fluttertoast.showToast(msg: result.toString(), timeInSecForIosWeb: 4);

    // setState
  }
}
3
likes
20
pub points
0%
popularity

Publisher

unverified uploader

A Flutter plugin for baidu face recognization and liveness.

Repository (GitHub)
View/report issues

License

Apache-2.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on baidu_face_plugin