handleLoadMore method Null safety

  1. @protected
Future<void> handleLoadMore(
  1. DateTime startDate,
  2. DateTime endDate
)

Called when loadMoreAppointments function is called from the loadMoreWidgetBuilder. Call the notifyListeners to notify the calendar for data source changes.

See also: SfCalendar.loadMoreWidgetBuilder

 @override
 Future<void> handleLoadMore(DateTime startDate, DateTime endDate) async {
 await Future.delayed(Duration(seconds: 5));
   List<Appointment> newColl = <Appointment>[];
   for (DateTime date = startDate;
       date.isBefore(endDate);
       date = date.add(Duration(days: 1))) {
     newColl.add(Appointment(
       startTime: date,
       endTime: date.add(Duration(hours: 2)),
       subject: 'Meeting',
       color: Colors.red,
     ));
   }

   appointments!.addAll(newColl);
   notifyListeners(CalendarDataSourceAction.add, newColl);
 }

Implementation

@protected
Future<void> handleLoadMore(DateTime startDate, DateTime endDate) async {}