import 'package:bloc/bloc.dart'; import 'package:meta/meta.dart'; import 'package:common_project/common_project.dart'; import 'package:module_home/dso/apis/home_main_api.dart'; import 'package:module_home/model/home_hot_room_list_model.dart'; part 'home_follow_state.dart'; class HomeFollowCubit extends Cubit { HomeFollowCubit() : super(HomeFollowState().init()) { myFavRoom(); getHotRooms(); } void myFavRoom()async{ MeFavRoomModel model = await HomeMainApi.getFavRoomList(1); if(model.success == true && model.data != null){ if(model.data!.list != null){ emit(state.clone()..favRoomItems = model.data!.list!); } } else { emit(state.clone()..favRoomItems = []); } } void getHotRooms()async { HomeHotRoomListModel model = await HomeMainApi.getHotRoomList(pageIndex: 1, categoryId: "6"); if(model.success == true && model.data != null){ if(model.data!.list != null && model.data!.list!.length > 0){ emit(state.clone()..hotRoomItems = model.data!.list); } } } }