morphTo method

void morphTo(
  1. MorphIconData icon, {
  2. SpringPreset? preset,
  3. double? stiffness,
  4. double? damping,
  5. Duration? duration,
})

Springs to icon. With no driver yet there is nothing to fly from, so this behaves as set.

Implementation

void morphTo(
  MorphIconData icon, {
  SpringPreset? preset,
  double? stiffness,
  double? damping,
  Duration? duration,
}) {
  _pair = null;
  _based = false;
  final m = _morph;
  if (m != null) {
    m.morphTo(
      icon,
      preset: preset ?? widget.preset,
      stiffness: stiffness ?? widget.stiffness,
      damping: damping ?? widget.damping,
      duration: duration ?? widget.duration,
    );
    return;
  }
  // No driver yet: nothing to fly from, so this is a `set`. The birth has to
  // go through setState — an imperative call is not inside a build.
  setState(() => _ensure(icon));
}