loadConversationSnapshot method

Future<List<Nip17Message>> loadConversationSnapshot({
  1. required String peerPubKey,
})

Loads the conversation with one peer using cache only.

This is useful for immediate UI rendering before a background refresh.

Implementation

Future<List<Nip17Message>> loadConversationSnapshot({
  required String peerPubKey,
}) async {
  final conversations = await loadConversationsSnapshot();
  for (final conversation in conversations) {
    if (conversation.peerPubKey == peerPubKey) {
      return conversation.messages;
    }
  }
  return const [];
}