CheckboxController class

Reactive controller for managing checkbox state with convenient methods.

Extends ValueNotifier to provide state management for checkbox widgets with built-in methods for common state transitions. Supports all three checkbox states: checked, unchecked, and indeterminate.

The controller can be used with ControlledCheckbox for reactive state management or manually to coordinate checkbox behavior across widgets.

Example:

final controller = CheckboxController(CheckboxState.unchecked);

// React to changes
controller.addListener(() {
  print('Checkbox is now: ${controller.value}');
});

// Programmatic control
controller.toggle(); // unchecked -> checked
controller.indeterminate(); // -> indeterminate
Inheritance
Mixed-in types

Constructors

CheckboxController.new(CheckboxState value)
Creates a CheckboxController with the specified initial value.

Properties

hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
isChecked bool
Returns true if the checkbox is currently checked.
no setter
isIndeterminate bool
Returns true if the checkbox is currently in indeterminate state.
no setter
isUnchecked bool
Returns true if the checkbox is currently unchecked.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value CheckboxState
The current value stored in this notifier.
getter/setter pairinherited

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
check() → void
Sets the checkbox state to checked.
dispose() → void
Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener will throw after the object is disposed).
inherited
indeterminate() → void
Sets the checkbox state to indeterminate.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
toggle() → void
Toggles between checked and unchecked states.
toggleTristate() → void
Cycles through all three states in order: checked -> unchecked -> indeterminate.
toString() String
A string representation of this object.
inherited
uncheck() → void
Sets the checkbox state to unchecked.

Operators

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