【Flutter】「Tickers used by AnimationControllers should be disposed by calling dispose() on the AnimationController itself. Otherwise, the ticker will leak.」 というエラーが発生

エラーの内容

Flutterで他の方が作ったソースを実行していると、以下のエラーが発生した。

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

問題点と解決方法

AnimationControllerを複数使用しているソースで、その中の一つがdisposeされていなかった。
StatefulWidgetのdispose()で全てのAnimationControllerをdispose()するようにしたら、エラーが発生しなくなった。

@override
  void dispose() {
    _bottomNavigationAndHomeTopBackgroundContainerAnimationController.dispose(); //←ここを追加
    for (var i = 0; i < bottomNavItemDetails.length; i++) {
      _bottomNavigationItemScaleAnimationController[i].dispose();
    }
    super.dispose();
  }

参考

Flutter AnimationControllerのdispose()で詰まった件