ControlRoot class

The root widget for the control framework. It initializes the theme, application states, and other global dependencies. It's the main entry point for a Control-based application structure.

Inheritance

Constructors

ControlRoot({ThemeConfig? theme, AppState? initState, List<AppStateBuilder> states = const [], List stateNotifiers = const [], List builders = const [], required Widget builder(RootContext context, Widget home), dynamic onSetupChanged(RootContext context)?, Map initArgs = const {}})
const

Properties

autoMountControls bool
If true, all ControlModels found in the widget's arguments will be automatically initialized and mounted. Defaults to false.
no setterinherited
builder Widget Function(RootContext context, Widget home)
A function that builds the root widget tree, providing access to the RootContext.
final
builders List
A list of additional builders to be evaluated and registered.
final
hashCode int
The hash code for this object.
no setterinherited
initArgs Map
A map of initial arguments to be passed to the CoreContext.
finalinherited
initState AppState?
The initial AppState to use when the app starts. Defaults to AppState.init.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onSetupChanged → dynamic Function(RootContext context)?
A callback that is triggered when the application's global setup changes (e.g., theme or language).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stateNotifiers List
A list of objects that notify the ControlRoot of state changes (e.g., Observables).
final
states List<AppStateBuilder>
A list of AppStateBuilders that define the available states and their builders.
final
theme ThemeConfig?
Configuration for the application's theme.
final

Methods

build(BuildContext context) Widget
Builds the widget's UI.
override
createElement() CoreContext
Creates a StatefulElement to manage this widget's location in the tree.
override
createState() ControlState<_ControlWidgetBase>
Creates the mutable state for this widget at a given location in the tree.
inherited
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
init(CoreContext context) → void
A preliminary initialization method called by the CoreContext. This is a good place for mixins to hook into the initialization process.
inherited
initControls(CoreContext context) List<ControlModel>
Returns a list of ControlModels to be initialized and managed by this widget. This method is called once during state initialization.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onChangeState(ControlState<_ControlWidgetBase> state, dynamic value) → void
Called when the state is notified of a change from one of its notifiers.
inherited
onDependencyChanged(CoreContext context) → void
Called when a dependency of this widget changes. See State.didChangeDependencies for more information.
inherited
onDispose() → void
Called when the widget is being disposed.
inherited
onInit(Map args, CoreContext context) → void
Called once when the state is fully initialized and the context is available.
override
onInitState(ControlState<_ControlWidgetBase> state) → void
Called after the state and all its controls have been initialized.
inherited
onUpdate(CoreContext context, CoreWidget oldWidget) → void
Called when the widget is updated with new configuration. See State.didUpdateWidget for more information.
inherited
rebuild(CoreContext context) Widget
Abstract method for building the widget's UI. Implemented by subclasses like ControlWidget and SingleControlWidget.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited