animationByName method Null safety

LinearAnimationInstance? animationByName(
  1. String name
)

Returns an animation with the given name, or null if no animation with that name exists in the artboard

Implementation

LinearAnimationInstance? animationByName(String name) {
  final animation = animations.firstWhereOrNull(
      (animation) => animation is LinearAnimation && animation.name == name);
  if (animation != null) {
    return LinearAnimationInstance(animation as LinearAnimation);
  }
  return null;
}