flutter_calendar_view
flutter_calendar_view copied to clipboard
Proper way to remove all events of a day?
What is the proper way to remove all events of a day?
I'm trying with below code
var controller = CalendarControllerProvider.of(context).controller;
var existingSlots = controller.getEventsOnDay(state.selectedDate);
existingSlots.forEach((event) {
controller.remove(event);
});
E/flutter (21441): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: Concurrent modification during iteration: Instance(length:29) of '_GrowableList'. E/flutter (21441): #0 ListIterator.moveNext (dart:_internal/iterable.dart:336:7) E/flutter (21441): #1 _MonthEvent.removeEvent (package:calendar_view/src/event_controller.dart:204:21) E/flutter (21441): #2 _YearEvent.removeEvent (package:calendar_view/src/event_controller.dart:174:11) E/flutter (21441): #3 EventController.remove (package:calendar_view/src/event_controller.dart:58:11)
Hi, this error is fixed by my pr #27
@drunkendaddy Thanks for sharing. Can you please check in latest release.
Added in 1.0.1 PR #116