def add_field(cls, var: Var, default_value: Any):
        """Add a field to the class after class definition.

        Used by State.add_var() to correctly handle the new variable.

        Args:
            var: The variable to add a field for.
            default_value: The default value of the field.
        """
        var_name = var._var_field_name
        if types.is_immutable(default_value):
            new_field = Field(
                default=default_value,
                annotated_type=var._var_type,
            )
        else:
            new_field = Field(
                default_factory=functools.partial(copy.deepcopy, default_value),
                annotated_type=var._var_type,
            )
        cls.__fields__[var_name] = new_field
Add a field to the class after class definition.

        Used by State.add_var() to correctly handle the new variable.

        Args:
            var: The variable to add a field for.
            default_value: The default value of the field.
        
reflex/vars/base.py