Skip to content

Commit 48b2c92

Browse files
author
RahulShaw321
committed
fix: defer loadEvents() to avoid context null crash
1 parent ad9570b commit 48b2c92

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)