Skip to content

Commit bb94667

Browse files
authored
Merge pull request #847 from RahulShaw321/fix/dashboard-calendar-crash
fix: defer loadEvents() to avoid context null crash
2 parents ad9570b + 48b2c92 commit bb94667

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/widgets/dashboard/calendar.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,10 @@ class _DashboardCalendarWidgetState extends State<DashboardCalendarWidget>
7878
_events = <String, List<Event>>{};
7979
_selectedDay = _focusedDay;
8080
_selectedEvents = ValueNotifier(_getEventsForDay(_selectedDay!));
81-
loadEvents();
81+
//Fix: Defer context-dependent loadEvents() until after build
82+
WidgetsBinding.instance.addPostFrameCallback((_) {
83+
loadEvents();
84+
});
8285
}
8386

8487
void loadEvents() async {

0 commit comments

Comments
 (0)