[Solved] Dart throws LateInitializationError even when I initialize variables in initState


This is declaring a local variable:

AnimationController _animationController =
    AnimationController(vsync: this, duration: Duration(milliseconds: 500));

What you want is assign to your existing class member variable:

_animationController =
    AnimationController(vsync: this, duration: Duration(milliseconds: 500));

solved Dart throws LateInitializationError even when I initialize variables in initState