Navaron Bracke

move SMS to its own file

1 ## NEXT 1 ## NEXT
2 Improvements: 2 Improvements:
3 -* The `type` of an `Email` is no longer null. 3 +* The `type` of an `Email` is now non-null.
  4 +* The `phoneNumber` of an `SMS` is now non-null.
4 5
5 ## 3.5.0 6 ## 3.5.0
6 New Features: 7 New Features:
@@ -18,4 +18,5 @@ export 'src/objects/calendar_event.dart'; @@ -18,4 +18,5 @@ export 'src/objects/calendar_event.dart';
18 export 'src/objects/driver_license.dart'; 18 export 'src/objects/driver_license.dart';
19 export 'src/objects/email.dart'; 19 export 'src/objects/email.dart';
20 export 'src/objects/mobile_scanner_arguments.dart'; 20 export 'src/objects/mobile_scanner_arguments.dart';
  21 +export 'src/objects/sms.dart';
21 export 'src/objects/wifi.dart'; 22 export 'src/objects/wifi.dart';
@@ -9,6 +9,7 @@ import 'package:mobile_scanner/src/enums/phone_type.dart'; @@ -9,6 +9,7 @@ import 'package:mobile_scanner/src/enums/phone_type.dart';
9 import 'package:mobile_scanner/src/objects/calendar_event.dart'; 9 import 'package:mobile_scanner/src/objects/calendar_event.dart';
10 import 'package:mobile_scanner/src/objects/driver_license.dart'; 10 import 'package:mobile_scanner/src/objects/driver_license.dart';
11 import 'package:mobile_scanner/src/objects/email.dart'; 11 import 'package:mobile_scanner/src/objects/email.dart';
  12 +import 'package:mobile_scanner/src/objects/sms.dart';
12 import 'package:mobile_scanner/src/objects/wifi.dart'; 13 import 'package:mobile_scanner/src/objects/wifi.dart';
13 14
14 /// Represents a single recognized barcode and its value. 15 /// Represents a single recognized barcode and its value.
@@ -274,24 +275,6 @@ class Phone { @@ -274,24 +275,6 @@ class Phone {
274 type = PhoneType.values[data['type'] as int]; 275 type = PhoneType.values[data['type'] as int];
275 } 276 }
276 277
277 -/// A sms message from a 'SMS:' or similar QRCode type.  
278 -class SMS {  
279 - /// Gets the message content of the sms.  
280 - ///  
281 - /// Returns null if not available.  
282 - final String? message;  
283 -  
284 - /// Gets the phone number of the sms.  
285 - ///  
286 - /// Returns null if not available.  
287 - final String? phoneNumber;  
288 -  
289 - /// Create a [SMS] from native data.  
290 - SMS.fromNative(Map data)  
291 - : message = data['message'] as String?,  
292 - phoneNumber = data['phoneNumber'] as String?;  
293 -}  
294 -  
295 /// A URL and title from a 'MEBKM:' or similar QRCode type. 278 /// A URL and title from a 'MEBKM:' or similar QRCode type.
296 class UrlBookmark { 279 class UrlBookmark {
297 /// Gets the title of the bookmark. 280 /// Gets the title of the bookmark.
  1 +/// An sms message from a `SMS:` or similar QRCode type.
  2 +class SMS {
  3 + /// Construct a new [SMS] instance.
  4 + const SMS({
  5 + this.message,
  6 + required this.phoneNumber,
  7 + });
  8 +
  9 + /// Construct a new [SMS] instance from the given [data].
  10 + factory SMS.fromNative(Map<Object?, Object?> data) {
  11 + return SMS(
  12 + message: data['message'] as String?,
  13 + phoneNumber: data['phoneNumber'] as String? ?? '',
  14 + );
  15 + }
  16 +
  17 + /// The message contained in the sms.
  18 + final String? message;
  19 +
  20 + /// The phone number which sent the sms.
  21 + final String phoneNumber;
  22 +}