flutter_mobile_vision_api_face 0.0.3 copy "flutter_mobile_vision_api_face: ^0.0.3" to clipboard
flutter_mobile_vision_api_face: ^0.0.3 copied to clipboard

Flutter plugin for google mobile vision face api.

example/lib/main.dart

import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_mobile_vision_api_face/flutter_mobile_vision_api_face.dart';

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

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

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';
  String _picturePath = 'NIL';

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

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    String platformVersion;
    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
      platformVersion = await FlutterMobileVisionFaceApi.platformVersion;
    } on PlatformException {
      platformVersion = 'Failed to get platform version.';
    }

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

    setState(() {
      _platformVersion = platformVersion;
      //_picturePath = path;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
            child: Column(
          children: <Widget>[
            Text('Running on: $_platformVersion\n'),
            Text(
              'Detected Face is saved in : $_picturePath\n',
            ),
            RaisedButton(
              onPressed: _onButtonClick,
              child: Text('Open Camera'),
            )
          ],
        )),
      ),
    );
  }

  Future _onButtonClick() async {
    String path = await FlutterMobileVisionFaceApi.face();

    if (!mounted) return;

    setState(() {
      //_platformVersion = platformVersion;
      _picturePath = path;
    });
  }
}
0
likes
30
pub points
0%
popularity

Publisher

unverified uploader

Flutter plugin for google mobile vision face api.

Repository (GitHub)
View/report issues

License

Apache-2.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_mobile_vision_api_face