indexBefore method

int indexBefore(
  1. Duration position
)

Index of the last note at or before position, -1 when none.

Implementation

int indexBefore(Duration position) {
  int found = -1;
  for (int i = 0; i < _notes.length; i++) {
    if (_notes[i].position <= position) found = i;
  }
  return found;
}