Closed ride4sun closed 5 years ago
I/flutter (10993): error: _StateBuilderStateSingleTickerMix is a SingleTickerProviderStateMixin but multiple tickers were created.
I think it is not related to Flutter 1.9 version. The default TickerProvider of Animator is of type SingleTickerProviderStateMixin. The error complains that single ticker is used to create many tickers. To solve this you have to option: 1- define the parameter tickerMixin of the animator: to be equal to TickerMixin.tickerProviderStateMixin
Animator(
tickerMixin : TickerMixin.tickerProviderStateMixin,
resetAnimationOnRebuild: true,
tween: Tween<double>(begin: previousValue, end: value),
cycles: 1,
duration: animationDuration,
curve: curve,
builder: (anim) => builder(anim.value));
2- Or add a UniqueKey to the animator widget:
Animator(
key: UniqueKey(),
resetAnimationOnRebuild: true,
tween: Tween<double>(begin: previousValue, end: value),
cycles: 1,
duration: animationDuration,
curve: curve,
builder: (anim) => builder(anim.value));
I updated the package to make it the default behavior. Now you do not have to use Unique Key () or tickerMixin.
Animator(
resetAnimationOnRebuild: true,
Tween: Tween(begin: previousValue, end: value),
cycles: 1,
duration: animationDuration,
curve: curve,
builder: (anim) => builder(anim.value));
Your code will work without any modification. Please confirm that
Perfect, thx, I was just wondering about that. I will try on Monday to go back to 1.9 / 1.0. I will report back.
On Thu, Sep 12, 2019, 13:08 MELLATI Fatah notifications@github.com wrote:
I updated the package to make it the default behavior. Now you do not have to use Unique Key () or tickerMixin.
Animator( resetAnimationOnRebuild: true, Tween: Tween(begin: previousValue, end: value), cycles: 1, duration: animationDuration, curve: curve, builder: (anim) => builder(anim.value));
Your code will work without any modification. Please confirm that
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/GIfatahTH/animator/issues/20?email_source=notifications&email_token=AB3BZ2ZGANBCWKJCPGAATGTQJKOTVA5CNFSM4IVXLJY2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6TDDSY#issuecomment-530985419, or mute the thread https://github.com/notifications/unsubscribe-auth/AB3BZ22YHGCVOWVJUYEGSFTQJKOTVANCNFSM4IVXLJYQ .
@GIfatahTH works fine with the latest update without modification. Thx. This can be closed.
(10993): 2642 2019-09-11 11:14:38.719961 SEVERE home_test.sentry_error_reporter: Context: building StateWithMixinBuilder(state: _StateBuilderStateSingleTickerMix#1aa60(ticker inactive)), library: widgets library
I/flutter (10993): error: _StateBuilderStateSingleTickerMix is a SingleTickerProviderStateMixin but multiple tickers were created.
I/flutter (10993): 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/flutter (10993): #0 SingleTickerProviderStateMixin.createTicker. (package:flutter/src/widgets/ticker_provider.dart:85:7)
I/flutter (10993): #1 SingleTickerProviderStateMixin.createTicker (package:flutter/src/widgets/ticker_provider.dart:92:6)
I/flutter (10993): #2 new AnimationController (package:flutter/src/animation/animation_controller.dart:245:21)
I/flutter (10993): #3 Animate.setController (package:animator/src/animate.dart:35:18)
I/flutter (10993): #4 StatesRebuilderWithAnimator.initAnimation (package:animator/src/states_rebuilder_with_animator.dart:54:14)
I/flutter (10993): #5 _AnimatorState.build. (package:animator/src/animator.dart:174:23)
I/flutter (10993): #6 _StateBuilderStateSingleTickerMix.build. (package:states_rebuilder/src/state_with_mixin_builder.dart)
I/flutter (10993): #7 _StateBuilderState.initState (package:states_rebuilder/src/state_builder.dart:146:42)
I/flutter (10993): #8 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4068:58)
I/flutter (10993): #9 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5)
I/flutter (10993): #10 Element
all my animations are wrapped in this class:
If I downgrade animator to 0.1.1 and stay on 1.9 I get this build errors: