getUserVariableName method
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()}';
_users[user.id] = variableName;
execute('let $variableName = new Talk.User(${user.getJsonString()});');
_userObjs[user.id] = User.of(user);
} else if (_userObjs[user.id] != user) {
final variableName = _users[user.id]!;
execute('$variableName = new Talk.User(${user.getJsonString()});');
_userObjs[user.id] = User.of(user);
}
return _users[user.id]!;
}