Dms class
Direct-messages usecase built on NIP-17 gift-wrapped messages.
This usecase provides app-facing helpers for:
- sending a DM to a peer
- loading the logged-in user's conversations
- loading one conversation with a specific peer
- parsing a wrapped event into a DM message model
Conversation loading uses the logged-in user's DM relay list and can reuse cached decrypted payload sidecars for fast repeated reads.
Constructors
- Dms({required Accounts accounts, required Requests requests, required Broadcast broadcast, required GiftWrap giftWrap, required UserRelayLists userRelayLists, required CacheManager cacheManager})
- Creates the direct-messages usecase.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
loadConversation(
{required String peerPubKey, bool forceRefresh = false, Duration timeout = const Duration(seconds: 5)}) → Future< List< Nip17Message> > - Loads the full conversation with one peer.
-
loadConversations(
{bool forceRefresh = false, Duration timeout = const Duration(seconds: 5)}) → Future< List< Nip17Conversation> > - Loads all conversations for the logged-in user.
-
loadConversationSnapshot(
{required String peerPubKey}) → Future< List< Nip17Message> > - Loads the conversation with one peer using cache only.
-
loadConversationsSnapshot(
) → Future< List< Nip17Conversation> > - Loads all conversations for the logged-in user using cache only.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
parseWrappedMessage(
{required Nip01Event wrappedEvent}) → Future< Nip17Message?> - Parses a single wrapped event into a DM message if possible.
-
sendMessage(
{required String recipientPubKey, required String content, List< List< additionalTags = const []}) → Future<String> >void> -
Sends a direct message to
recipientPubKey. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- kMessageKind → const int
- Message rumor kind used by this DM usecase.