Navaron Bracke

move CalendarEvent to its own file

... ... @@ -14,6 +14,7 @@ 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/calendar_event.dart';
export 'src/objects/driver_license.dart';
export 'src/objects/email.dart';
export 'src/objects/mobile_scanner_arguments.dart';
... ...
... ... @@ -7,6 +7,7 @@ import 'package:mobile_scanner/src/enums/barcode_format.dart';
import 'package:mobile_scanner/src/enums/barcode_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/calendar_event.dart';
import 'package:mobile_scanner/src/objects/driver_license.dart';
import 'package:mobile_scanner/src/objects/email.dart';
... ... @@ -118,58 +119,6 @@ class Barcode {
wifi = toWiFi(data['wifi'] as Map?);
}
/// A calendar event extracted from QRCode.
class CalendarEvent {
/// Gets the description of the calendar event.
///
/// Returns null if not available.
final String? description;
/// Gets the start date time of the calendar event.
///
/// Returns null if not available.
final DateTime? start;
/// Gets the end date time of the calendar event.
///
/// Returns null if not available.
final DateTime? end;
/// Gets the location of the calendar event.
///
/// Returns null if not available.
final String? location;
/// Gets the organizer of the calendar event.
///
/// Returns null if not available.
final String? organizer;
/// Gets the status of the calendar event.
///
/// Returns null if not available.
final String? status;
/// Gets the summary of the calendar event.
///
/// Returns null if not available.
final String? summary;
/// Create a [CalendarEvent] from native data.
CalendarEvent.fromNative(Map data)
: description = data['description'] as String?,
start = data['start'] != null
? DateTime.tryParse(data['start'] as String)
: null,
end = data['end'] != null
? DateTime.tryParse(data['end'] as String)
: null,
location = data['location'] as String?,
organizer = data['organizer'] as String?,
status = data['status'] as String?,
summary = data['summary'] as String?;
}
/// A person's or organization's business card. For example a VCARD.
class ContactInfo {
/// Gets contact person's addresses.
... ...
/// A calendar event extracted from a QRCode.
class CalendarEvent {
/// Create a new [CalendarEvent] instance.
const CalendarEvent({
this.description,
this.start,
this.end,
this.location,
this.organizer,
this.status,
this.summary,
});
/// Create a new [CalendarEvent] instance from a map.
factory CalendarEvent.fromNative(Map<Object?, Object?> data) {
return CalendarEvent(
description: data['description'] as String?,
start: DateTime.tryParse(data['start'] as String? ?? ''),
end: DateTime.tryParse(data['end'] as String? ?? ''),
location: data['location'] as String?,
organizer: data['organizer'] as String?,
status: data['status'] as String?,
summary: data['summary'] as String?,
);
}
/// The description of the calendar event.
final String? description;
/// The start time of the calendar event.
final DateTime? start;
/// The end time of the calendar event.
final DateTime? end;
/// The location of the calendar event.
final String? location;
/// The organizer of the calendar event.
final String? organizer;
/// The status of the calendar event.
final String? status;
/// The summary of the calendar event.
final String? summary;
}
... ...