leonzone / loading

💎a flutter widget of loading progress Indicator. Easy to use, easy to extend

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AnimationController.animateWith() called after AnimationController.dispose()

rupertbulquerin opened this issue · comments

I got this error after I dismiss the dialog with BallPulseIndicator then navigate to another page.

E/flutter ( 6430): #5      BallPulseIndicator.startAnims.<anonymous closure> 
package:loading/indicator/ball_pulse_indicator.dart:55
E/flutter ( 6430): #6      new Future.delayed.<anonymous closure>  (dart:async/future.dart:316:39)
E/flutter ( 6430): #7      _rootRun  (dart:async/zone.dart:1120:38)
E/flutter ( 6430): #8      _CustomZone.run  (dart:async/zone.dart:1021:19)
E/flutter ( 6430): #9      _CustomZone.runGuarded  (dart:async/zone.dart:923:7)
E/flutter ( 6430): #10     _CustomZone.bindCallbackGuarded.<anonymous closure>  (dart:async/zone.dart:963:23)
E/flutter ( 6430): #11     _rootRun  (dart:async/zone.dart:1124:13)
E/flutter ( 6430): #12     _CustomZone.run  (dart:async/zone.dart:1021:19)
E/flutter ( 6430): #13     _CustomZone.bindCallback.<anonymous closure>  (dart:async/zone.dart:947:23)
E/flutter ( 6430): #14     Timer._createTimer.<anonymous closure>  (dart:async-patch/timer_patch.dart:21:15)
E/flutter ( 6430): #15     _Timer._runTimers  (dart:isolate-patch/timer_impl.dart:382:19)
E/flutter ( 6430): #16     _Timer._handleMessage  (dart:isolate-patch/timer_impl.dart:416:5)
E/flutter ( 6430): #17     _RawReceivePortImpl._handleMessage  (dart:isolate-patch/isolate_patch.dart:172:12)

I've got a similar exception using BallPulseIndicator in StreamBuilder during the waiting state:

AnimationController.stop() called after AnimationController.dispose() AnimationController methods should not be used after calling dispose.

And I've found that removing async and await keywords in startAnims method, just like the one in ball_beat_indicator.dart, seems to fix the issue. I don't know why, but please check this out. Thanks in advance.

Confirming the same issue in version 1.0.2

You can fix it by adding if (context.mounted)

@OverRide
void startAnim(AnimationController controller) {
if (context.mounted) {
controller.repeat(reverse: true);
}
}

in
@override startAnims(List<AnimationController> controllers)
you can simply replace
controllers[i].repeat(reverse: true);
with
if (context.mounted) controllers[i].repeat(reverse: true);
I made hot fix with pull request #15

Hi!
Same for me, but Mohamed, I will try your fix, hopefully will work. Thank you.
Did you only try to merge this fix, but still no response from the author?
By the way, I did not want to fork this repository, but its clear now that I have to do it. I fork too many repos now, because of similar bugfixes...
DaneeD

Thanks for your reply.. ill try those fixes and check if it works.