getMessages method
Implementation
@override
List<DOOMessage> getMessages() {
final messageClientInstancekey = _clientInstanceKey;
//filter current client instance message ids
Set<int> clientMessageIds = _messageIdToClientInstanceKeyBox.keys
.map((e) => e as int)
.where((key) =>
_messageIdToClientInstanceKeyBox.get(key) ==
messageClientInstancekey)
.toSet();
//retrieve messages with ids
List<DOOMessage> sortedMessages = _box.values
.where((message) => clientMessageIds.contains(message.id))
.toList(growable: false);
//sort message using creation dates
sortedMessages.sort((a, b) {
return b.createdAt.compareTo(a.createdAt);
});
return sortedMessages;
}