initialize static method
Returns if the given device is supported. This will also be used when calling the different methods
Returns null if the device is not supported
Implementation
static Future<ScanwedgeChannel> initialize() async {
try {
if (isAndroid) {
final deviceInfo = await _methodChannel.invokeMapMethod<String, dynamic>('initializeDataWedge');
debugPrint('initializeDataWedge: $deviceInfo');
if (deviceInfo != null) {
return ScanwedgeChannel._(
supportedDevice: _fetchSupportedDevice(deviceInfo['apiVersion']?.toString() ?? ''),
manufacturer: deviceInfo['manufacturer']?.toString() ?? '',
modelName: deviceInfo['model']?.toString() ?? '',
productName: deviceInfo['product']?.toString() ?? '',
osVersion: deviceInfo['osVersion']?.toString() ?? '',
packageName: deviceInfo['packageName']?.toString() ?? '',
deviceName: deviceInfo['deviceName']?.toString() ?? '',
);
}
}
} catch (e) {
debugPrint('initialize, Error: $e');
}
return ScanwedgeChannel._(supportedDevice: SupportedDevice.invalid);
}