Staff class

Represents a single staff (line of music) containing an ordered list of Measures.

A Staff is the top-level musical container passed to MusicScore and LayoutEngine. Measures are laid out left-to-right and wrapped into systems automatically by the layout engine.

Example:

final staff = Staff(measures: [
  Measure()
    ..add(Clef())
    ..add(TimeSignature(numerator: 4, denominator: 4))
    ..add(Note(pitch: const Pitch(step: 'C', octave: 4),
              duration: const Duration(DurationType.quarter))),
]);
Available extensions

Constructors

Staff({List<Measure>? measures, int lineCount = 5, String? name, String? abbreviation, Transposition? transposition})

Properties

abbreviation String?
Short form used from the second system on, e.g. 'Vln. I' (MusicXML <part-abbreviation>, MEI <labelAbbr>).
final
hashCode int
The hash code for this object.
no setterinherited
lineCount int
Number of staff lines. Defaults to 5 (CMN). Valid values per MEI:
final
measures List<Measure>
All measures in this staff, in chronological order.
final
name String?
Creates a Staff with the given measures list.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
transposition Transposition?
Written-to-sounding transposition of the instrument on this staff.
final

Methods

add(Measure measure) → void
Appends a Measure to the end of this staff.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toPdf({String? title, String? composer, PdfPageFormat format = PdfPageFormat.a4, SmuflMetadata? metadata, MusicScoreTheme theme = const MusicScoreTheme()}) Future<Uint8List>

Available on Staff, provided by the StaffPdfExtensions extension

Export this staff to PDF, with the notation engraved (see PdfExporter).
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited