startSpin method

Future<WheelSpinResult?> startSpin()

Triggers the wheel to start spinning based on the configured segments and logic.

The returned future completes when the wheel stops, after SpinnerWheel.onComplete has been called, with the result of the spin. It completes with null if the wheel can't spin (no wheel attached, no segments) or is removed before it stops. Calling this while the wheel is already spinning does not start a new spin; the current spin's future is returned instead.

Implementation

Future<WheelSpinResult?> startSpin() async {
  if (_state == null) {
    debugPrint("Error: SpinnerWheelState is not attached to the controller!");
    return null;
  }
  return _state!.startSpin();
}