getStemDirection method

StemDirection getStemDirection()

Get stem direction for this voice.

Uses forcedStemDirection when set. Otherwise follows the standard convention (Gould, Behind Bars): odd-numbered voices point up and even-numbered voices point down, i.e. voices 1 and 3 up, voices 2 and 4 down. This pairing is what lets voice 1 sit above voice 2 (and voice 3 above voice 4) without extra layout information.

Implementation

StemDirection getStemDirection() {
  if (forcedStemDirection != null) return forcedStemDirection!;

  return number.isEven ? StemDirection.down : StemDirection.up;
}