canAddMessage method
- CollectionEventSource eventSource,
- BaseMessage addedMessage
Implementation
bool canAddMessage(
CollectionEventSource eventSource,
BaseMessage addedMessage,
) {
if (eventSource == CollectionEventSource.messageLoadPrevious ||
eventSource == CollectionEventSource.messageLoadNext) {
return true;
}
if (messageList.isEmpty) {
return false;
}
if (messageList.isNotEmpty && hasNext) {
final a = messageList.last;
final b = addedMessage;
if (a.createdAt < b.createdAt) {
return false;
}
}
return true;
}