EMClient class

~english The EMClient class, which is the entry point of the Chat SDK. With this class, you can log in, log out, and access other functionalities such as group and chatroom. ~end

~chinese 该类是 Chat SDK 的入口,负责登录、退出及连接管理等,由此可以获得其他模块的入口。 ~end

Properties

chatManager EMChatManager
~english Gets the EMChatManager class. Make sure to call it after EMClient has been initialized.
no setter
chatRoomManager EMChatRoomManager
~english Gets the EMChatRoomManager class. Make sure to call it after the EMClient has been initialized.
no setter
chatThreadManager EMChatThreadManager
~english Gets the EMChatThreadManager class. Make sure to call it after the EMClient has been initialized.
no setter
contactManager EMContactManager
~english Gets the EMContactManager class. Make sure to call it after the EMClient has been initialized.
no setter
currentUserId String?
~english Gets the current logged-in user ID. ~end
no setter
customEventHandler ↔ (void Function(Map map)?)
~english Sets a custom event handler to receive data from iOS or Android devices.
getter/setter pair
groupManager EMGroupManager
~english Gets the EMGroupManager class. Make sure to call it after the EMClient has been initialized.
no setter
hashCode int
The hash code for this object.
no setterinherited
options EMOptions?
~english Gets the configurations. ~end
no setter
presenceManager EMPresenceManager
~english Gets the EMPresenceManager class. Make sure to call it after the EMClient has been initialized.
no setter
pushManager EMPushManager
~english Gets the EMPushManager class. Make sure to call it after the EMClient has been initialized.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
userInfoManager EMUserInfoManager
~english Gets the EMUserInfoManager class. Make sure to call it after the EMClient has been initialized.
no setter

Methods

addConnectionEventHandler(String identifier, EMConnectionEventHandler handler) → void
~english Adds the connection event handler. After calling this method, you can handle new connection events when they arrive.
addMultiDeviceEventHandler(String identifier, EMMultiDeviceEventHandler handler) → void
~english Adds the multi-device event handler. After calling this method, you can handle for new multi-device events when they arrive.
changeAppKey({required String newAppKey}) Future<bool>
~english Updates the App Key, which is the unique identifier to access Agora Chat.
clearConnectionEventHandles() → void
~english Clears all connection event handlers. ~end
clearMultiDeviceEventHandles() → void
~english Clears all multi-device event handlers. ~end
compressLogs() Future<String>
~english Compresses the debug log into a gzip archive.
createAccount(String userId, String password) Future<void>
~english Registers a new user.
fetchLoggedInDevices({required String userId, required String pwdOrToken, bool isPwd = true}) Future<List<EMDeviceInfo>>
~english Gets the list of currently logged-in devices of a specified account.
getAccessToken() Future<String>
~english Gets the token of the current logged-in user. ~end
getConnectionEventHandler(String identifier) EMConnectionEventHandler?
~english Gets the connection event handler.
getCurrentUserId() Future<String?>
~english Gets the current login user ID.
getLoggedInDevicesFromServer({required String userId, required String password}) Future<List<EMDeviceInfo>>
~english Gets the list of currently logged-in devices of a specified account.
getMultiDeviceEventHandler(String identifier) EMMultiDeviceEventHandler?
~english Gets the multi-device event handler.
init(EMOptions options) Future<void>
~english Initializes the SDK.
isConnected() Future<bool>
~english Checks whether the SDK is connected to the chat server.
isLoginBefore() Future<bool>
~english Checks whether the user has logged in before and did not log out.
kickAllDevices({required String userId, required String pwdOrToken, bool isPwd = true}) Future<void>
~english Forces the specified account to log out from all devices.
kickDevice({required String userId, required String pwdOrToken, required String resource, bool isPwd = true}) Future<void>
~english Forces the specified account to log out from the specified device.
login(String userId, String pwdOrToken, [bool isPassword = true]) Future<void>
~english Logs in to the chat server with a password or token.
loginWithAgoraToken(String userId, String agoraToken) Future<void>
~english Logs in to the chat server by user ID and Agora token. This method supports automatic login.
loginWithPassword(String userId, String password) Future<void>
~english Logs in to the chat server with a password.
loginWithToken(String userId, String token) Future<void>
~english Logs in to the chat server with a token.
logout([bool unbindDeviceToken = true]) Future<void>
~english Logs out.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeConnectionEventHandler(String identifier) → void
~english Removes the connection event handler.
removeMultiDeviceEventHandler(String identifier) → void
~english Removes the multi-device event handler.
renewAgoraToken(String agoraToken) Future<void>
~english Renews the Agora token.
startCallback() Future<void>
~english Starts contact and group, chatroom callback.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

getInstance EMClient
~english Gets the SDK instance. ~end
no setter