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() {
super.onInit();
AppConfig.logger.t("Home Controller Init");
try {
if(Sint.arguments != null) {
if (Sint.arguments[0] is int) {
toIndex = Sint.arguments[0] as int;
} else if (Sint.arguments[0] is Event) {
event = Sint.arguments[0] as Event;
} else if (Sint.arguments[0] is String) {
toRoute = Sint.arguments[0] as String;
}
}
if (AppConfig.instance.appInUse == AppInUse.d) {
toIndex = 2;
}
if(toIndex > 0) {
_currentIndex.value = toIndex;
}
pageController = PageController(initialPage: _getPageIndexFromVisualIndex(toIndex));
pageController.addListener(() {
// int newIndex = pageController.page!.toInt();
// if (_currentIndex.value != newIndex) {
// _currentIndex.value = newIndex;
// }
});
hasItems = (userServiceImpl?.profile.favoriteItems?.length ?? 0) > 1;
} catch (e, st) {
NeomErrorLogger.recordError(e, st, module: 'neom_home', operation: 'onInit');
}
}