flutter_trusted_device_v2 0.0.2 copy "flutter_trusted_device_v2: ^0.0.2" to clipboard
flutter_trusted_device_v2: ^0.0.2 copied to clipboard

Flutter version of Fazpass Trusted Device V2 SDK. This package focuses to generate meta which you can use to hit Fazpass rest API.

example/lib/main.dart

import 'dart:async';

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

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

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

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

class _MyAppState extends State<MyApp> {
  String _meta = 'Not generated yet';
  final _fazpass = Fazpass.instance;

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

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initGenerateMetaState() async {
    await _fazpass.init("my_public_key.pub");
    await _fazpass.enableSelected([SensitiveData.simNumbersAndOperators]);

    String meta;
    try {
      meta = await _fazpass.generateMeta() ?? 'Generate meta failed';
    } catch (e) {
      if (e is PlatformException) {
        meta = e.message!;
      } else {
        meta = 'Failed to generate meta.';
      }
    }

    if (!mounted) return;

    setState(() {
      _meta = meta;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Text(_meta),
        ),
      ),
    );
  }
}
2
likes
150
points
39
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter version of Fazpass Trusted Device V2 SDK. This package focuses to generate meta which you can use to hit Fazpass rest API.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on flutter_trusted_device_v2