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

A package to help kycdd clients integrate with client onboarding.

example/kycdd_example.dart

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

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: HomeScreen(),
    );
  }
}

class HomeScreen extends StatefulWidget {
  @override
  _HomeScreenState createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen> {
  final TextEditingController _apiKeyController = TextEditingController();
  final TextEditingController _workflowIDController = TextEditingController();
  final TextEditingController _customIDController = TextEditingController();
  String? _clientId;

  void _configure() {
    Kycdd.config(
      apiKey: _apiKeyController.text,
      workflowID: _workflowIDController.text,
    );
  }

  Future<void> _createClient() async {
    try {
      // The customID is optional, if you choose to use it you do not need
      // to save the returned client_id, you can use your customID instead
      final clientId = await Kycdd.createClient(
        customID: _customIDController.text,
      );
      setState(() {
        _clientId = clientId;
      });
    } catch (e) {
      ScaffoldMessenger.of(context).showSnackBar(
        SnackBar(content: Text('Failed to create client: $e')),
      );
    }
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('My Flutter Package Test App'),
      ),
      body: Padding(
        padding: const EdgeInsets.all(16.0),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            TextField(
              controller: _apiKeyController,
              decoration: InputDecoration(labelText: 'API Key'),
            ),
            TextField(
              controller: _workflowIDController,
              decoration: InputDecoration(labelText: 'Workflow ID'),
            ),
            TextField(
              controller: _customIDController,
              decoration: InputDecoration(labelText: 'Custom ID (optional)'),
            ),
            SizedBox(height: 20),
            ElevatedButton(
              onPressed: () {
                _configure();
                _createClient();
              },
              child: Text('Configure and Create Client'),
            ),
            if (_clientId != null) ...[
              SizedBox(height: 20),
              ElevatedButton(
                onPressed: () {
                  Navigator.of(context).push(
                    MaterialPageRoute(
                      builder: (context) => Kycdd.webView(_clientId!),
                    ),
                  );
                },
                child: Text('Show WebView'),
              ),
            ],
          ],
        ),
      ),
    );
  }
}
0
likes
0
points
45
downloads

Publisher

verified publisherkycdd.co.za

Weekly Downloads

A package to help kycdd clients integrate with client onboarding.

License

unknown (license)

Dependencies

file_picker, flutter, flutter_inappwebview, http, permission_handler

More

Packages that depend on kycdd