deviceInfo method
Implementation
@override
Future<LaranjinhaDeviceInfo> deviceInfo() async {
try {
final response = await methodChannel.invokeMethod<Map>('getSerialNumberAndDeviceModel');
if (response is Map) {
if ((response['code'] == LaranjinhaStatusDeeplink.SUCCESS.name) && response['data'] is Map) {
final jsonData = response['data'];
return LaranjinhaDeviceInfo.fromJson(json: jsonData);
} else {
throw LaranjinhaInfoException(message: response['message']);
}
} else {
throw LaranjinhaInfoException(message: 'invalid response');
}
} on LaranjinhaInfoException catch (e) {
throw LaranjinhaInfoException(message: e.message);
} on PlatformException catch (e) {
throw LaranjinhaInfoException(message: e.message ?? 'PlatformException');
} catch (e) {
throw LaranjinhaInfoException(message: "deviceInfo payment Error: $e");
}
}