Navaron Bracke

move WiFi to its own file

... ... @@ -18,3 +18,4 @@ export 'src/objects/calendar_event.dart';
export 'src/objects/driver_license.dart';
export 'src/objects/email.dart';
export 'src/objects/mobile_scanner_arguments.dart';
export 'src/objects/wifi.dart';
... ...
... ... @@ -5,11 +5,11 @@ 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/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';
import 'package:mobile_scanner/src/objects/wifi.dart';
/// Represents a single recognized barcode and its value.
class Barcode {
... ... @@ -309,27 +309,3 @@ class UrlBookmark {
: title = data['title'] as String?,
url = data['url'] as String?;
}
/// A wifi network parameters from a 'WIFI:' or similar QRCode type.
class WiFi {
/// Gets the encryption type of the WIFI.
///
/// See all [EncryptionType].
final EncryptionType encryptionType;
/// Gets the ssid of the WIFI.
///
/// Returns null if not available.
final String? ssid;
/// Gets the password of the WIFI.
///
/// Returns null if not available.
final String? password;
/// Create a [WiFi] from native data.
WiFi.fromNative(Map data)
: encryptionType = EncryptionType.values[data['encryptionType'] as int],
ssid = data['ssid'] as String?,
password = data['password'] as String?;
}
... ...
import 'package:mobile_scanner/src/enums/barcode_type.dart';
import 'package:mobile_scanner/src/enums/encryption_type.dart';
/// Wireless network information from [BarcodeType.wifi] barcodes.
class WiFi {
/// Construct a new [WiFi] instance.
const WiFi({
this.encryptionType = EncryptionType.none,
this.ssid,
this.password,
});
/// Construct a new [WiFi] instance from the given [data].
factory WiFi.fromNative(Map<Object?, Object?> data) {
return WiFi(
encryptionType: EncryptionType.fromRawValue(
data['encryptionType'] as int? ?? 0,
),
ssid: data['ssid'] as String?,
password: data['password'] as String?,
);
}
/// The encryption type of the wireless network.
final EncryptionType encryptionType;
/// The ssid of the wireless network.
final String? ssid;
/// The password of the wireless network.
final String? password;
}
... ...