toJson method Null safety
override
Implementation
@override
Map<String, dynamic> toJson() {
final ret = super.toJson();
if (ret['mentioned_user_ids'] == null) {
List? result = ret['mentioned_users'];
var userList = result?.map((e) => e['user_id'].toString()).toList();
if (userList?.isNotEmpty ?? false) {
ret['mentioned_user_ids'] = userList;
}
}
ret['url'] = uploadFile.url;
ret['name'] = uploadFile.name;
ret['size'] = uploadFile.fileSize;
ret['type'] = uploadFile.mimeType;
ret.removeWhere((key, value) => value == null);
return ret;
}