register method

  1. @override
Scope register(
  1. HeroAnimation heroAnimation
)
override

Implementation

@override
Scope register(HeroAnimation heroAnimation) {
  if (!_map.containsKey(heroAnimation.tag)) {
    final controller = HeroAnimationController(
      duration: _duration,
      provideRectTween: _createRectTween,
      curve: _curve,
      vsync: _vsync,
      tag: heroAnimation.tag,
    );
    _map.putIfAbsent(
      heroAnimation.tag,
      () => Scope(
        controller: controller,
        widget: heroAnimation,
        count: 1,
      ),
    );
  } else {
    _map[heroAnimation.tag]?.count++;
  }

  return _map[heroAnimation.tag]!;
}