flutter_idensic_mobile_sdk_plugin 1.14.3 copy "flutter_idensic_mobile_sdk_plugin: ^1.14.3" to clipboard
flutter_idensic_mobile_sdk_plugin: ^1.14.3 copied to clipboard

outdated

Flutter plugin exposing SumSub MobileSDK

example/lib/main.dart

import 'dart:async';

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

void launchSNSMobileSDK() async {

  final String apiUrl = "https://test-api.sumsub.com"; // or https://api.sumsub.com
  final String flowName = "msdk-basic-kyc"; // or set up your own with the dashboard
  final String accessToken = "your access token";

  final onTokenExpiration = () async {
    // call your backend to fetch a new access token (this is just an example)
    return Future<String>.delayed(Duration(seconds: 2), () => "_act-321ac6af-a3a6-4a73-990c-a7d24a4cd7f8");
  };

  // Handlers
  final SNSStatusChangedHandler onStatusChanged = (SNSMobileSDKStatus newStatus, SNSMobileSDKStatus prevStatus) {
    print("onStatusChanged: $prevStatus -> $newStatus");
  };

  final SNSActionResultHandler onActionResult = (SNSMobileSDKActionResult result) {
    print("onActionResult: $result");

    // you must return a `Future` that in turn should be completed with a value of `SNSActionResultHandlerReaction` type
    // you could pass `.Cancel` to force the user interface to close, or `.Continue` to proceed as usual
    return Future.value(SNSActionResultHandlerReaction.Continue);
  };

  final snsMobileSDK = SNSMobileSDK.builder(apiUrl, flowName)
    .withAccessToken(accessToken, onTokenExpiration)
    .withLocale(Locale("en")) // https://api.flutter.dev/flutter/dart-ui/Locale-class.html
    .withSupportEmail("support@myemail.com")
    .withHandlers(
      onStatusChanged: onStatusChanged,
      onActionResult: onActionResult
    )
    .withDebug(true)
    .build();

  final SNSMobileSDKResult result = await snsMobileSDK.launch();

  print("Completed with result: $result");
}

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

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

class _MyAppState extends State<MyApp> {

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Idensic Mobile SDK Plugin example app'),
        ),
        body: Container(
          alignment: Alignment.center,
          child: RaisedButton(onPressed: () => launchSNSMobileSDK(),
          child: Text("Launch SumSub SDK")),
        ),
      ),
    );
  }
}
11
likes
0
pub points
92%
popularity

Publisher

verified publishersumsub.com

Flutter plugin exposing SumSub MobileSDK

Homepage

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_idensic_mobile_sdk_plugin