onInit method

  1. @override
void onInit()
override

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();
  page = Rx<HomeTab>(router.tab);
  pages = PageController(initialPage: page.value.index, keepPage: true);

  unreadChats.value = _myUserService.myUser.value?.unreadChatsCount ?? 0;
  _myUserSubscription = _myUserService.myUser.listen(
    (u) => unreadChats.value = u?.unreadChatsCount ?? unreadChats.value,
  );

  sideBarWidth = RxDouble(
    _settings.applicationSettings.value?.sideBarWidth ?? 350,
  );

  router.addListener(_onRouterChanged);
}