i am using GetX as a state management and i have a list declared inside a controller like this..
List<Chair> selectedSeats = <Chair>[].obs;
i have two methods inside to add and delete item to/from the list.
this i use to add the chair
void addSelectedChair(Chair chair) {
if (selectedSeats.contains(chair.chairName)) {
return;
} else {
selectedSeats.add(chair);
}
update();
print(chair.chairName);
}
and this i use to delete the chair from the list..
final controller = Get.put(SeatController());
// this is how i call this method
//controller.removeSelectedChair(this.widget.customList[index].chairName);
//like controller.removeSelectedChair("C2");
void removeSelectedChair(String chair) {
selectedSeats.removeWhere(((item)=>item.chairName == chair));
print(chair);
update();
}
but i cant get the remove to work... why isnt it removing a chair from the selectedSeats list..
here is the chair model, if its any of use..
enum ReserveState { available, reserved, selected }
class Chair {
ReserveState reserveState;
int rowNum;
int cNum;
String chairName = '';
Chair(this.rowNum, this.cNum,this.reserveState,this.chairName);
}