import '../devices/device_model.dart'; class DeviceWithAlias { String? extId; String? thingId; String? thingKey; List? channels; String? areaPath; String? fvers; String? name; HardwareInfo? hardwareInfo; Settings? settings; Status? status; DateTime? connectionTime; int? state; String? visibility; DateTime? createdAt; DateTime? updatedAt; bool? isOwner; String? ownerId; String? ownerName; String? alias; DeviceWithAlias({ this.extId, this.thingId, this.thingKey, this.channels, this.areaPath, this.fvers, this.name, this.hardwareInfo, this.settings, this.status, this.connectionTime, this.state, this.visibility, this.createdAt, this.updatedAt, this.isOwner, this.ownerId, this.ownerName, this.alias, }); DeviceWithAlias.fromJson(Map json) { extId = json['ext_id']; thingId = json['thing_id']; thingKey = json['thing_key']; if (json['channels'] != null) { channels = []; json['channels'].forEach((v) { channels!.add(v); }); } areaPath = json['area_path']; fvers = json['fvers']; name = json['name']; hardwareInfo = json['hardware_info'] != null ? HardwareInfo.fromJson(json['hardware_info']) : null; settings = json['settings'] != null ? Settings.fromJson(json['settings']) : null; status = json['status'] != null ? Status.fromJson(json['status']) : null; connectionTime = DateTime.parse(json['connection_time']); state = json['state']; visibility = json['visibility']; createdAt = DateTime.parse(json['created_at']); updatedAt = DateTime.parse(json['updated_at']); isOwner = json['is_owner']; ownerId = json['owner_id']; ownerName = json['owner_name']; alias = json['alias']; } static List fromJsonDynamicList(List list) { return list.map((e) => DeviceWithAlias.fromJson(e)).toList(); } }