presentVerificationFlow method

Future<void> presentVerificationFlow({
  1. required BuildContext context,
  2. required String apiKey,
  3. required String kycLevel,
  4. String? firstName,
  5. String? lastName,
  6. String? uniqueId,
  7. String? phoneNumber,
  8. String? email,
  9. String? i18n,
  10. bool ageVerification = false,
  11. bool showCompletionView = true,
  12. VoidCallback? onVerificationCompleted,
  13. VoidCallback? onVerificationCancelled,
  14. dynamic onVerificationError(
    1. String
    )?,
})

Implementation

Future<void> presentVerificationFlow({
  required BuildContext context,
  required String apiKey,
  required String kycLevel,
  String? firstName,
  String? lastName,
  String? uniqueId,
  String? phoneNumber,
  String? email,
  String? i18n,
  bool ageVerification = false,
  bool showCompletionView = true,
  VoidCallback? onVerificationCompleted,
  VoidCallback? onVerificationCancelled,
  Function(String)? onVerificationError,
}) async {
  debugPrint("πŸš€ presentVerificationFlow called");

  final verificationWidget = await createVerificationFlow(
    context: context,
    apiKey: apiKey,
    kycLevel: kycLevel,
    firstName: firstName,
    lastName: lastName,
    uniqueId: uniqueId,
    phoneNumber: phoneNumber,
    email: email,
    ageVerification: ageVerification,
    showCompletionView: showCompletionView,
    completion: () {
      debugPrint("πŸšͺ Completion callback called - popping navigator");
      if (Navigator.of(context).canPop()) {
        Navigator.of(context).pop();
      }
    },
    onVerificationCompleted: onVerificationCompleted,
    onVerificationCancelled: onVerificationCancelled,
    onVerificationError: onVerificationError,
  );

  debugPrint("πŸ“± About to push verification widget");
  if (context.mounted) {
    await Navigator.of(context).push(
      MaterialPageRoute(
        builder: (_) => verificationWidget,
        fullscreenDialog: true,
      ),
    );
    debugPrint("πŸ“± Navigator.push completed (modal dismissed)");
  }
}