getCurrentUserId method
~english Gets the current login user ID.
Return The current login user ID. ~end
~chinese 获取当前登录的用户 ID。
Return 当前登录的用户 ID。 ~end
Implementation
Future<String?> getCurrentUserId() async {
try {
Map result =
await Client.instance.callNativeMethod(ChatMethodKeys.getCurrentUser);
EMError.hasErrorFromResult(result);
_currentUserId = result[ChatMethodKeys.getCurrentUser];
if (_currentUserId != null) {
if (_currentUserId!.isEmpty) {
_currentUserId = null;
}
}
return _currentUserId;
} catch (e) {
rethrow;
}
}