onInit method
Called immediately after the widget is allocated in memory. You might use this to initialize something for the controller.
Implementation
@override
void onInit() {
_timer = Timer.periodic(const Duration(seconds: 5), (Timer timer) {
if (indexPage.value < 2) {
indexPage.value++;
} else {
indexPage.value = 0;
}
pageController.animateToPage(
indexPage.value,
duration: const Duration(milliseconds: 350),
curve: Curves.easeIn,
);
});
super.onInit();
}