homePageVmProvider top-level property

ViewProvider<HomePageVm> homePageVmProvider
final

Implementation

final homePageVmProvider = ViewProvider((ref) {
  final state = ref.watch(homePageControllerProvider);
  final serverState = ref.watch(serverProvider);

  return HomePageVm(
    pageController: state.pageController,
    currentTab: state.currentTab,
    serverRunning: serverState.running,
    clientConnected: serverState.clientConnected,
    changeTab: (tab) {
      if (tab == state.currentTab.index) {
        return;
      }

      ref
          .redux(homePageControllerProvider)
          .dispatch(SetHomeTabAction(HomeTab.values[tab]));
    },
  );
});