newChatMessageTitle function
Generates a title for a new chat message notification.
This function generates a title for a new chat message notification based
on the provided username
and channelName
. The title is constructed by
combining the base message "New message" with the username
and channelName
if they are provided. The resulting title string provides information about
the source of the new chat message.
@param username The username of the sender of the new chat message. @param channelName The name of the chat channel where the new message was sent. @return A title for the new chat message notification.
Implementation
String newChatMessageTitle(String? username, String? channelName) {
String baseMessage = 'New message';
if (username != null) {
baseMessage = '$baseMessage from $username';
}
if (channelName != null) {
baseMessage = '$baseMessage in $channelName';
}
return baseMessage;
}