CalendarWeekViewModel constructor
CalendarWeekViewModel(
- BuildContext context, {
- AbstractApiInterface? apiInterface,
- DateTime? initialDate,
Creates a CalendarWeekViewModel with the given repository and template provider.
It listens to changes in the CalendarTemplateProvider to refetch events when the selected template changes.
Implementation
CalendarWeekViewModel(BuildContext context,
{AbstractApiInterface? apiInterface, DateTime? initialDate})
: _calendarRepository =
context.read<CalendarMonthRepository>(), // Read from Provider
_templateProvider = context.read<CalendarTemplateProvider?>(),
_displayDate = initialDate ?? DateTime.now() {
// Initialize _displayDate here
_templateProvider?.addListener(_onDependenciesChanged);
}