setup method
Implementation
Future<void> setup() async {
var c = originalConversation;
if (c == null) {
logger.warn('Aborting messages load: no original conversation');
return;
}
if (c.messages.isNotEmpty) {
logger.warn('Aborting load messages: messages already found');
return;
}
var id = c.id;
if (id == null) {
logger.warn('Unable to load messages: no id');
return;
}
var messages = await loadThreadMessages(id);
logger.info('Found ${messages.length} messages');
messages.sortByDate((x) => x.date);
c.messages.addAll(messages);
notifyListeners();
}