Navaron Bracke

move DriverLicense to its own file

... ... @@ -14,5 +14,6 @@ export 'src/mobile_scanner_controller.dart';
export 'src/mobile_scanner_exception.dart';
export 'src/objects/barcode.dart';
export 'src/objects/barcode_capture.dart';
export 'src/objects/driver_license.dart';
export 'src/objects/email.dart';
export 'src/objects/mobile_scanner_arguments.dart';
... ...
... ... @@ -7,6 +7,7 @@ import 'package:mobile_scanner/src/enums/barcode_format.dart';
import 'package:mobile_scanner/src/enums/barcode_type.dart';
import 'package:mobile_scanner/src/enums/encryption_type.dart';
import 'package:mobile_scanner/src/enums/phone_type.dart';
import 'package:mobile_scanner/src/objects/driver_license.dart';
import 'package:mobile_scanner/src/objects/email.dart';
/// Represents a single recognized barcode and its value.
... ... @@ -291,98 +292,6 @@ class PersonName {
pronunciation = data['pronunciation'] as String?;
}
/// A driver license or ID card.
class DriverLicense {
/// Gets city of holder's address.
///
/// Returns null if not available.
final String? addressCity;
/// Gets state of holder's address.
///
/// Returns null if not available.
final String? addressState;
/// Gets holder's street address.
///
/// Returns null if not available.
final String? addressStreet;
/// Gets postal code of holder's address.
///
/// Returns null if not available.
final String? addressZip;
/// Gets birth date of the holder.
///
/// Returns null if not available.
final String? birthDate;
/// Gets "DL" for driver licenses, "ID" for ID cards.
///
/// Returns null if not available.
final String? documentType;
/// Gets expiry date of the license.
///
/// Returns null if not available.
final String? expiryDate;
/// Gets holder's first name.
///
/// Returns null if not available.
final String? firstName;
/// Gets holder's gender. 1 - male, 2 - female.
///
/// Returns null if not available.
final String? gender;
/// Gets issue date of the license.
///
/// The date format depends on the issuing country. MMDDYYYY for the US, YYYYMMDD for Canada.
///
/// Returns null if not available.
final String? issueDate;
/// Gets the three-letter country code in which DL/ID was issued.
///
/// Returns null if not available.
final String? issuingCountry;
/// Gets holder's last name.
///
/// Returns null if not available.
final String? lastName;
/// Gets driver license ID number.
///
/// Returns null if not available.
final String? licenseNumber;
/// Gets holder's middle name.
///
/// Returns null if not available.
final String? middleName;
/// Create a [DriverLicense] from native data.
DriverLicense.fromNative(Map data)
: addressCity = data['addressCity'] as String?,
addressState = data['addressState'] as String?,
addressStreet = data['addressStreet'] as String?,
addressZip = data['addressZip'] as String?,
birthDate = data['birthDate'] as String?,
documentType = data['documentType'] as String?,
expiryDate = data['expiryDate'] as String?,
firstName = data['firstName'] as String?,
gender = data['gender'] as String?,
issueDate = data['issueDate'] as String?,
issuingCountry = data['issuingCountry'] as String?,
lastName = data['lastName'] as String?,
licenseNumber = data['licenseNumber'] as String?,
middleName = data['middleName'] as String?;
}
/// GPS coordinates from a 'GEO:' or similar QRCode type.
class GeoPoint {
/// Gets the latitude.
... ...
/// A driver license or ID card.
class DriverLicense {
/// Create a new [DriverLicense].
const DriverLicense({
this.addressCity,
this.addressState,
this.addressStreet,
this.addressZip,
this.birthDate,
this.documentType,
this.expiryDate,
this.firstName,
this.gender,
this.issueDate,
this.issuingCountry,
this.lastName,
this.licenseNumber,
this.middleName,
});
/// Create a [DriverLicense] from a map.
factory DriverLicense.fromNative(Map<Object?, Object?> data) {
return DriverLicense(
addressCity: data['addressCity'] as String?,
addressState: data['addressState'] as String?,
addressStreet: data['addressStreet'] as String?,
addressZip: data['addressZip'] as String?,
birthDate: data['birthDate'] as String?,
documentType: data['documentType'] as String?,
expiryDate: data['expiryDate'] as String?,
firstName: data['firstName'] as String?,
gender: data['gender'] as String?,
issueDate: data['issueDate'] as String?,
issuingCountry: data['issuingCountry'] as String?,
lastName: data['lastName'] as String?,
licenseNumber: data['licenseNumber'] as String?,
middleName: data['middleName'] as String?,
);
}
/// The city of the holder's address.
final String? addressCity;
/// The state of the holder's address.
final String? addressState;
/// The street address of the holder's address.
final String? addressStreet;
/// The postal code of the holder's address.
final String? addressZip;
/// The holder's birth date.
final String? birthDate;
/// The type of the license.
///
/// This is either "DL" for driver licenses or "ID" for ID cards.
final String? documentType;
/// The expiry date of the license.
final String? expiryDate;
/// The holder's first name.
final String? firstName;
/// The holder's gender.
///
/// This is either '1' for male or '2' for female.
final String? gender;
/// The issue date of the license.
///
/// The date format depends on the issuing country.
/// For example `MMDDYYYY` is used in the US,
/// and `YYYYMMDD` is used in Canada.
final String? issueDate;
/// The three-letter country code in which this license was issued.
final String? issuingCountry;
/// The holder's last name.
final String? lastName;
/// The identifying number for this license.
final String? licenseNumber;
/// The holder's middle name.
final String? middleName;
}
... ...