useAnimationController method

AnimationController useAnimationController({
  1. required String key,
  2. required TickerProvider vsync,
  3. Duration duration = const Duration(milliseconds: 300),
})

Retrieves an existing AnimationController or creates a new one.

key: A unique string key to identify the AnimationController. vsync: The TickerProvider for the AnimationController. duration: The duration of the animation.

Returns an AnimationController associated with the given key.

Implementation

AnimationController useAnimationController({
  required String key,
  required TickerProvider vsync,
  Duration duration = const Duration(milliseconds: 300),
}) {
  return _getOrCreate(
      key: key,
      create: () => AnimationController(vsync: vsync, duration: duration),
      disposeHandler: (controller) async => controller.dispose());
}