pinkfish/flutter_calendar

Exception CalendarWidgetState.dispose - When Flutter unmount and dispose CalendarWidget

encubos opened this issue · 1 comments

Hi.

Can I use multiple Calendars in one screen ??
I have 2 or 3 tabs, and I am trying to put one Calendar inside each tab.

I am getting this error in the debug console.

═══ Exception caught by widgets library ══════
The following assertion was thrown while finalizing the widget tree:
'package:flutter/src/widgets/framework.dart': Failed assertion: line 1217 pos 12: '_debugLifecycleState == _StateLifecycle.ready': is not true.

With this detail

When the exception was thrown, this was the stack
#2 State.dispose
package:flutter/…/widgets/framework.dart:1217
#3 CalendarWidgetState.dispose
package:sliver_calendar/src/calendar.dart:158

#4 StatefulElement.unmount
package:flutter/…/widgets/framework.dart:4435
#5 _InactiveElements._unmount
package:flutter/…/widgets/framework.dart:1748
#6 _InactiveElements._unmount.
package:flutter/…/widgets/framework.dart:1746
...
════════════════════════════

Maybe is something wrong in my code, but I cant make it work properly.

I am using the calendar inside TabBarView.
Each TabBarView has a CalendarWidget... so I have multiple of them in my widget tree!

The error appears in the debug console when I scroll to the second Tab.

Any idea? Thanks in advance.

Well, this error already exists...
But it was not because I was using multiple CalendarWidget.

Happened when flutter try to unmount and dispose() the CalendarWidget.

A simplified is just putting CalendarWidget in a page and the navigate to other page.