DeviceInfo.fromMap constructor

DeviceInfo.fromMap(
  1. Map<String, dynamic> map
)

Implementation

factory DeviceInfo.fromMap(Map<String, dynamic> map) {
  return DeviceInfo(
    deviceId: map['deviceId'] != 'null' ? int.parse(map['deviceId']) : null,
    version: map['version'] != 'null' ? map['version'] ?? '' : '',
    deviceName: map['deviceName'] != 'null' ? map['deviceName'] ?? '' : '',
    manufacturerName: map['manufacturerName'] != 'null'
        ? map['manufacturerName'] ?? ''
        : '',
    productName: map['productName'] != 'null' ? map['productName'] ?? '' : '',
    productId:
        map['productId'] != 'null' ? int.parse(map['productId']) : null,
    vendorId: map['vendorId'] != 'null' ? int.parse(map['vendorId']) : null,
    serialNumber:
        map['serialNumber'] != 'null' ? map['serialNumber'] ?? '' : '',
  );
}