To control the slider from outside of itself, you have to create an instance of SlideController.
SlideController
final slideController = SlideController( curve: Curves.easeOut, // optional duration: const Duration(seconds: 1), // optional );
Then pass it to the actual WidgetSlider widget.
WidgetSlider
WidgetSlider( controller: slideController, itemCount: questions.length, itemBuilder: (context, index, activeIndex) { return Card(...); } // ... )
Now, you can call its functionalities.
moveTo
slideController.moveTo?.call(3);
moveToNext
slideController.moveToNext?.call();
moveToPrevious
slideController.moveToPrevious?.call();
There was an error while loading. Please reload this page.