From 80dea5c12db3dbcbbd8a075ff89be09040c6a045 Mon Sep 17 00:00:00 2001 From: hannathkadher Date: Thu, 2 Jan 2025 17:55:04 +0400 Subject: [PATCH] fixed block flow --- .../all_spaces/bloc/space_management_bloc.dart | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/pages/spaces_management/all_spaces/bloc/space_management_bloc.dart b/lib/pages/spaces_management/all_spaces/bloc/space_management_bloc.dart index 15b014d1..2434a32c 100644 --- a/lib/pages/spaces_management/all_spaces/bloc/space_management_bloc.dart +++ b/lib/pages/spaces_management/all_spaces/bloc/space_management_bloc.dart @@ -239,11 +239,15 @@ class SpaceManagementBloc SelectCommunityEvent event, Emitter emit, ) async { - _handleCommunitySpaceStateUpdate( - emit: emit, - selectedCommunity: event.selectedCommunity, - selectedSpace: null, - ); + try { + _handleCommunitySpaceStateUpdate( + emit: emit, + selectedCommunity: event.selectedCommunity, + selectedSpace: null, + ); + } catch (e) { + emit(SpaceManagementError('Error updating state: $e')); + } } void _onSelectSpace( @@ -267,7 +271,8 @@ class SpaceManagementBloc try { if (previousState is SpaceManagementLoaded || - previousState is BlankState) { + previousState is BlankState || + previousState is SpaceModelLoaded) { final communities = List.from( (previousState as dynamic).communities, );