mohammad-mohammady / switcher_button

MIT License
9 stars 4 forks source link

_SwitcherButtonState#557bb(tickers: tracking 2 tickers) was disposed with an active Ticker. #5

Closed pishguy closed 3 years ago

pishguy commented 3 years ago

i put this widget into one of TabBarView child and when i switch between children i get this error:

The following assertion was thrown while finalizing the widget tree:
_SwitcherButtonState#557bb(tickers: tracking 2 tickers) was disposed with an active Ticker.

_SwitcherButtonState created a Ticker via its TickerProviderStateMixin, but at the time dispose() was called on the mixin, that Ticker was still active. All Tickers must be disposed before calling super.dispose().

Tickers used by AnimationControllers should be disposed by calling dispose() on the AnimationController itself. Otherwise, the ticker will leak.

adding this below code into source code of library can't resolve this problem:

  @override
  void dispose() {
    _rightController.dispose();
    _leftController.dispose();
    super.dispose();
  }
shaan-mephobic commented 3 years ago

Hi! I tried putting the widget in all TabBarView children but couldn't reproduce the issue. Could you try using

switcher_button:
  git: https://github.com/appiranian/switcher_button.git
pishguy commented 3 years ago

Hi! I tried putting the widget in all TabBarView children but couldn't reproduce the issue. Could you try using

switcher_button:
  git: https://github.com/appiranian/switcher_button.git

@shaan-mephobic thanks so much, problem resolved