Showing
5 changed files
with
28 additions
and
21 deletions
| @@ -6,6 +6,7 @@ Improvements: | @@ -6,6 +6,7 @@ Improvements: | ||
| 6 | * The `latitude` and `longitude` of a `GeoPoint` are now non-null. | 6 | * The `latitude` and `longitude` of a `GeoPoint` are now non-null. |
| 7 | * The `phones` and `urls` of `ContactInfo` are now non-null. | 7 | * The `phones` and `urls` of `ContactInfo` are now non-null. |
| 8 | * The `url` of a `UrlBookmark` is now non-null. | 8 | * The `url` of a `UrlBookmark` is now non-null. |
| 9 | +* The `type` of `Phone` is now non-null. | ||
| 9 | 10 | ||
| 10 | ## 3.5.0 | 11 | ## 3.5.0 |
| 11 | New Features: | 12 | New Features: |
| @@ -22,6 +22,7 @@ export 'src/objects/email.dart'; | @@ -22,6 +22,7 @@ export 'src/objects/email.dart'; | ||
| 22 | export 'src/objects/geo_point.dart'; | 22 | export 'src/objects/geo_point.dart'; |
| 23 | export 'src/objects/mobile_scanner_arguments.dart'; | 23 | export 'src/objects/mobile_scanner_arguments.dart'; |
| 24 | export 'src/objects/person_name.dart'; | 24 | export 'src/objects/person_name.dart'; |
| 25 | +export 'src/objects/phone.dart'; | ||
| 25 | export 'src/objects/sms.dart'; | 26 | export 'src/objects/sms.dart'; |
| 26 | export 'src/objects/url_bookmark.dart'; | 27 | export 'src/objects/url_bookmark.dart'; |
| 27 | export 'src/objects/wifi.dart'; | 28 | export 'src/objects/wifi.dart'; |
| @@ -4,12 +4,12 @@ import 'dart:ui'; | @@ -4,12 +4,12 @@ import 'dart:ui'; | ||
| 4 | import 'package:mobile_scanner/src/barcode_utility.dart'; | 4 | import 'package:mobile_scanner/src/barcode_utility.dart'; |
| 5 | import 'package:mobile_scanner/src/enums/barcode_format.dart'; | 5 | import 'package:mobile_scanner/src/enums/barcode_format.dart'; |
| 6 | import 'package:mobile_scanner/src/enums/barcode_type.dart'; | 6 | import 'package:mobile_scanner/src/enums/barcode_type.dart'; |
| 7 | -import 'package:mobile_scanner/src/enums/phone_type.dart'; | ||
| 8 | import 'package:mobile_scanner/src/objects/calendar_event.dart'; | 7 | import 'package:mobile_scanner/src/objects/calendar_event.dart'; |
| 9 | import 'package:mobile_scanner/src/objects/contact_info.dart'; | 8 | import 'package:mobile_scanner/src/objects/contact_info.dart'; |
| 10 | import 'package:mobile_scanner/src/objects/driver_license.dart'; | 9 | import 'package:mobile_scanner/src/objects/driver_license.dart'; |
| 11 | import 'package:mobile_scanner/src/objects/email.dart'; | 10 | import 'package:mobile_scanner/src/objects/email.dart'; |
| 12 | import 'package:mobile_scanner/src/objects/geo_point.dart'; | 11 | import 'package:mobile_scanner/src/objects/geo_point.dart'; |
| 12 | +import 'package:mobile_scanner/src/objects/phone.dart'; | ||
| 13 | import 'package:mobile_scanner/src/objects/sms.dart'; | 13 | import 'package:mobile_scanner/src/objects/sms.dart'; |
| 14 | import 'package:mobile_scanner/src/objects/url_bookmark.dart'; | 14 | import 'package:mobile_scanner/src/objects/url_bookmark.dart'; |
| 15 | import 'package:mobile_scanner/src/objects/wifi.dart'; | 15 | import 'package:mobile_scanner/src/objects/wifi.dart'; |
| @@ -121,22 +121,3 @@ class Barcode { | @@ -121,22 +121,3 @@ class Barcode { | ||
| 121 | url = toUrl(data['url'] as Map?), | 121 | url = toUrl(data['url'] as Map?), |
| 122 | wifi = toWiFi(data['wifi'] as Map?); | 122 | wifi = toWiFi(data['wifi'] as Map?); |
| 123 | } | 123 | } |
| 124 | - | ||
| 125 | -/// Phone number info. | ||
| 126 | -class Phone { | ||
| 127 | - /// Gets phone number. | ||
| 128 | - /// | ||
| 129 | - /// Returns null if not available. | ||
| 130 | - final String? number; | ||
| 131 | - | ||
| 132 | - /// Gets type of the phone number. | ||
| 133 | - /// | ||
| 134 | - /// See also [PhoneType]. | ||
| 135 | - /// Returns null if not available. | ||
| 136 | - final PhoneType? type; | ||
| 137 | - | ||
| 138 | - /// Create a [Phone] from native data. | ||
| 139 | - Phone.fromNative(Map data) | ||
| 140 | - : number = data['number'] as String?, | ||
| 141 | - type = PhoneType.values[data['type'] as int]; | ||
| 142 | -} |
| 1 | import 'package:mobile_scanner/src/objects/address.dart'; | 1 | import 'package:mobile_scanner/src/objects/address.dart'; |
| 2 | -import 'package:mobile_scanner/src/objects/barcode.dart'; | ||
| 3 | import 'package:mobile_scanner/src/objects/email.dart'; | 2 | import 'package:mobile_scanner/src/objects/email.dart'; |
| 4 | import 'package:mobile_scanner/src/objects/person_name.dart'; | 3 | import 'package:mobile_scanner/src/objects/person_name.dart'; |
| 4 | +import 'package:mobile_scanner/src/objects/phone.dart'; | ||
| 5 | 5 | ||
| 6 | /// A person's or organization's business card. | 6 | /// A person's or organization's business card. |
| 7 | /// For example a VCARD. | 7 | /// For example a VCARD. |
lib/src/objects/phone.dart
0 → 100644
| 1 | +import 'package:mobile_scanner/src/enums/phone_type.dart'; | ||
| 2 | + | ||
| 3 | +/// Phone number information from a barcode. | ||
| 4 | +class Phone { | ||
| 5 | + /// Construct a new [Phone] instance. | ||
| 6 | + const Phone({ | ||
| 7 | + this.number, | ||
| 8 | + this.type = PhoneType.unknown, | ||
| 9 | + }); | ||
| 10 | + | ||
| 11 | + /// Create a [Phone] from the given [data]. | ||
| 12 | + factory Phone.fromNative(Map<Object?, Object?> data) { | ||
| 13 | + return Phone( | ||
| 14 | + number: data['number'] as String?, | ||
| 15 | + type: PhoneType.fromRawValue(data['type'] as int? ?? 0), | ||
| 16 | + ); | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + /// The phone number value. | ||
| 20 | + final String? number; | ||
| 21 | + | ||
| 22 | + /// The type of the phone number. | ||
| 23 | + final PhoneType type; | ||
| 24 | +} |
-
Please register or login to post a comment