Fretting constructor

Fretting({
  1. required FrettedInstrument instrument,
  2. required Chord chord,
  3. required Iterable<FretPosition> positions,
})

Implementation

Fretting({
  required this.instrument,
  required this.chord,
  required Iterable<FretPosition> positions,
}) : this.positions = List<FretPosition>.from(sortedBy(
        positions,
        (FretPosition pos) => pos.stringIndex,
        reverse: true,
      )) {
  assert(positions.length ==
      positions.map((position) => position.stringIndex).toSet().length);
}