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

addListener was called on null #4

Open
nomadme opened this issue Jan 21, 2020 · 1 comment
Open

addListener was called on null #4

nomadme opened this issue Jan 21, 2020 · 1 comment

Comments

@nomadme
Copy link

nomadme commented Jan 21, 2020

Whenever I ran the controller, it is crashing.

The method 'addListener' was called on null.
Receiver: null
Tried calling: addListener(Closure: () => void from Function '_listener@47216319':.)

in my class:

class Foo extends State<Bar> with TickerProviderStateMixin {
GifController gifController;

 @override
  void initState() {
  ...
    gifController = GifController(vsync: this);
    WidgetsBinding.instance.addPostFrameCallback((_){
      gifController.repeat(min: 0,max: 53,period: Duration(milliseconds: 200));
    });
    super.initState();
  }

...

@override
  Widget build(BuildContext context) {
...
 return Container(
...
 GifImage(
    controller: gifController,
    image: AssetImage("assets/inkman-hour-tick.gif"),
 ),
}
...
@elkhalifte
Copy link

i think you are calling adListener before loading GifImage Widget

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