registerController method

void registerController(
  1. String key,
  2. AnimationController controller
)

Register an animation controller with a unique key

Implementation

void registerController(String key, AnimationController controller) {
  if (_isDisposed) {
    controller.dispose();
    return;
  }

  if (_controllers.containsKey(key)) {
    debugPrint(
        'Warning: Controller with key "$key" already registered. Overwriting.');
    unregisterController(key);
  }

  _controllers[key] = controller;
  _states[key] = FSAnimationState.idle;

  controller.addListener(() {
    if (!controller.isAnimating && _states[key] == FSAnimationState.exiting) {
      _states[key] = FSAnimationState.idle;
      notifyListeners();
    }
  });
}