You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Removes all the [events] from this controller.voidremoveAll(List<CalendarEventData<T>> events) {
for (final event in events) {
_calendarData.removeEvent(event);
}
notifyListeners();
}
causes a
ConcurrentModificationError (Concurrent modification during iteration: Instance of 'UnmodifiableListView<CalendarEventData<JobEventEx>>'.)
So the issue is that I'm trying to remove all events from the controller so I can reload it.
Obviously passing in the same list of events as we are going to iterate over is always going to be an issue.
There does feel like there is an api design flaw here, because the events we need to remove are always going to be held in the controller.
A couple of solutions:
Add a 'clear' method to the api to clear the list of events from the controller - this will reduce the chance that someone will
use the api the way I did.
Have the code always iterate over a copy of the events - could be expensive give that each event holds user data.
Add a comment in the api doc to warn the user might be sufficient.
The text was updated successfully, but these errors were encountered:
The removeAll method causes a concurrency modification exception when you try to remove all events from the controller.
causes a
So the issue is that I'm trying to remove all events from the controller so I can reload it.
Obviously passing in the same list of events as we are going to iterate over is always going to be an issue.
There does feel like there is an api design flaw here, because the events we need to remove are always going to be held in the controller.
A couple of solutions:
Add a 'clear' method to the api to clear the list of events from the controller - this will reduce the chance that someone will
use the api the way I did.
Have the code always iterate over a copy of the events - could be expensive give that each event holds user data.
Add a comment in the api doc to warn the user might be sufficient.
The text was updated successfully, but these errors were encountered: