sair method

Future<void> sair()

Sai da conta. Com uma tentativa em curso, outra não começa.

Implementation

Future<void> sair() async {
  if (isClosed || state.busy) return;
  emit(state.copyWith(busy: true, limparErro: true));
  try {
    await store.signOut();
    if (!isClosed) emit(state.copyWith(busy: false));
  } on AuthException catch (e) {
    if (!isClosed) emit(state.copyWith(busy: false, erro: e.message));
  } on Object {
    if (!isClosed) {
      emit(
        state.copyWith(
          busy: false,
          erro: 'Não consegui sair da conta agora. Tente de novo.',
        ),
      );
    }
  }
}