getCurrentUserId method

Future<String?> getCurrentUserId()

Gets the current login user ID.

Return The current login user ID.

Implementation

Future<String?> getCurrentUserId() async {
  Map result =
      await ClientChannel.invokeMethod(ChatMethodKeys.getCurrentUser);
  try {
    ChatError.hasErrorFromResult(result);
    _currentUserId = result[ChatMethodKeys.getCurrentUser];
    if (_currentUserId != null) {
      if (_currentUserId!.length == 0) {
        _currentUserId = null;
      }
    }
    return _currentUserId;
  } on ChatError catch (e) {
    throw e;
  }
}