rdservice 1.0.0 copy "rdservice: ^1.0.0" to clipboard
rdservice: ^1.0.0 copied to clipboard

PlatformAndroid

This plugin can be used to consume the RD Service of biometric device via android intents.

example/lib/main.dart

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

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

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

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: SingleChildScrollView(
          child: SizedBox(
            width: double.infinity,
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                ElevatedButton(
                  child: const Text("Init Device"),
                  onPressed: initDevice,
                ),
                ElevatedButton(
                  child: const Text("Capture"),
                  onPressed: captureFromDevice,
                ),
                Padding(
                  padding: const EdgeInsets.all(8.0),
                  child: Text(_platformVersion),
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }

  Future<void> initDevice() async {
    RDService? result;
    try {
      result = await Msf100.getDeviceInfo();
    } on PlatformException catch (e) {
      if (mounted) {
        setState(() {
          _platformVersion = e.message ?? 'Unknown exception';
        });
      }
      return;
    }
    if (!mounted) return;

    setState(() {
      _platformVersion = result?.status ?? "Unknown";
    });
  }

  Future<void> captureFromDevice() async {
    PidData? result;
    try {
      result = await Msf100.capture();
    } on PlatformException catch (e) {
      if (mounted) {
        setState(() {
          _platformVersion = e.message ?? 'Unknown exception';
        });
      }
      return;
    }
    if (!mounted) return;

    setState(() {
      _platformVersion = result?.resp.errInfo ?? 'Unknown Error';
    });
  }
}
2
likes
140
points
40
downloads

Publisher

unverified uploader

Weekly Downloads

This plugin can be used to consume the RD Service of biometric device via android intents.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

change_app_package_name, flutter, xml2json

More

Packages that depend on rdservice