class ToDeviceEvent { String sender; String type; Map content; ToDeviceEvent({this.sender, this.type, this.content}); ToDeviceEvent.fromJson(Map json) { sender = json['sender']; type = json['type']; content = json['content'] != null ? Map.from(json['content']) : null; } Map toJson() { var map = {}; final data = map; data['sender'] = sender; data['type'] = type; if (content != null) { data['content'] = content; } return data; } } class ToDeviceEventDecryptionError extends ToDeviceEvent { Exception exception; StackTrace stackTrace; ToDeviceEventDecryptionError({ ToDeviceEvent toDeviceEvent, this.exception, this.stackTrace, }) : super( sender: toDeviceEvent.sender, content: toDeviceEvent.content, type: toDeviceEvent.type, ); }