notifyMessageReceived method
void
notifyMessageReceived(})
Publishes a received message to ChatUI listeners.
Implementation
void notifyMessageReceived(
Message message, {
bool refreshChannel = true,
bool showNotification = true,
bool throttleChannelRefresh = false,
}) {
receivedMessageNotifier.value = message;
if (showNotification) {
unawaited(showLocalNotification(message));
}
for (final listener in List<NexconnAsyncMessageReceivedListener>.of(
_messageReceivedListeners,
)) {
Future.sync(() => listener(message));
}
if (refreshChannel) {
if (throttleChannelRefresh) {
_scheduleThrottledChannelRefresh();
} else {
notifyChannelNeedsRefresh();
}
}
notifyListeners();
}