I implemented animation in some pages, and I have used SingleTickerProviderStateMixin, when I hot reload the screen, it throws an error as follows.
If a State is used for multiple AnimationController objects, or if it is passed to other objects and those objects might use it more than one time in total, then instead of mixing in a SingleTickerProviderStateMixin, use a regular TickerProviderStateMixin.
E/flutter ( 7919): [ERROR:flutter/shell/common/shell.cc(178)] Dart Error: Unhandled exception:
E/flutter ( 7919): _SplashState is a SingleTickerProviderStateMixin but multiple tickers were created.
E/flutter ( 7919): A SingleTickerProviderStateMixin can only be used as a TickerProvider once. If a State is used for multiple AnimationController objects, or if it is passed to other objects and those objects might use it more than one time in total, then instead of mixing in a SingleTickerProviderStateMixin, use a regular TickerProviderStateMixin.
I used TickerProviderStateMixin
instead of SingleTickerProviderStateMixin
.
I figured out that I used a sub widget that uses animation as well, so it counts as multiple AnimationController
objects.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With