Measure class
Represents a single bar of music containing an ordered list of MusicalElements.
Use add to append elements. When a TimeSignature is present (or inherited from a previous measure) the add method enforces capacity: adding a note that would exceed the bar's rhythmic value throws a MeasureCapacityException.
Example:
final measure = Measure()
..add(TimeSignature(numerator: 4, denominator: 4))
..add(Note(pitch: const Pitch(step: 'C', octave: 4),
duration: const Duration(DurationType.whole)));
- Implementers
Constructors
-
Measure({bool autoBeaming = true, BeamingMode beamingMode = BeamingMode.automatic, List<
List< manualBeamGroups = const [], TimeSignature? inheritedTimeSignature, int? number})int> > - Creates a new Measure.
Properties
- autoBeaming ↔ bool
-
Controls whether notes should be automatically grouped with beams.
true = auto-beaming active (default)
false = use individual flags
getter/setter pair
- beamingMode ↔ BeamingMode
-
Specific beaming strategy for special cases.
getter/setter pair
- currentMusicalValue → double
-
calculateTestes the total current rhythmic value of elements in the measure.
no setter
-
elements
→ List<
MusicalElement> -
All musical elements in this measure, in order.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- inheritedTimeSignature ↔ TimeSignature?
-
Time signature inherited from a previous measure (used for preventive validation).
getter/setter pair
- isValidlyFilled → bool
-
Returns true if the measure is correctly filled.
no setter
-
manualBeamGroups
↔ List<
List< int> > -
Manual beam groups — list of note index groups to be beamed together.
Example: [
0, 1, 2,3, 4] groups notes 0,1,2 into one beam and 3,4 into another.getter/setter pair - number ↔ int?
-
Measure number, corresponding to the MEI
<measure @n>attribute. null = automatic numbering by the layout engine.getter/setter pair - remainingValue → double
-
Returns how much rhythmic time remains in the measure.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- timeSignature → TimeSignature?
-
Returns the active time signature for this measure.
no setter
Methods
-
add(
MusicalElement element) → void - Adds a musical element to the measure.
-
canAddDuration(
Duration duration) → bool - Returns true if there is room to add the given duration.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited