esign_plugin 1.0.10 copy "esign_plugin: ^1.0.10" to clipboard
esign_plugin: ^1.0.10 copied to clipboard

Digio Esign flutter plugin

example/lib/main.dart

import 'dart:async';

import 'package:esign_plugin/digio_config.dart';
import 'package:esign_plugin/environment.dart';
import 'package:esign_plugin/esign_plugin.dart';
import 'package:esign_plugin/gateway_event.dart';
import 'package:esign_plugin/service_mode.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.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 _response = '';

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

  void gatewayFunnelEventCallback(GatewayEvent? map){
    print("gateway funnel event" + map.toString());
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initSign() async {
    var esignResult;
    // Platform messages may fail, so we use a try/catch PlatformException.
    // We also handle the message potentially returning null.
    try {
      var digioConfig = DigioConfig();
      digioConfig.theme.primaryColor = "#32a83a";
      digioConfig.logo = "https://www.gstatic.com/mobilesdk/160503_mobilesdk/logo/2x/firebase_28dp.png";
      digioConfig.environment = Environment.SANDBOX;
      digioConfig.serviceMode = ServiceMode.OTP;

      final _esignPlugin = EsignPlugin(digioConfig);
    _esignPlugin.setGatewayEventListener(gatewayFunnelEventCallback);
      esignResult = await _esignPlugin.start(
              "ENA2401191102503958GV5Q4J3IQUFAP", "akash.kumar@digio.in", "GWT240119110250583SJXXIQ4133DX9N", null);
      print('esignResult : ' + esignResult.toString());
    } on PlatformException {
      esignResult = '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(() {
      _response = esignResult.toString();
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Text('response : $_response\n'),
        ),
      ),
    );
  }
}
0
likes
0
pub points
88%
popularity

Publisher

unverified uploader

Digio Esign flutter plugin

Homepage

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on esign_plugin