load method

Future<void> load()

Começa a leitura. Quem a chama uma vez (o BlocProvider(create:)) põe o resultado no estado; uma falha vira CourseImageState.failed.

Implementation

Future<void> load() async {
  try {
    final bytes = await read();
    if (isClosed) return;
    emit(state.copyWith(bytes: bytes));
  } on Object {
    if (isClosed) return;
    emit(state.copyWith(failed: true));
  }
}