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

Authmatech flutter plugin for cellular-data-based identity verification.

example/lib/main.dart

import 'package:authmatech_sdk_flutter/authmatech_sdk_flutter.dart';
import 'package:flutter/material.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 _platformVersion = 'Unknown';
  String _result = 'No result yet';
  final _authmatechSdkFlutterPlugin = AuthmatechSdkFlutter();

  @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 AuthmatechSdkFlutter().getPlatformVersion() ?? 'Unknown platform version';
    } catch (e) {
      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;
    });
  }


  Future<void> _checkWithDataCellular() async {
    try {
      // Replace with your actual check URL - URL Provided by Authmatech Team
      const url = 'https://example.api.com';
      final result = await _authmatechSdkFlutterPlugin.openWithDataCellular(url, true);

      setState(() {
        _result = result.toString();
      });
    } catch (e) {
      setState(() {
        _result = 'Error: $e';
      });
    }
  }

  Future<void> _getSimplifiedResponse() async {
    try {
      // Replace with your actual check URL - URL Provided by Authmatech Team
      const url = 'https://example.api.com';
      final result = await _authmatechSdkFlutterPlugin.getSimplifiedResponse(url);
      setState(() {
        _result = 'authmatechCode: ${result.authmatechCode}\n'
            'MNOID: ${result.MNOID}\n'
            'Error Code: ${result.errorCode}\n'
            'Error Description: ${result.errorDesc}';
      });
    } catch (e) {
      setState(() {
        _result = 'Error: $e';
      });
    }
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      theme: ThemeData.dark().copyWith(
        scaffoldBackgroundColor: const Color(0xFF0F1216),
        elevatedButtonTheme: ElevatedButtonThemeData(
          style: ElevatedButton.styleFrom(
            shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(30)),
            padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 14),
            textStyle: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600),
          ),
        ),
      ),
      home: Scaffold(
        body: SafeArea(
          child: Padding(
            padding: const EdgeInsets.symmetric(horizontal: 15.0, vertical: 20),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                Center(
                  child: Column(
                    children: [
                      Image.asset(
                        'assets/images/Authmatech-logo.png',
                        height: 200,
                      ),
                      const SizedBox(height: 5),
                      const Text(
                        'AUTHMATECH SDK Example',
                        style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
                      ),
                    ],
                  ),
                ),
                const SizedBox(height: 30),
                Text(
                  'Running on: $_platformVersion',
                  style: const TextStyle(fontSize: 16, color: Colors.white70),
                ),
                const SizedBox(height: 30),
                ElevatedButton.icon(
                  onPressed: _checkWithDataCellular,
                  icon: const Icon(Icons.network_cell),
                  label: const Text('Check with Data Cellular'),
                  style: ElevatedButton.styleFrom(
                    backgroundColor: const Color(0xFF00E6FB),
                    foregroundColor: Colors.black,
                  ),
                ),
                const SizedBox(height: 15),
                ElevatedButton.icon(
                  onPressed: _getSimplifiedResponse,
                  icon: const Icon(Icons.check_circle_outline),
                  label: const Text('Get Simplified Response'),
                  style: ElevatedButton.styleFrom(
                    backgroundColor: Colors.white,
                    foregroundColor: Colors.black,
                  ),
                ),
                const SizedBox(height: 30),
                const Align(
                  alignment: Alignment.centerLeft,
                  child: Text(
                    'Result:',
                    style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
                  ),
                ),
                const SizedBox(height: 10),
                Expanded(
                  child: Container(
                    width: double.infinity,
                    padding: const EdgeInsets.all(14),
                    decoration: BoxDecoration(
                      color: Colors.black87,
                      borderRadius: BorderRadius.circular(12),
                    ),
                    child: SingleChildScrollView(
                      child: SelectableText(
                        _result,
                        style: const TextStyle(color: Colors.white, fontSize: 14),
                      ),
                    ),
                  ),
                ),

              ],
            ),
          ),
        ),
      ),
    );
  }


}
0
likes
140
points
19
downloads

Publisher

unverified uploader

Weekly Downloads

Authmatech flutter plugin for cellular-data-based identity verification.

Repository (GitHub)
View/report issues

Topics

#sdk #authentication #identity #flutter-plugin

Documentation

Documentation
API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on authmatech_sdk_flutter

Packages that implement authmatech_sdk_flutter