Navaron Bracke

move DriverLicense to its own file

@@ -14,5 +14,6 @@ export 'src/mobile_scanner_controller.dart'; @@ -14,5 +14,6 @@ export 'src/mobile_scanner_controller.dart';
14 export 'src/mobile_scanner_exception.dart'; 14 export 'src/mobile_scanner_exception.dart';
15 export 'src/objects/barcode.dart'; 15 export 'src/objects/barcode.dart';
16 export 'src/objects/barcode_capture.dart'; 16 export 'src/objects/barcode_capture.dart';
  17 +export 'src/objects/driver_license.dart';
17 export 'src/objects/email.dart'; 18 export 'src/objects/email.dart';
18 export 'src/objects/mobile_scanner_arguments.dart'; 19 export 'src/objects/mobile_scanner_arguments.dart';
@@ -7,6 +7,7 @@ import 'package:mobile_scanner/src/enums/barcode_format.dart'; @@ -7,6 +7,7 @@ import 'package:mobile_scanner/src/enums/barcode_format.dart';
7 import 'package:mobile_scanner/src/enums/barcode_type.dart'; 7 import 'package:mobile_scanner/src/enums/barcode_type.dart';
8 import 'package:mobile_scanner/src/enums/encryption_type.dart'; 8 import 'package:mobile_scanner/src/enums/encryption_type.dart';
9 import 'package:mobile_scanner/src/enums/phone_type.dart'; 9 import 'package:mobile_scanner/src/enums/phone_type.dart';
  10 +import 'package:mobile_scanner/src/objects/driver_license.dart';
