WuKongIM Docs

Flutter API reference

Find common wukongimfluttersdk entry points, listeners, models, and states by manager.

This page is a quick lookup. Return to each task page for complete usage and call order. The SDK singleton is WKIM.shared.

Initialization

APIPurpose
setup(Options)Configure the current user and open that UID's local database
Options.newDefault(uid, token, {addr})Create the default options
Options.getAddrSupply a connection address dynamically
connectionManagerConnection and state
messageManagerMessage sending, receiving, and queries
conversationManagerConversation list and unread counts
channelManagerUser and group metadata

WKConnectionManager

APIPurpose
connect()Start connecting
disconnect(false)Disconnect while retaining the current account
disconnect(true)Log out
addOnConnectionStatus(key, listener)Observe connection state
removeOnConnectionStatus(key)Remove the state listener

States: fail, success, kicked, syncMsg, connecting, noNetwork, and syncCompleted.

WKMessageManager

APIPurpose
sendWithOption(content, channel, options)Send and await local processing
sendMessage(content, channel)Send with default options
addOnMsgInsertedListenerObserve local insertion; one global callback
addOnRefreshMsgListener(key, listener)Observe message-object and send-state changes
addOnNewMsgListener(key, listener)Observe newly received messages
getOrSyncHistoryMessagesRead local history and request remote history when needed
addOnSyncChannelMsgListenerConnect a remote history API
addOnUploadAttachmentListenerConnect media upload
registerMsgContentRegister a custom payload

Use the same key with removeOnRefreshMsgListener and removeNewMsgListener when a screen is disposed.

WKConversationManager

APIPurpose
getAll()Read all local conversations
getAllUnreadCount()Read the total unread count
getWithChannel(channelID, channelType)Read one channel's conversation
updateRedDot(channelID, channelType, count)Update its unread count
deleteMsg(channelID, channelType)Remove the conversation-list item
addOnRefreshMsgListListener(key, listener)Observe conversation batches
addOnSyncConversationListenerConnect the multi-device conversation API

WKChannelManager

APIPurpose
getChannel(channelID, channelType)Read local channel metadata
fetchChannelInfo(channelID, channelType)Request a metadata refresh
addOnGetChannelListenerConnect your user and group metadata API
addOrUpdateChannelSave metadata locally
addOnRefreshListener(key, listener)Observe metadata changes

Common models

TypeMeaning
WKChannelchannelID and channelType together identify a chat target
WKMsgMessage identity, payload, sequence, and send state
WKMessageContentBase class for message payloads
WKTextContent / WKImageContentBuilt-in text and image payloads
WKUIConversationMsgA conversation-list item and its unread count
WKSyncConversation / WKSyncChannelMsgSync results returned from your API to the SDK

Common channel types are WKChannelType.personal and WKChannelType.group. Send states are WKSendMsgResult.sendLoading, sendSuccess, and sendFail.

On this page