79309763

Date: 2024-12-26 15:11:07
Score: 1.5
Natty:
Report link

calendar_view's EventController has a Filter function that allows to filter the showed items. This makes it possible to handle all the events in one single controller, which makes updates much faster, and allows to handle the viewing login without interfering with the business logic. My was a very particular case, but if can be of any help:

myUpdateFilter() {
  super.updateFilter(newFilter: (date, events) => myEventFilter(date, events));
}

List<Event> myEventFilter<T extends Object?>(
  DateTime date, List<CalendarEventData<T>> events) {
  return events
    .whereType<Event>()
    .where(
        (event) => event.occursOnDate(date) && event.confirmed() == private)
    .toList();
}
Reasons:
  • Blacklisted phrase (1): any help
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Serotan