Map<String, dynamic> toJson() { return { 'type': type, 'text': text, }..removeWhere((key, value) => value == null); }