SpinnerController class

A controller used to programmatically trigger the spinning wheel.

It is a ChangeNotifier: listen to it (e.g. with a ListenableBuilder) to rebuild when isSpinning or lastResult change. If you add listeners, call dispose when you no longer need the controller.

Inheritance

Constructors

SpinnerController()

Properties

hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
isAttached → bool
Whether a SpinnerWheel is currently using this controller.
no setter
isSpinning → bool
Whether the wheel is currently spinning.
no setter
lastResult → WheelSpinResult?
The result of the most recent finished spin, if any.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
attachState(SpinnerWheelState state) → void
Attaches the controller to a SpinnerWheelState. This is called internally by the SpinnerWheel.
detachState(SpinnerWheelState state) → void
Detaches the controller from state, if it is the one attached. This is called internally when the SpinnerWheel is disposed or switches to a different controller.
dispose() → void
Discards any resources used by the object.
override
handleSpinFinished(WheelSpinResult? result) → void
Called internally by the SpinnerWheel when a spin ends, with its result, or null if the spin was abandoned.
handleSpinStarted() → void
Called internally by the SpinnerWheel when a spin starts.
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
spinTo(int index) → Future<WheelSpinResult?>
Spins the wheel so that it lands on the segment at index, ignoring probabilities. Useful when the result is decided elsewhere, e.g. by a server.
startSpin() → Future<WheelSpinResult?>
Triggers the wheel to start spinning based on the configured segments and logic.
stop() → void
Brings a spinning wheel to a quick stop.
toString() → String
A string representation of this object.
inherited

Operators

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