load method

Future<void> load()

Desenha a partitura pelo mesmo caminho da pergunta (lessonScoreLayout). Depois do close, não emite.

Implementation

Future<void> load() async {
  try {
    final layout = lessonScoreLayout(source.paperPx)
        .edited(source: source.bytes);
    final rendered = await rendererFactory().render(
      ScoreRenderRequest(
        source: source.bytes,
        fileName: source.fileName ?? 'ritmo.musicxml',
        pageWidth: layout.pageWidth,
        pageHeight: layout.pageHeight,
        options: layout.options,
      ),
    );
    if (isClosed) return;
    _measureIds = scoreCursor ? _idsOfMeasures(rendered.document) : const [];
    _cursorBar = null;
    _score = ScoreCubit(document: rendered.document);
    emit(ChartScoreState(document: rendered.document));
  } on Object catch (e) {
    if (isClosed) return;
    emit(ChartScoreState(error: '$e'));
  }
}