Navaron Bracke

move email class to its own file; make Email type non-null

## NEXT
Improvements:
* The `type` of an `Email` is no longer null.
## 3.5.0
New Features:
* Added the option to switch between bundled and unbundled MLKit for Android. (thanks @woolfred !)
... ...
... ... @@ -14,4 +14,5 @@ export 'src/mobile_scanner_controller.dart';
export 'src/mobile_scanner_exception.dart';
export 'src/objects/barcode.dart';
export 'src/objects/barcode_capture.dart';
export 'src/objects/email.dart';
export 'src/objects/mobile_scanner_arguments.dart';
... ...
... ... @@ -5,9 +5,9 @@ import 'package:mobile_scanner/src/barcode_utility.dart';
import 'package:mobile_scanner/src/enums/address_type.dart';
import 'package:mobile_scanner/src/enums/barcode_format.dart';
import 'package:mobile_scanner/src/enums/barcode_type.dart';
import 'package:mobile_scanner/src/enums/email_type.dart';
import 'package:mobile_scanner/src/enums/encryption_type.dart';
import 'package:mobile_scanner/src/enums/phone_type.dart';
import 'package:mobile_scanner/src/objects/email.dart';
/// Represents a single recognized barcode and its value.
class Barcode {
... ... @@ -383,37 +383,6 @@ class DriverLicense {
middleName = data['middleName'] as String?;
}
/// An email message from a 'MAILTO:' or similar QRCode type.
class Email {
/// Gets email's address.
///
/// Returns null if not available.
final String? address;
/// Gets email's body.
///
/// Returns null if not available.
final String? body;
/// Gets email's subject.
///
/// Returns null if not available.
final String? subject;
/// Gets type of the email.
///
/// See also [EmailType].
/// Returns null if not available.
final EmailType? type;
/// Create a [Email] from native data.
Email.fromNative(Map data)
: address = data['address'] as String?,
body = data['body'] as String?,
subject = data['subject'] as String?,
type = EmailType.values[data['type'] as int];
}
/// GPS coordinates from a 'GEO:' or similar QRCode type.
class GeoPoint {
/// Gets the latitude.
... ...
import 'package:mobile_scanner/src/enums/email_type.dart';
/// An email message from a 'MAILTO:' or similar QRCode type.
class Email {
/// Construct a new [Email] instance.
const Email({
this.address,
this.body,
this.subject,
this.type = EmailType.unknown,
});
/// Construct an [Email] from the given [data].
factory Email.fromNative(Map<Object?, Object?> data) {
return Email(
address: data['address'] as String?,
body: data['body'] as String?,
subject: data['subject'] as String?,
type: EmailType.fromRawValue(data['type'] as int? ?? 0),
);
}
/// The email address.
final String? address;
/// The body of the email.
final String? body;
/// The subject of the email.
final String? subject;
/// The type of the email.
final EmailType type;
}
... ...