Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AnimatedWidgets library calling using AnimationController methods after dispose #12

Open
parthraghav opened this issue Feb 23, 2021 · 1 comment

Comments

@parthraghav
Copy link

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 <…>

@mpiparo
Copy link

mpiparo commented Feb 26, 2022

experiencing same issue. using v1.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants