smile_id 10.0.0-beta01 copy "smile_id: ^10.0.0-beta01" to clipboard
smile_id: ^10.0.0-beta01 copied to clipboard

The Official Smile ID Flutter SDK

example/lib/main.dart

import 'dart:async';

import 'package:flutter/material.dart';
import 'package:smile_id/messages.g.dart';
import 'package:smile_id/smile_id.dart';

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

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

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

class _MyAppState extends State<MyApp> {

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

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    // 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;
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Smile ID'),
        ),
        body: Center(
          child: Column(
            children: [
              ElevatedButton(
                child: const Text("Enhanced KYC (Async)"),
                onPressed: () {
                  SmileID.initialize();
                  var userId = "<your user's user ID>";
                  SmileID.authenticate(FlutterAuthenticationRequest(
                    jobType: FlutterJobType.enhancedKyc,
                    userId: userId,
                  )).then((authResponse) => {
                    SmileID.doEnhancedKycAsync(FlutterEnhancedKycRequest(
                      country: "GH",
                      idType: "DRIVERS_LICENSE",
                      idNumber: "B0000000",
                      callbackUrl: "https://webhook.site/a3d19f24-769a-46f2-997c-d186c3ae70ea",
                      partnerParams: FlutterPartnerParams(
                        jobType: FlutterJobType.enhancedKyc,
                        jobId: userId,
                        userId: userId,
                      ),
                      timestamp: authResponse!.timestamp,
                      signature: authResponse.signature
                    ))
                  }, onError: (error) => {print("error: $error")});
                }
              )
            ],
          )
        ),
      ),
    );
  }
}
9
likes
0
points
3.26k
downloads

Publisher

verified publishersmileidentity.com

Weekly Downloads

The Official Smile ID Flutter SDK

Homepage

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on smile_id