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() {
  if (PlatformUtils.isMobile && !PlatformUtils.isWeb) {
    BackButtonInterceptor.add(_onBack, ifNotYetIntercepted: true);
  }

  buttons = RxList(
    _toButtons(_settingsRepository?.applicationSettings.value?.pinnedActions),
  );

  _buttonsWorker = ever(buttons, (List<ChatButton> list) {
    _settingsRepository?.setPinnedActions(
      list.map((e) => e.runtimeType.toString()).toList(),
    );
  });

  String route = router.route;
  _routesWorker = ever(router.routes, (routes) {
    if (router.route != route) {
      _moreEntry?.remove();
      _moreEntry = null;
    }
  });

  super.onInit();
}