fromUser static method Null safety
- User? user,
- BaseChannel channel
Implementation
static Sender? fromUser(User? user, BaseChannel channel) {
if (user == null) return null;
final sender = Sender.fromJson(user.toJson());
if (channel is GroupChannel) {
sender.role = channel.myRole;
} else if (channel is OpenChannel) {
sender.role =
channel.isOperator(user.userId) ? Role.chat_operator : Role.none;
}
return sender;
}