0

How can I create a list of AnimationController?

I found Flutter: Array of TextEditingController which shows how to create a list of texteditingcontroller, but with the AnimationController there's a required vsync and I haven't figured out how to get that to work. Any ideas?

BrianDev
  • 57
  • 7

1 Answers1

0

I figured out the solution. I was trying to initialize both the controller and list in initState. I had to initialize the controller outside of initState and it worked:

_controller = List.generate(3, (i) => AnimationController(
    vsync: this, duration: Duration(milliseconds: 2500)));
BrianDev
  • 57
  • 7