class Device { int id; String name; String status; String location; num mode; bool isSelected; Device({this.id, this.name, this.status, this.location, this.mode}); Device.clone(Device device) { this.id = device.id; this.name = device.name; this.status = device.status; this.location = device.location; this.mode = device.mode; } Device.fromJson(Map json) { id = json['id']; name = json['name']; status = json['status']; location = json['location']; mode = json['mode']; isSelected = false; } Map toJson() { final Map data = new Map(); data['id'] = this.id; data['name'] = this.name; data['status'] = this.status; data['location'] = this.location; data['mode'] = this.mode; return data; } }