10 import 'package:mobile_scanner/src/objects/email.dart'; 11 import 'package:mobile_scanner/src/objects/email.dart';
11 12
12 /// Represents a single recognized barcode and its value. 13 /// Represents a single recognized barcode and its value.
@@ -291,98 +292,6 @@ class PersonName { @@ -291,98 +292,6 @@ class PersonName {
291 pronunciation = data['pronunciation'] as String?; 292 pronunciation = data['pronunciation'] as String?;
292 } 293 }
293 294
294 -/// A driver license or ID card.  
295 -class DriverLicense {  
296 - /// Gets city of holder's address.  
297 - ///  
298 - /// Returns null if not available.  
299 - final String? addressCity;  
300 -  
301 - /// Gets state of holder's address.  
302 - ///  
303 - /// Returns null if not available.  
304 - final String? addressState;  
305 -  
306 - /// Gets holder's street address.  
307 - ///  
308 - /// Returns null if not available.  
309 - final String? addressStreet;  
310 -  
311 - /// Gets postal code of holder's address.  
312 - ///  
313 - /// Returns null if not available.  
314 - final String? addressZip;  
315 -  
316 - /// Gets birth date of the holder.  
317 - ///  
318 - /// Returns null if not available.  
319 - final String? birthDate;  
320 -  
321 - /// Gets "DL" for driver licenses, "ID" for ID cards.  
322 - ///  
323 - /// Returns null if not available.  
324 - final String? documentType;  
325 -  
326 - /// Gets expiry date of the license.  
327 - ///  
328 - /// Returns null if not available.  
329 - final String? expiryDate;  
330 -  
331 - /// Gets holder's first name.  
332 - ///  
333 - /// Returns null if not available.  
334 - final String? firstName;  
335 -  
336 - /// Gets holder's gender. 1 - male, 2 - female.  
337 - ///  
338 - /// Returns null if not available.  
339 - final String? gender;  
340 -  
341 - /// Gets issue date of the license.  
342 - ///  
343 - /// The date format depends on the issuing country. MMDDYYYY for the US, YYYYMMDD for Canada.  
344 - ///  
345 - /// Returns null if not available.  
346 - final String? issueDate;  
347 -  
348 - /// Gets the three-letter country code in which DL/ID was issued.  
349 - ///  
350 - /// Returns null if not available.  
351 - final String? issuingCountry;  
352 -  
353 - /// Gets holder's last name.  
354 - ///  
355 - /// Returns null if not available.  
356 - final String? lastName;  
357 -  
358 - /// Gets driver license ID number.  
359 - ///  
360 - /// Returns null if not available.  
361 - final String? licenseNumber;  
362 -  
363 - /// Gets holder's middle name.  
364 - ///  
365 - /// Returns null if not available.  
366 - final String? middleName;  
367 -  
368 - /// Create a [DriverLicense] from native data.  
369 - DriverLicense.fromNative(Map data)  
370 - : addressCity = data['addressCity'] as String?,  
371 - addressState = data['addressState'] as String?,  
372 - addressStreet = data['addressStreet'] as String?,  
373 - addressZip = data['addressZip'] as String?,  
374 - birthDate = data['birthDate'] as String?,  
375 - documentType = data['documentType'] as String?,  
376 - expiryDate = data['expiryDate'] as String?,  
377 - firstName = data['firstName'] as String?,  
378 - gender = data['gender'] as String?,  
379 - issueDate = data['issueDate'] as String?,  
380 - issuingCountry = data['issuingCountry'] as String?,  
381 - lastName = data['lastName'] as String?,  
382 - licenseNumber = data['licenseNumber'] as String?,  
383 - middleName = data['middleName'] as String?;  
384 -}  
385 -  
386 /// GPS coordinates from a 'GEO:' or similar QRCode type. 295 /// GPS coordinates from a 'GEO:' or similar QRCode type.
387 class GeoPoint { 296 class GeoPoint {
388 /// Gets the latitude. 297 /// Gets the latitude.
  1 +/// A driver license or ID card.
  2 +class DriverLicense {
  3 + /// Create a new [DriverLicense].
  4 + const DriverLicense({
  5 + this.addressCity,
  6 + this.addressState,
  7 + this.addressStreet,
  8 + this.addressZip,
  9 + this.birthDate,
  10 + this.documentType,
  11 + this.expiryDate,
  12 + this.firstName,
  13 + this.gender,
  14 + this.issueDate,
  15 + this.issuingCountry,
  16 + this.lastName,
  17 + this.licenseNumber,
  18 + this.middleName,
  19 + });
  20 +
  21 + /// Create a [DriverLicense] from a map.
  22 + factory DriverLicense.fromNative(Map<Object?, Object?> data) {
  23 + return DriverLicense(
  24 + addressCity: data['addressCity'] as String?,
  25 + addressState: data['addressState'] as String?,
  26 + addressStreet: data['addressStreet'] as String?,
  27 + addressZip: data['addressZip'] as String?,
  28 + birthDate: data['birthDate'] as String?,
  29 + documentType: data['documentType'] as String?,
  30 + expiryDate: data['expiryDate'] as String?,
  31 + firstName: data['firstName'] as String?,
  32 + gender: data['gender'] as String?,
  33 + issueDate: data['issueDate'] as String?,
  34 + issuingCountry: data['issuingCountry'] as String?,
  35 + lastName: data['lastName'] as String?,
  36 + licenseNumber: data['licenseNumber'] as String?,
  37 + middleName: data['middleName'] as String?,
  38 + );
  39 + }
  40 +
  41 + /// The city of the holder's address.
  42 + final String? addressCity;
  43 +
  44 + /// The state of the holder's address.
  45 + final String? addressState;
  46 +
  47 + /// The street address of the holder's address.
  48 + final String? addressStreet;
  49 +
  50 + /// The postal code of the holder's address.
  51 + final String? addressZip;
  52 +
  53 + /// The holder's birth date.
  54 + final String? birthDate;
  55 +
  56 + /// The type of the license.
  57 + ///
  58 + /// This is either "DL" for driver licenses or "ID" for ID cards.
  59 + final String? documentType;
  60 +
  61 + /// The expiry date of the license.
  62 + final String? expiryDate;
  63 +
  64 + /// The holder's first name.
  65 + final String? firstName;
  66 +
  67 + /// The holder's gender.
  68 + ///
  69 + /// This is either '1' for male or '2' for female.
  70 + final String? gender;
  71 +
  72 + /// The issue date of the license.
  73 + ///
  74 + /// The date format depends on the issuing country.
  75 + /// For example `MMDDYYYY` is used in the US,
  76 + /// and `YYYYMMDD` is used in Canada.
  77 + final String? issueDate;
  78 +
  79 + /// The three-letter country code in which this license was issued.
  80 + final String? issuingCountry;
  81 +
  82 + /// The holder's last name.
  83 + final String? lastName;
  84 +
  85 + /// The identifying number for this license.
  86 + final String? licenseNumber;
  87 +
  88 + /// The holder's middle name.
  89 + final String? middleName;
  90 +}