Skip to main content

@control

Decorator to optionally set widget name and 'isolated' while behaving like dataclasses.dataclass.

Parameters:

  • dart_widget_name (Optional[Union[type[T], str]], default: None) - The name of widget on Dart side.
  • isolated (Optional[bool], default: None) - If True, marks the control as isolated. An isolated control is excluded from page updates when its parent control is updated.
  • post_init_args (int, default: 1) - Number of InitVar arguments to pass to post_init.
  • dataclass_kwargs (Any, default: {}) - Additional keyword arguments passed to @dataclass.

Usage:

  • Supports @control (without parentheses)
  • Supports @control("WidgetName") (with optional arguments)
  • Supports @control("WidgetName", post_init_args=1, isolated=True) to specify the number of InitVar arguments and isolation