scoreSourceOf function
- Question? question,
- Uint8List? wrongScore,
- bool reviewing,
- QuestionRound round,
A partitura que a pergunta desenha, com o nome do arquivo: a da própria
pergunta (com a nota errada, se houver uma em wrongScore), a da frase de
compare (a de prompt, antes da revelação reviewing) ou a da rodada.
null quando não há partitura.
Implementation
({Uint8List bytes, String fileName})? scoreSourceOf(
Question? question,
Uint8List? wrongScore,
bool reviewing,
QuestionRound round,
) {
if (question?.scoreBytes case final bytes?) {
return (
bytes: wrongScore ?? bytes,
fileName: question!.scoreFileName ?? 'round.musicxml',
);
}
final compare = question?.compare;
if (compare != null) {
final bytes = reviewing
? compare.scoreBytes
: compare.promptBytes ?? compare.scoreBytes;
return (bytes: bytes, fileName: compare.fileName);
}
final bytes = round.scoreBytes;
final fileName = round.fileName;
if (bytes == null || fileName == null) return null;
return (bytes: bytes, fileName: fileName);
}