fromArtboard method Null safety

StateMachineController? fromArtboard(
  1. Artboard artboard,
  2. String stateMachineName
)

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) {
  for (final animation in artboard.animations) {
    if (animation is StateMachine && animation.name == stateMachineName) {
      return StateMachineController(animation);
    }
  }
  return null;
}