operator == method

  1. @override
bool operator ==(
  1. Object other
)
override

Two pitches are equal when they share the same step, octave and effectiveAlter.

accidentalType is deliberately excluded so that spelling-equivalent pitches such as Pitch(step: 'F', octave: 4, alter: 1.0) and Pitch.withAccidental(step: 'F', octave: 4, accidentalType: sharp) compare equal; the field is still preserved on the object.

Implementation

@override
bool operator ==(Object other) {
  if (identical(this, other)) return true;
  return other is Pitch &&
      other.step == step &&
      other.octave == octave &&
      other.effectiveAlter == effectiveAlter;
}