AnimatedWidgets
AnimatedWidgets copied to clipboard
AnimatedWidgets library calling using AnimationController methods after dispose
I'm using CustomAnimatedWidget. However, sometimes a frame-drop occurs and the app throws an exception saying that the AnimationController methods should not be used after calling dispose. The error originates in the library. Hoping to see a fix soon!
Code:
CustomAnimatedWidget(
enabled: _isVisible,
duration: Duration(milliseconds: 300),
curve: Curves.easeOut,
builder: (context, percent) {
final double animatedScale = 1 * percent;
final double animatedOpacity = 1 * percent;
final double animatedClipHeightFactor = 0.7 + 0.3 * percent;
return Transform.scale(
scale: animatedScale,
alignment: Alignment.center,
child: ...
);
},
animationFinished: (bool smthn) {
Debugging.log("animation finished");
},
);
Error trace:
[VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: 'package:flutter/src/animation/animation_controller.dart': Failed assertion: line 455 pos 7: '_ticker != null': AnimationController.forward() called after AnimationController.dispose() AnimationController methods should not be used after calling dispose. #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:42:39) #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:38:5) #2 AnimationController.forward package:flutter/…/animation/animation_controller.dart:455 #3 _CustomAnimatedWidget._updateAnimationState package:animated_widgets/widgets/custom_animated.dart:65
#4 _CustomAnimatedWidget.didUpdateWidget package:animated_widgets/widgets/custom_animated.dart:52 #5 StatefulElement.update package:flutter/…/widgets/framework.dart:4690 #6 Element.updateChild package:flutter/…/widgets/framework.dart:3201 #7 ComponentElement.performRebuild <…>
experiencing same issue. using v1.1.0