DeviceIot.fromJson constructor
DeviceIot.fromJson(
- Map<String, dynamic> json
)
Implementation
DeviceIot.fromJson(Map<String, dynamic> json)
: id = json['id'].toString(),
sn = ifNullReturnEmpty(json['sn']),
model = ifNullReturnEmpty(json['model']),
name = ifNullReturnEmpty(json['name']),
sammy = ifNullReturnEmpty(json['sammy']),
localip = ifNullReturnEmpty(json['localip']),
fwName = ifNullReturnEmpty(json['fw_name']),
fwVersion = ifNullReturnEmpty(json['fw_version']),
stats = ifNullReturnEmpty(json['stats']),
state = (json.containsKey('state'))
? ifNullReturnEmpty(json['state'])
: 'lost',
desc = ifNullReturnEmpty(json['desc']),
mapLng = ifNullReturnEmpty(json['map_lng']),
mapLat = ifNullReturnEmpty(json['map_lat']),
logo = ifNullReturnEmpty(json['logo']),
nodes = getNodes(json),
born = ifNullReturnEmpty(json['born']),
adminId = ifNullReturnEmpty(json['admin_id']),
developerId = json['developer_id'].toString(),
isLogged = json['is_logged'] == true,
serverTime = json['server_time'] == true,
status = json['status'] == true,
reset = json.containsKey('reset') ? json['reset'] == true : false,
restart = json.containsKey('restart') ? json['restart'] == true : false,
mac = ifNullReturnEmpty(json['mac']),
options = (json.containsKey('options') && json['options'] != null)
? DeviceOption.fromJson(json['options'])
: const DeviceOption(),
wgt = (json.containsKey('widget') && json['widget'] != null)
? Wgt.fromJson(json['widget'])
: const Wgt(model: null),
fwUpdateMode = (json.containsKey('fw_update_mode'))
? ifNullReturnEmpty(json['fw_update_mode'])
: 'auto',
fwSize = (json.containsKey('fw_size')) ? json['fw_size'] : 0,
fwVersionCode =
(json.containsKey('fw_version_code')) ? json['fw_version_code'] : 0;