updateItem method
FollowRequestsDashboardModel
updateItem(
- FollowRequestsDashboardModel model,
- MemberActionModel oldItem,
- MemberActionModel newItem
override
Implementation
@override
FollowRequestsDashboardModel updateItem(FollowRequestsDashboardModel model,
MemberActionModel oldItem, MemberActionModel newItem) {
List<MemberActionModel> currentItems =
model.memberActions == null ? [] : model.memberActions!;
var index = currentItems.indexOf(oldItem);
if (index != -1) {
var newItems = currentItems.map((e) => e).toList();
newItems[index] = newItem;
var newModel = model.copyWith(memberActions: newItems);
return newModel;
} else {
throw Exception("Could not find $oldItem");
}
}