sender property
- @JsonKey(name: 'user')
The Sender of the message. If SendbirdChatOptions.useMemberInfoInMessage is set true
and this message belongs to a GroupChannel (not a super group channel),
the sender information, such as nickname and profile url, is returned as the same with the GroupChannel.members.
Otherwise, the sender information will be returned as the value of the message creation time.
Implementation
@JsonKey(name: 'user')
Sender? get sender {
if (_sender == null) return null;
if (chat.chatContext.options.useMemberInfoInMessage) {
final channel =
chat.channelCache.find<BaseChannel>(channelKey: channelUrl);
if (channel is GroupChannel) {
final member = channel.getMember(_sender!.userId);
if (member != null) {
_sender!.nickname = member.nickname;
_sender!.profileUrl = member.profileUrl;
_sender!.metaData = member.metaData;
}
}
}
return _sender;
}
Implementation
set sender(value) => _sender = value;