StaffGroup class

Represents a group of staves connected by a bracket or brace

A StaffGroup contains one or more Staffs that are visually connected and typically represent a single instrument or section.

Examples:

// Piano (grand staff with brace)
final piano = StaffGroup(
  staves: [trebleStaff, bassStaff],
  bracket: BracketType.brace,
  name: 'Piano',
);

// Choir SATB (with bracket)
final choir = StaffGroup(
  staves: [soprano, alto, tenor, bass],
  bracket: BracketType.bracket,
  name: 'Choir',
);

// Violin I & II (with line)
final violins = StaffGroup(
  staves: [violin1, violin2],
  bracket: BracketType.line,
  name: 'Violins',
);

Constructors

StaffGroup({required List<Staff> staves, BracketType bracket = BracketType.none, String? name, String? abbreviation, bool? connectBarlines, double? customSpacing, bool showNameOnAllSystems = false})
const
StaffGroup.brass(List<Staff> staves)
Factory: Create a brass section group
factory
StaffGroup.choir(Staff soprano, Staff alto, Staff tenor, Staff bass)
Factory: Create a choir SATB group
factory
StaffGroup.harp(Staff trebleStaff, Staff bassStaff)
Factory: Create a harp group (grand staff)
factory
StaffGroup.multipleInstruments(List<Staff> staves, String instrumentName)
Factory: Create a group for multiple instances of same instrument
factory
StaffGroup.organ(Staff manual1, Staff manual2, Staff pedal)
Factory: Create an organ group (typically 3 staves)
factory
StaffGroup.percussion(List<Staff> staves)
Factory: Create a percussion section group
factory
StaffGroup.piano(Staff trebleStaff, Staff bassStaff)
Factory: Create a piano (grand staff) group
factory
StaffGroup.strings(List<Staff> staves)
Factory: Create a string section group
factory
StaffGroup.woodwinds(List<Staff> staves)
Factory: Create a woodwind section group
factory

Properties

abbreviation String?
Abbreviated name (displayed on subsequent systems)
final
bracket BracketType
Type of bracket connecting the staves
final
connectBarlines bool
Whether barlines should connect all staves in the group
final
customSpacing double?
Vertical spacing between staves in this group (in staff spaces)
final
hashCode int
The hash code for this object.
no setterinherited
isGrandStaff bool
Check if this is a grand staff (2 staves with brace)
no setter
name String?
Name of the group (displayed to the left of the staves)
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showNameOnAllSystems bool
Whether to show instrument name on every system
final
staffCount int
Number of staves in this group
no setter
staves List<Staff>
List of staves in this group (must contain at least one staff)
final

Methods

copyWith({List<Staff>? staves, BracketType? bracket, String? name, String? abbreviation, bool? connectBarlines, double? customSpacing, bool? showNameOnAllSystems}) StaffGroup
Create a copy with modified fields
getStaff(int index) Staff?
Get a specific staff by index
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