BindController<S> class

Configuration for binding a controller to a ReactiveState.

BindController specifies how a controller should be created and managed within a widget's lifecycle. It controls lazy initialization, automatic disposal, and provides the factory function for controller creation.

Example:

class _MyPageState extends ReactiveState<MyPage, MyController> {
  @override
  BindController<MyController> bindController() {
    return BindController(
      controller: () => MyController(),
      autoDispose: true,  // Dispose when widget is removed
      lazyBind: false,    // Create immediately, not on first use
    );
  }

  @override
  Widget build(BuildContext context) {
    return Observer(
      listenable: controller.data,
      listener: (value) => Text(value),
    );
  }
}

Constructors

BindController({required S controller(), bool autoDispose = true, bool lazyBind = true})
Creates a BindController configuration.

Properties

autoDispose → bool
Whether to automatically dispose the controller when the widget is disposed.
final
controller → S Function()
Factory function that creates the controller instance.
final
hashCode → int
The hash code for this object.
no setterinherited
lazyBind → bool
Whether to create the controller lazily on first access.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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