loadConversations method

Future<List<Nip17Conversation>> loadConversations({
  1. bool forceRefresh = false,
  2. Duration timeout = const Duration(seconds: 5),
})

Loads all conversations for the logged-in user.

Conversations are grouped by peer pubkey and sorted by newest message first.

Implementation

Future<List<Nip17Conversation>> loadConversations({
  bool forceRefresh = false,
  Duration timeout = const Duration(seconds: 5),
}) async {
  final myPubKey = _requireLoggedPubKey();
  final wrappedEvents = await _loadWrappedEvents(
    myPubKey: myPubKey,
    forceRefresh: forceRefresh,
    timeout: timeout,
  );
  final messages = await _parseMessages(
    wrappedEvents: wrappedEvents,
    myPubKey: myPubKey,
    cacheOnly: false,
  );
  return _buildConversations(messages);
}