captureFingerPrint method
Implementation
@override
Future<String?> captureFingerPrint(String pidOptions) async {
try {
String? result = await promiseToFuture(jscaptureFingerPrint(pidOptions, BASE_PORT));
if (result != null && result.isNotEmpty) {
final xmlDocument = XmlDocument.parse(result);
XmlElement? errorField = xmlDocument.findElements("PidData").firstOrNull?.findElements("Resp").firstOrNull;
if (errorField != null) {
String? errorCode = errorField.attributes.firstWhereOrNull((element) => element.name.toString() == "errCode")?.value ?? "";
String? errorInfo = errorField.attributes.firstWhereOrNull((element) => element.name.toString() == "errInfo")?.value ?? "";
if (errorCode == "0") {
return result;
} else {
throw RDException(errorCode, "Something Went Wrong", errorInfo);
}
}
throw RDException("503", "Something Went Wrong", "Unable to Prarse Result");
} else {
throw RDException("503", "Something Went Wrong", "Result got null");
}
} catch (e) {
if (e == "ClientNotFound") {
throw RDClientNotFound("ClientNotFound", "Service Not Running", "Install Client Application");
}
rethrow;
}
}