getCurrentUserId method

Future<String?> getCurrentUserId()

Gets the current login user ID.

Return The current login user ID.

Implementation

Future<String?> getCurrentUserId() async {
  try {
    Map result =
        await platform_interface.Client.instance.callNativeMethod(ChatMethodKeys.getCurrentUser);
    ChatError.hasErrorFromResult(result);
    _currentUserId = result[ChatMethodKeys.getCurrentUser];
    if (_currentUserId != null) {
      if (_currentUserId!.isEmpty) {
        _currentUserId = null;
      }
    }
    return _currentUserId;
  } catch (e) {
    rethrow;
  }
}