process method

bool process(
  1. String text,
  2. XFile file,
  3. BuildContext context,
  4. String cardType,
)

Implementation

bool process(String text, XFile file, BuildContext context, String cardType) {
  retry++;
  Map<String, String?> atmCardData = atmCardModel.textToAtmCard(text,
      inputName: name,
      inputBankName: bankName,
      inputCardNumber: cardNumber,
      inputExpiryDate: expiryDate,
      inputIssueDate: issueDate,
      inputPaymentNetwork: paymentNetwork,
      inputCardType: cardType);

  name = atmCardData['name'] ?? name;
  bankName = atmCardData['bank_name'] ?? bankName;
  cardNumber = atmCardData['card_number'] ?? cardNumber;
  expiryDate = atmCardData['date_of_expiry'] ?? expiryDate;
  issueDate = atmCardData['date_of_issue'] ?? issueDate;
  paymentNetwork = atmCardData['payment_network'] ?? paymentNetwork;
  atmCardType = atmCardData['card_type'] ?? atmCardType;

  // if (atmCardData.values.any((element) => element == null) && retry < 2) {
  //   return false;
  // } else {
  //   final ProfileController cameraViewController =
  //       Get.put(ProfileController());
  //
  //   // XFile imageCopy = XFile(file.path);
  //   bool compareResult = false;
  //   final contours = dylib.lookupFunction<Void Function(Pointer<Utf8>),
  //       void Function(Pointer<Utf8>)>('Contours');
  //   try {
  //     contours(file.path.toNativeUtf8());
  //     // XFile front = XFile(file.path);
  //
  //
  //     Navigator.pushReplacement(context, MaterialPageRoute(builder: (_) {
  //       return AtmCardProfile(
  //           cardImage: file, atmCardData: atmCardData, cardType: cardType);
  //     }));
  //   } catch (e) {
  //     print('-------------------------exception');
  //     Navigator.pushReplacement(
  //       context,
  //       MaterialPageRoute(builder: (_) {
  //         return AtmCardProfile(
  //             cardImage: file, atmCardData: atmCardData, cardType: cardType);
  //       }),
  //     );
  //   }
  //   // Timer.periodic(const Duration(seconds: 2), (timer) {
  //   //   print('------------------- in timer');
  //   //   compareResult = compareCard.compare(
  //   //       imageCopy.path.toNativeUtf8(), file.path.toNativeUtf8());
  //   //
  //   //   if (compareResult) {
  //   //     timer.cancel();
  //   //
  //   //   }
  //   // });
  //   return compareResult;
  //
  //   // for (int i = 0; i < 4; i++) {
  //   //   compareResult = compareCard.compare(
  //   //       imageCopy.path.toNativeUtf8(), file.path.toNativeUtf8());
  //   // }
  // }
  return true;
}