toJson method
Implementation
Map toJson() {
Map data = {};
data.putIfNotNull(
'direction', direction == ChatSearchDirection.Up ? "up" : "down");
data.putIfNotNull('startTs', startTs);
data.putIfNotNull('endTs', endTs);
data.putIfNotNull('from', from);
data.putIfNotNull('needSave', needSave);
data.putIfNotNull('msgTypes',
msgTypes?.toSet().map<String>((e) => messageTypeToTypeStr(e)).toList());
return data;
}