process method

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

Implementation

bool process(String text, XFile file, BuildContext context, final png,
    String cardType) {
  // retry++;
  Map<String, String?> drivingLicenceData =
      drivingLicenceModel.textToDrivingLicence(
    text,
    inputName: name,
    inputAddress: address,
    inputLicenceNumber: licenceNumber,
    inputExpiryDate: expiryDate,
    inputIssueDate: issueDate,
    inputBirthDate: birthDate,
    inputCountry: country,
    inputIdCardNumber: idCardNumber,
  );

  name = drivingLicenceData['name'] ?? name;
  surName = drivingLicenceData['sur_name'] ?? surName;
  licenceNumber = drivingLicenceData['licence_number'] ?? licenceNumber;
  idCardNumber = drivingLicenceData['id_card_number'] ?? idCardNumber;
  expiryDate = drivingLicenceData['date_of_expiry'] ?? expiryDate;
  issueDate = drivingLicenceData['date_of_issue'] ?? issueDate;
  birthDate = drivingLicenceData['date_of_birth'] ?? birthDate;
  country = drivingLicenceData['country'] ?? country;
  bloodGroup = drivingLicenceData['blood_group'] ?? bloodGroup;
  address = drivingLicenceData['address'] ?? address;

//   if (drivingLicenceData.values.any((element) => element == null)) {
//     return false;
//   } else {
//     final contours = dylib.lookupFunction<Void Function(Pointer<Utf8>),
//         void Function(Pointer<Utf8>)>('Contours');
//     try {
//       contours(file.path.toNativeUtf8());
//       Navigator.pushReplacement(context, MaterialPageRoute(builder: (_) {
//         return DrivingLicenceProfile(
//             image: png,
//             cardImage: file,
//             drivingLicenceData: drivingLicenceData,
//             cardType: cardType);
//       }));
//     } catch (e) {
//       print('-------------------------exception');
//       Navigator.pushReplacement(context, MaterialPageRoute(builder: (_) {
//         return DrivingLicenceProfile(
//             image: png,
//             cardImage: file,
//             drivingLicenceData: drivingLicenceData,
//             cardType: cardType);
//       }));
//     }
//   }
  return true;
}