Reflex Cloud - Fast, secure & scalable hosting. One command to deploy.

Var

reflex.vars.base.Var

Base class for immutable vars.

Methods

SignatureDescription
equals(self, other: 'Var') -> 'bool'Check if two vars are equal.
create(cls, value: 'Any', _var_is_local: 'bool | None' = None, _var_is_string: 'bool | None' = None, _var_data: 'VarData | None' = None) -> 'Var'Create a var from a value.
create_safe(cls, *args: 'Any', **kwargs: 'Any') -> 'Var'Create a var from a value.
to(self, output: 'Type[OUTPUT] | types.GenericType', var_type: 'types.GenericType | None' = None) -> 'Var'Convert the var to a different type.
guess_type(self) -> 'Var'Guesses the type of the variable based on its `_var_type` attribute.
bool(self) -> 'BooleanVar'Convert the var to a boolean.
to_string(self, use_json: 'bool' = True) -> 'StringVar'Convert the var to a string.
js_type(self) -> 'StringVar'Returns the javascript type of the object. This method uses the `typeof` function from the `FunctionStringVar` class to determine the type of the object.
range(cls, first_endpoint: 'int | NumberVar', second_endpoint: 'int | NumberVar | None' = None, step: 'int | NumberVar | None' = None) -> 'ArrayVar[List[int]]'Create a range of numbers.