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',
    ),
  ],
);
Available extensions

Constructors

Score({String? title, String? subtitle, String? composer, String? arranger, String? copyright, required List<StaffGroup> staffGroups, Map<String, dynamic> metadata = const {}, PageLayout? pageLayout, MeiHeader? meiHeader, ScoreDefinition? scoreDefinition})
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
meiHeader MeiHeader?
Cabeçalho MEI estruturado (<meiHead>). Opcional; when fornecido, permite serialização/importação fiel to the default MEI v5.
final
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
scoreDefinition ScoreDefinition?
Definition global de partitura (<scoreDef>). Centraliza clef, armadura and fórmula de measure for toda a partitura.
final
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, MeiHeader? meiHeader, ScoreDefinition? scoreDefinition}) 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
printScore(BuildContext context, {PdfPageFormat format = PdfPageFormat.a4}) Future<void>

Available on Score, provided by the ScorePdfOperations extension

Print this score
shareScore(BuildContext context, {PdfPageFormat format = PdfPageFormat.a4}) Future<void>

Available on Score, provided by the ScorePdfOperations extension

Share this score as PDF
showPreview(BuildContext context, {PdfPageFormat format = PdfPageFormat.a4, bool includeMetadata = true}) → void

Available on Score, provided by the ScorePdfOperations extension

Show PDF preview for this score
toPdf({PdfPageFormat format = PdfPageFormat.a4, bool includeMetadata = true, SmuflMetadata? metadata, MusicScoreTheme theme = const MusicScoreTheme()}) Future<Uint8List>

Available on Score, provided by the PdfExportExtensions extension

Export this score 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