Measure.fromNoteList constructor

Measure.fromNoteList(
  1. List<Note?> input, {
  2. bool repeatStart = false,
  3. bool repeatEnd = false,
  4. Chord? chord,
})

Implementation

factory Measure.fromNoteList(List<Note?> input,
    {bool repeatStart = false, bool repeatEnd = false, Chord? chord}) {
  final notes = <Note>[];
  for (int i = 0; i < input.length; i++) {
    var note = input[i];
    if (note != null) {
      if (note.timing == Timing.unspecified) {
        notes.add(note.copyWithTiming(
            Timing.withinNoteList(listLength: input.length, noteIndex: i)));
      } else {
        notes.add(note);
      }
    }
  }
  return Measure(
      notes: notes,
      repeatStart: repeatStart,
      repeatEnd: repeatEnd,
      chord: chord);
}