Navaron Bracke

move UrlBookmark to its own file

... ... @@ -4,6 +4,7 @@ Improvements:
* The `phoneNumber` of an `SMS` is now non-null.
* The `latitude` and `longitude` of a `GeoPoint` are now non-null.
* The `phones` and `urls` of `ContactInfo` are now non-null.
* The `url` of a `UrlBookmark` is now non-null.
## 3.5.0
New Features:
... ...
... ... @@ -21,4 +21,5 @@ export 'src/objects/email.dart';
export 'src/objects/geo_point.dart';
export 'src/objects/mobile_scanner_arguments.dart';
export 'src/objects/sms.dart';
export 'src/objects/url_bookmark.dart';
export 'src/objects/wifi.dart';
... ...
... ... @@ -2,7 +2,6 @@ import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:mobile_scanner/mobile_scanner.dart';
import 'package:mobile_scanner/src/objects/geo_point.dart';
Size toSize(Map data) {
final width = data['width'] as double;
... ...
... ... @@ -12,6 +12,7 @@ import 'package:mobile_scanner/src/objects/driver_license.dart';
import 'package:mobile_scanner/src/objects/email.dart';
import 'package:mobile_scanner/src/objects/geo_point.dart';
import 'package:mobile_scanner/src/objects/sms.dart';
import 'package:mobile_scanner/src/objects/url_bookmark.dart';
import 'package:mobile_scanner/src/objects/wifi.dart';
/// Represents a single recognized barcode and its value.
... ... @@ -206,21 +207,3 @@ class Phone {
: number = data['number'] as String?,
type = PhoneType.values[data['type'] as int];
}
/// A URL and title from a 'MEBKM:' or similar QRCode type.
class UrlBookmark {
/// Gets the title of the bookmark.
///
/// Returns null if not available.
final String? title;
/// Gets the url of the bookmark.
///
/// Returns null if not available.
final String? url;
/// Create a [UrlBookmark] from native data.
UrlBookmark.fromNative(Map data)
: title = data['title'] as String?,
url = data['url'] as String?;
}
... ...
/// A URL and title from a `MEBKM:` or similar QRCode type.
class UrlBookmark {
/// Construct a new [UrlBookmark] instance.
const UrlBookmark({
this.title,
required this.url,
});
/// Construct a new [UrlBookmark] instance from the given [data].
factory UrlBookmark.fromNative(Map<Object?, Object?> data) {
return UrlBookmark(
title: data['title'] as String?,
url: data['url'] as String? ?? '',
);
}
/// The title of the bookmark.
final String? title;
/// The url of the bookmark.
final String url;
}
... ...