Score class

Represents a complete musical score with multiple staves

A Score is the top-level container for musical notation, containing one or more StaffGroups. Each group can contain one or more Staffs connected by brackets or braces.

Example:

// Piano score (grand staff)
final score = Score(
  title: 'Moonlight Sonata',
  composer: 'Ludwig van Beethoven',
  staffGroups: [
    StaffGroup(
      staves: [trebleStaff, bassStaff],
      bracket: BracketType.brace, // Piano brace {
      name: 'Piano',
    ),
  ],
);

// Choir score (SATB)
final score = Score(
  title: 'Ave Maria',
  staffGroups: [
    StaffGroup(
      staves: [sopranoStaff, altoStaff, tenorStaff, bassStaff],
      bracket: BracketType.bracket, // Choir bracket [
      name: 'Choir',
    ),
  ],
);

Constructors

Score({String? title, String? subtitle, String? composer, String? arranger, String? copyright, required List<StaffGroup> staffGroups, Map<String, dynamic> metadata = const {}, PageLayout? pageLayout})
const
Score.choir(Staff soprano, Staff alto, Staff tenor, Staff bass, {String? title, String? composer})
Factory: Create a choir (SATB) score
factory
Score.grandStaff(Staff trebleStaff, Staff bassStaff, {String? title, String? composer, String? instrumentName = 'Piano'})
Factory: Create a grand staff (piano) score
factory
Score.orchestral({String? title, String? composer, required List<StaffGroup> groups})
Factory: Create an orchestral score with multiple groups
factory
Score.singleStaff(Staff staff, {String? title, String? composer})
Factory: Create a simple single-staff score
factory

Properties

allStaves → List<Staff>
Get all staves in the score (flattened from all groups)
no setter
arranger → String?
Arranger name (optional)
final
composer → String?
Composer name
final
Copyright notice (optional)
final
hashCode → int
The hash code for this object.
no setterinherited
metadata → Map<String, dynamic>
Additional metadata (tempo, key, time signature, etc.)
final
pageLayout → PageLayout?
Page layout settings
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
staffCount → int
Get total number of staves in the score
no setter
staffGroups → List<StaffGroup>
List of staff groups in the score
final
subtitle → String?
Subtitle (optional)
final
title → String?
Title of the musical piece
final

Methods

copyWith({String? title, String? subtitle, String? composer, String? arranger, String? copyright, List<StaffGroup>? staffGroups, Map<String, dynamic>? metadata, PageLayout? pageLayout}) → Score
Create a copy with modified fields
getStaff(int index) → Staff?
Get a specific staff by index (flattened)
getStaffGroup(int index) → StaffGroup?
Get a specific staff group 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