overscroll_pop
overscroll_pop copied to clipboard
fix: ticker dispose problem while enable passing false
Exception:
Looking up a deactivated widget's ancestor is unsafe. At this point the state of the widget's element tree is no longer stable. To safely refer to a widget's ancestor in its dispose() method, save a reference to the ancestor by calling dependOnInheritedWidgetOfExactType() in the widget's didChangeDependencies() method.
StatefulElement#04b6c(DEFUNCT)(no widget, state: _OverscrollPopState#dc799(ticker inactive))
** We are preventing unnecessary ticker creation with this PR.
@SalihCanBinboga Need to check didUpdateWidget in case widget.enable is changed.
Anyway, I fixed it different way, you can have a look at latest code.
Thank you.
@SalihCanBinboga Need to check
didUpdateWidgetin casewidget.enableis changed. Anyway, I fixed it different way, you can have a look at latest code. Thank you.
Hey, first of all thank you quick answering and at the initState stage, if the animation controller is not created when enabled is false, it will prevent the creation of a ticker, which in turn will avoid unnecessary memory usage when the screen is opened. Initializing it based on the enabled check will be more beneficial for performance. Therefore, I recommend preventing unnecessary initialization. @luunc
@SalihCanBinboga , I understand your concern. However, can you try setting enable from false to true and move the widget around to pop a route to see what may happen? That might be a bigger bug.