SDKsFlutter
Create a contact card message
Create a user card message with the OpenIM Flutter SDK.
Construct a contact card message to recommend a user to participants in a conversation:
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
userID | String | Yes | Target user ID recommended by the card. |
nickname | String | Yes | Nickname of the target user. |
faceURL | String? | No | Avatar URL of the target user. |
Code example
final message = await OpenIM.iMManager.messageManager.createCardMessage(
userID: userID,
nickname: nickname,
faceURL: faceURL,
);The nickname and avatar in a card message are stored as a point-in-time snapshot and do not update automatically when the user subsequently edits their profile.
Return value
Returns a Future resolving to a card Message object ready for transmission. Its card payload is stored in cardElem.
State changes after the call
Creating a message only constructs the local message data structure in memory; it does not perform network transmission and does not trigger new-message event callbacks. Once constructed, pass the returned Message instance to Send a message to deliver it to a direct or group conversation.
Was this page helpful?