getUserVariableName method

String getUserVariableName(
  1. User user
)

For internal use only. Implementation detail that may change anytime.

Returns the JavaScript variable name of the Talk.User object associated with the given User

Implementation

String getUserVariableName(User user) {
  if (_users[user.id] == null) {
    // Generate unique variable name
    final variableName = 'user${getUniqueId()}';

    execute('const $variableName = new Talk.User(${user.getJsonString()});');
    _users[user.id] = variableName;
  }

  return _users[user.id]!;
}