Showing
4 changed files
with
40 additions
and
32 deletions
| 1 | +## NEXT | ||
| 2 | +Improvements: | ||
| 3 | +* The `type` of an `Email` is no longer null. | ||
| 4 | + | ||
| 1 | ## 3.5.0 | 5 | ## 3.5.0 |
| 2 | New Features: | 6 | New Features: |
| 3 | * Added the option to switch between bundled and unbundled MLKit for Android. (thanks @woolfred !) | 7 | * Added the option to switch between bundled and unbundled MLKit for Android. (thanks @woolfred !) |
| @@ -14,4 +14,5 @@ export 'src/mobile_scanner_controller.dart'; | @@ -14,4 +14,5 @@ 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/email.dart'; | ||
| 17 | export 'src/objects/mobile_scanner_arguments.dart'; | 18 | export 'src/objects/mobile_scanner_arguments.dart'; |
| @@ -5,9 +5,9 @@ import 'package:mobile_scanner/src/barcode_utility.dart'; | @@ -5,9 +5,9 @@ import 'package:mobile_scanner/src/barcode_utility.dart'; | ||
| 5 | import 'package:mobile_scanner/src/enums/address_type.dart'; | 5 | import 'package:mobile_scanner/src/enums/address_type.dart'; |
| 6 | import 'package:mobile_scanner/src/enums/barcode_format.dart'; | 6 | 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/email_type.dart'; | ||
| 9 | import 'package:mobile_scanner/src/enums/encryption_type.dart'; | 8 | import 'package:mobile_scanner/src/enums/encryption_type.dart'; |
| 10 | 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/email.dart'; | ||
| 11 | 11 | ||
| 12 | /// Represents a single recognized barcode and its value. | 12 | /// Represents a single recognized barcode and its value. |
| 13 | class Barcode { | 13 | class Barcode { |
| @@ -383,37 +383,6 @@ class DriverLicense { | @@ -383,37 +383,6 @@ class DriverLicense { | ||
| 383 | middleName = data['middleName'] as String?; | 383 | middleName = data['middleName'] as String?; |
| 384 | } | 384 | } |
| 385 | 385 | ||
| 386 | -/// An email message from a 'MAILTO:' or similar QRCode type. | ||
| 387 | -class Email { | ||
| 388 | - /// Gets email's address. | ||
| 389 | - /// | ||
| 390 | - /// Returns null if not available. | ||
| 391 | - final String? address; | ||
| 392 | - | ||
| 393 | - /// Gets email's body. | ||
| 394 | - /// | ||
| 395 | - /// Returns null if not available. | ||
| 396 | - final String? body; | ||
| 397 | - | ||
| 398 | - /// Gets email's subject. | ||
| 399 | - /// | ||
| 400 | - /// Returns null if not available. | ||
| 401 | - final String? subject; | ||
| 402 | - | ||
| 403 | - /// Gets type of the email. | ||
| 404 | - /// | ||
| 405 | - /// See also [EmailType]. | ||
| 406 | - /// Returns null if not available. | ||
| 407 | - final EmailType? type; | ||
| 408 | - | ||
| 409 | - /// Create a [Email] from native data. | ||
| 410 | - Email.fromNative(Map data) | ||
| 411 | - : address = data['address'] as String?, | ||
| 412 | - body = data['body'] as String?, | ||
| 413 | - subject = data['subject'] as String?, | ||
| 414 | - type = EmailType.values[data['type'] as int]; | ||
| 415 | -} | ||
| 416 | - | ||
| 417 | /// GPS coordinates from a 'GEO:' or similar QRCode type. | 386 | /// GPS coordinates from a 'GEO:' or similar QRCode type. |
| 418 | class GeoPoint { | 387 | class GeoPoint { |
| 419 | /// Gets the latitude. | 388 | /// Gets the latitude. |
lib/src/objects/email.dart
0 → 100644
| 1 | +import 'package:mobile_scanner/src/enums/email_type.dart'; | ||
| 2 | + | ||
| 3 | +/// An email message from a 'MAILTO:' or similar QRCode type. | ||
| 4 | +class Email { | ||
| 5 | + /// Construct a new [Email] instance. | ||
| 6 | + const Email({ | ||
| 7 | + this.address, | ||
| 8 | + this.body, | ||
| 9 | + this.subject, | ||
| 10 | + this.type = EmailType.unknown, | ||
| 11 | + }); | ||
| 12 | + | ||
| 13 | + /// Construct an [Email] from the given [data]. | ||
| 14 | + factory Email.fromNative(Map<Object?, Object?> data) { | ||
| 15 | + return Email( | ||
| 16 | + address: data['address'] as String?, | ||
| 17 | + body: data['body'] as String?, | ||
| 18 | + subject: data['subject'] as String?, | ||
| 19 | + type: EmailType.fromRawValue(data['type'] as int? ?? 0), | ||
| 20 | + ); | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + /// The email address. | ||
| 24 | + final String? address; | ||
| 25 | + | ||
| 26 | + /// The body of the email. | ||
| 27 | + final String? body; | ||
| 28 | + | ||
| 29 | + /// The subject of the email. | ||
| 30 | + final String? subject; | ||
| 31 | + | ||
| 32 | + /// The type of the email. | ||
| 33 | + final EmailType type; | ||
| 34 | +} |
-
Please register or login to post a comment