fromArtboard method Null safety

StateMachineController? fromArtboard(
  1. Artboard artboard,
  2. String stateMachineName,
  3. {OnStateChange? onStateChange}
)

Instance a StateMachineController from an artboard with the given stateMachineName. Returns the StateMachineController or null if no StateMachine with stateMachineName is found.

Implementation

static StateMachineController? fromArtboard(
  Artboard artboard,
  String stateMachineName, {
  core.OnStateChange? onStateChange,
}) {
  for (final animation in artboard.animations) {
    if (animation is StateMachine && animation.name == stateMachineName) {
      return StateMachineController(animation, onStateChange: onStateChange);
    }
  }
  return null;
}