Measure.parse constructor

Measure.parse(
  1. XmlElement xmlMeasure,
  2. MusicXMLParserState state
)

Parse the

Implementation

factory Measure.parse(XmlElement xmlMeasure, MusicXMLParserState state) {
  final startTimePosition = state.timePosition;

  final int number = int.parse(xmlMeasure.attributes
      .firstWhere((p0) => p0.localName == 'number')
      .value);

  return Measure(number: number)
    // Cumulative duration in MusicXML duration.
    // Used for time signature calculations
    // Record the starting time of this measure so that time signatures
    // can be inserted at the beginning of the measure
    .._parse(xmlMeasure, state)
    // Update the time signature if a partial or pickup measure
    .._fixTimeSignature(state, startTimePosition);
}