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