debugContractViolation property

String? get debugContractViolation

The contract violation of this profile, or null when it is valid; MorphController checks it in an assert whenever a profile is installed. The one hard rule: a spring closeMotion must keep snapToEnd false - the handoff latch fires on the close spring's zero crossing and the landing bump is the undershoot below zero, so snapping to the end clips both.

Implementation

String? get debugContractViolation {
  final Motion close = closeMotion;
  if (close is SpringMotion && close.snapToEnd) {
    return 'MorphMotion "$name": closeMotion has snapToEnd: true. '
        'The handoff latch fires on the close spring\'s zero crossing '
        'and the landing bump is the undershoot below zero - snapToEnd '
        'clips both. Recreate the Motion with snapToEnd: false (the '
        'default).';
  }
  return null;
}