desfazer method

Future<void> desfazer(
  1. VinculoDoProfessor vinculo
)

Desfaz o vínculo com o professor. A confirmação é da tela.

Implementation

Future<void> desfazer(VinculoDoProfessor vinculo) async {
  if (isClosed || state.busy) return;
  emit(state.copyWith(busy: true));
  try {
    await remote.desfazer(vinculo).timeout(esperaMaxima);
    if (!isClosed) emit(state.copyWith(busy: false));
  } on TimeoutException {
    _avisar(
      'Sem conexão agora. A mudança é enviada quando o aparelho voltar a '
      'conectar.',
    );
  } on Object catch (e) {
    _avisar('Não consegui desfazer o vínculo: $e');
  }
}