Files
syncrow-app/lib/features/app_layout/bloc/home_state.dart
Mohammad Salameh df13c66b1a Refactor API error handling and add try-catch blocks
Added try-catch blocks for error handling in API's files to rethrow the errors to the cubit so cubits can update the UI based on them.

Refactored error handling in HTTPInterceptor and HTTPService classes.
2024-04-15 15:47:13 +03:00

61 lines
1.1 KiB
Dart

part of 'home_cubit.dart';
abstract class HomeState {}
class HomeInitial extends HomeState {}
//base states
class HomeLoading extends HomeState {}
class HomeError extends HomeState {
final String errMessage;
HomeError(this.errMessage);
}
class HomeSuccess extends HomeState {}
///specific states
//get spaces
class GetSpacesLoading extends HomeLoading {}
class GetSpacesSuccess extends HomeSuccess {
final List<SpaceModel> spaces;
GetSpacesSuccess(this.spaces);
}
class GetSpacesError extends HomeError {
GetSpacesError(super.errMessage);
}
//get rooms
class GetSpaceRoomsLoading extends HomeLoading {}
class GetSpaceRoomsSuccess extends HomeSuccess {
final List<RoomModel> rooms;
GetSpaceRoomsSuccess(this.rooms);
}
class GetSpaceRoomsError extends HomeError {
GetSpaceRoomsError(super.errMessage);
}
//UI states
class SpaceSelected extends HomeState {
final SpaceModel space;
SpaceSelected(this.space);
}
class RoomSelected extends HomeState {
final RoomModel room;
RoomSelected(this.room);
}
class RoomUnSelected extends HomeState {}
class NavChangePage extends HomeState {}