BloomController class abstract

Base class for Bloom state controllers.

Manages reactive state lifecycle, automated effect disposal, and DI integration. Subclasses can define signals, register side-effects with addEffect, and perform cleanup in onDispose.

Example:

class CounterController extends BloomController {
  final count = signal(0);

  @override
  void onInit() {
    super.onInit();
    addEffect(() => print('Counter: ${count.value}'));
  }

  void increment() => count.value++;
}

Constructors

BloomController()
Creates a BloomController and immediately invokes onInit.

Properties

hashCode int
The hash code for this object.
no setterinherited
isDisposed bool
Whether this controller has been disposed.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addEffect(void effectCb(), {String? debugLabel}) → void
Registers an effectCb that will automatically be disposed when this controller is disposed.
autoDispose(void cleanup()) → void
Registers a custom cleanup callback to run when this controller is disposed.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onDispose() → void
Disposes all registered effects, listeners, and resources.
onInit() → void
Called immediately when the controller is constructed.
toString() String
A string representation of this object.
inherited

Operators

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