Skip to content

control

control #

control(
    dart_widget_name: str | type[T] | None = None,
    *,
    isolated: bool | None = None,
    post_init_args: int = 1,
    **dataclass_kwargs,
) -> type[T] | Callable[[type[T]], type[T]]

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

PARAMETER DESCRIPTION
dart_widget_name

The name of widget on Dart side.

TYPE: str | type[T] | None DEFAULT: None

isolated

If True, marks the control as isolated. An isolated control is excluded from page updates when its parent control is updated.

TYPE: bool | None DEFAULT: None

post_init_args

Number of InitVar arguments to pass to post_init.

TYPE: int DEFAULT: 1

**dataclass_kwargs

Additional keyword arguments passed to @dataclass.

DEFAULT: {}

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