startFaceRecon method

  1. @override
Future<FaceReconReturnValues> startFaceRecon(
  1. String environment,
  2. String clientSessionKey, {
  3. String? sessionId,
  4. String? documentNumber,
  5. String? fontColor,
  6. String? backgroundColor,
  7. String? fontFamily,
  8. bool? showIntroductionScreens,
  9. bool? showSuccessScreen,
  10. bool? showInvalidTokenScreen,
  11. String? audioConfiguration,
  12. String? onboardingTitle,
  13. String? onboardingFirstLabel,
  14. String? onboardingSecondLabel,
  15. String? onboardingThirdLabel,
  16. String? logLevel,
})
override

Implementation

@override
Future<FaceReconReturnValues> startFaceRecon(
  String environment,
  String clientSessionKey, {
  String? sessionId,
  String? documentNumber,
  String? fontColor,
  String? backgroundColor,
  String? fontFamily,
  bool? showIntroductionScreens,
  bool? showSuccessScreen,
  bool? showInvalidTokenScreen,
  String? audioConfiguration,
  String? onboardingTitle,
  String? onboardingFirstLabel,
  String? onboardingSecondLabel,
  String? onboardingThirdLabel,
  String? logLevel,
}) async {
  try {
    final result = await methodChannel.invokeMethod('startFaceRecon', {
      'environment': environment,
      'clientSessionKey': clientSessionKey,
      'sessionId': sessionId,
      'documentNumber': documentNumber,
      'fontColor': fontColor,
      'backgroundColor': backgroundColor,
      'fontFamily': fontFamily,
      'showIntroductionScreens': showIntroductionScreens,
      'showSuccessScreen': showSuccessScreen,
      'showInvalidTokenScreen': showInvalidTokenScreen,
      'audioConfiguration': audioConfiguration,
      'onboardingTitle': onboardingTitle,
      'onboardingFirstLabel': onboardingFirstLabel,
      'onboardingSecondLabel': onboardingSecondLabel,
      'onboardingThirdLabel': onboardingThirdLabel,
      'logLevel': logLevel,
    });

    if (result is Map) {
      return FaceReconReturnValues.fromMap(Map<String, dynamic>.from(result));
    }

    final decoded = jsonDecode(result as String) as Map<String, dynamic>;
    return FaceReconReturnValues.fromMap(decoded);
  } on PlatformException catch (e) {
    final details = e.details as Map<Object?, Object?>?;

    throw FaceReconException(
      statusCode: details?['status_code'] as int?,
      reason: details?['reason'] as String? ?? e.code,
      description:
          details?['description'] as String? ?? e.message ?? 'Unknown error',
    );
  }
}