lohanidamodar/flutter_ui_challenges

Loader one and two not working

Blacktoviche opened this issue · 4 comments

When trying to use LoaderOne or two it throws exception and keep repeating until I have to close the app
here is the exception
It's the same in loader two

══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter ( 5540): The following assertion was thrown while finalizing the widget tree:
I/flutter ( 5540): _LoaderOneState#aa4e3(ticker active) was disposed with an active Ticker.
I/flutter ( 5540): _LoaderOneState created a Ticker via its SingleTickerProviderStateMixin, but at the time dispose()
I/flutter ( 5540): was called on the mixin, that Ticker was still active. The Ticker must be disposed before calling
I/flutter ( 5540): super.dispose(). Tickers used by AnimationControllers should be disposed by calling dispose() on the
I/flutter ( 5540): AnimationController itself. Otherwise, the ticker will leak.
I/flutter ( 5540): The offending ticker was: Ticker(created by _LoaderOneState#aa4e3(lifecycle state: created))
I/flutter ( 5540): The stack trace when the Ticker was actually created was:
I/flutter ( 5540): #0 new Ticker. (package:flutter/src/scheduler/ticker.dart:64:40)
I/flutter ( 5540): #1 new Ticker (package:flutter/src/scheduler/ticker.dart:66:6)
I/flutter ( 5540): #2 __LoaderOneState&State&SingleTickerProviderStateMixin.createTicker
I/flutter ( 5540): (package:flutter/src/widgets/ticker_provider.dart:93:15)
I/flutter ( 5540): #3 new AnimationController (package:flutter/src/animation/animation_controller.dart:245:21)

@Blacktoviche did you use the complete loader widget? Because it seems like disposing of controller is missing somewhere. If you have copied the whole loader widget, there is already dispose there, shouldn't be any error.

I did copy the whole file and called it in my widget
just like that

if (model.loadingCat) {
return LoaderTwo();
} else {
return Container(
height: 120.0) etc...

It would be helpful if you could provide me a runnable code where I can reproduce the error.

I am closing this issue, as is has been inactive for more than a week. If the problem still exists. Please feel free to reopen and post your comment.