Navaron Bracke

move PersonName to its own file

@@ -20,6 +20,7 @@ export 'src/objects/driver_license.dart'; @@ -20,6 +20,7 @@ export 'src/objects/driver_license.dart';
20 export 'src/objects/email.dart'; 20 export 'src/objects/email.dart';
21 export 'src/objects/geo_point.dart'; 21 export 'src/objects/geo_point.dart';
22 export 'src/objects/mobile_scanner_arguments.dart'; 22 export 'src/objects/mobile_scanner_arguments.dart';
  23 +export 'src/objects/person_name.dart';
23 export 'src/objects/sms.dart'; 24 export 'src/objects/sms.dart';
24 export 'src/objects/url_bookmark.dart'; 25 export 'src/objects/url_bookmark.dart';
25 export 'src/objects/wifi.dart'; 26 export 'src/objects/wifi.dart';
@@ -141,54 +141,6 @@ class Address { @@ -141,54 +141,6 @@ class Address {
141 type = AddressType.values[data['type'] as int]; 141 type = AddressType.values[data['type'] as int];
142 } 142 }
143 143
144 -/// A person's name, both formatted version and individual name components.  
145 -class PersonName {  
146 - /// Gets first name.  
147 - ///  
148 - /// Returns null if not available.  
149 - final String? first;  
150 -  
151 - /// Gets middle name.  
152 - ///  
153 - /// Returns null if not available.  
154 - final String? middle;  
155 -  
156 - /// Gets last name.  
157 - ///  
158 - /// Returns null if not available.  
159 - final String? last;  
160 -  
161 - /// Gets prefix of the name.  
162 - ///  
163 - /// Returns null if not available.  
164 - final String? prefix;  
165 -  
166 - /// Gets suffix of the person's name.  
167 - ///  
168 - /// Returns null if not available.  
169 - final String? suffix;  
170 -  
171 - /// Gets the properly formatted name.  
172 - ///  
173 - /// Returns null if not available.  
174 - final String? formattedName;  
175 -  
176 - /// Designates a text string to be set as the kana name in the phonebook. Used for Japanese contacts.  
177 - ///  
178 - /// Returns null if not available.  
179 - final String? pronunciation;  
180 -  
181 - /// Create a [PersonName] from native data.  
182 - PersonName.fromNative(Map data)  
183 - : first = data['first'] as String?,  
184 - middle = data['middle'] as String?,  
185 - last = data['last'] as String?,  
186 - prefix = data['prefix'] as String?,  
187 - suffix = data['suffix'] as String?,  
188 - formattedName = data['formattedName'] as String?,  
189 - pronunciation = data['pronunciation'] as String?;  
190 -}  
191 -  
192 /// Phone number info. 144 /// Phone number info.
193 class Phone { 145 class Phone {
194 /// Gets phone number. 146 /// Gets phone number.
1 import 'package:mobile_scanner/src/objects/barcode.dart'; 1 import 'package:mobile_scanner/src/objects/barcode.dart';
2 import 'package:mobile_scanner/src/objects/email.dart'; 2 import 'package:mobile_scanner/src/objects/email.dart';
  3 +import 'package:mobile_scanner/src/objects/person_name.dart';
3 4
4 /// A person's or organization's business card. 5 /// A person's or organization's business card.
5 /// For example a VCARD. 6 /// For example a VCARD.
  1 +/// A person's name, divided into individual components.
  2 +class PersonName {
  3 + /// Create a new [PersonName] instance.
  4 + const PersonName({
  5 + this.first,
  6 + this.middle,
  7 + this.last,
  8 + this.prefix,
  9 + this.suffix,
  10 + this.formattedName,
  11 + this.pronunciation,
  12 + });
  13 +
  14 + /// Create a [PersonName] from a map.
  15 + factory PersonName.fromNative(Map<Object?, Object?> data) {
  16 + return PersonName(
  17 + first: data['first'] as String?,
  18 + middle: data['middle'] as String?,
  19 + last: data['last'] as String?,
  20 + prefix: data['prefix'] as String?,
  21 + suffix: data['suffix'] as String?,
  22 + formattedName: data['formattedName'] as String?,
  23 + pronunciation: data['pronunciation'] as String?,
  24 + );
  25 + }
  26 +
  27 + /// The person's first name.
  28 + final String? first;
  29 +
  30 + /// The person's middle name.
  31 + final String? middle;
  32 +
  33 + /// The person's last name.
  34 + final String? last;
  35 +
  36 + /// The prefix of the person's name.
  37 + final String? prefix;
  38 +
  39 + /// The suffix of the person's name.
  40 + final String? suffix;
  41 +
  42 + /// The person's name in a structured format.
  43 + final String? formattedName;
  44 +
  45 + /// The pronunciation of the person's name.
  46 + ///
  47 + /// This is used for the "kana" name in Japanese phonebooks.
  48 + final String? pronunciation;
  49 +}