ConfettiController class

Drives a ConfettiWidget manually.

Use when you need to start, stop, or reset confetti from outside the widget tree — for example, from a button press handler.

final controller = ConfettiController();

// In your widget tree:
ConfettiWidget(controller: controller, autoPlay: false, preset: Preset.nova)

// Triggered by a button:
controller.play();

// Always dispose:
@override
void dispose() {
  controller.dispose();
  super.dispose();
}

ConfettiController extends ChangeNotifier. ConfettiWidget listens internally — you don't need to call addListener yourself.

Inheritance

Constructors

ConfettiController()

Properties

hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
isPlaying bool
Convenience getter — true while the animation is running.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state ControllerState
The current lifecycle state of the animation.
no setter

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
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
kill() → void
Clears the burst immediately (manual stop).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
play() → void
Starts or restarts the confetti animation.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
reset() → void
Stops the animation and clears all particles, returning to ControllerState.idle.
stop() → void
Halts the animation mid-flight. Particles freeze in place.
toString() String
A string representation of this object.
inherited

Operators

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