Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

erro no flutter #949

Open
heitortorrezani opened this issue Mar 30, 2024 · 1 comment
Open

erro no flutter #949

heitortorrezani opened this issue Mar 30, 2024 · 1 comment
Labels
new New issue request attention question Questions about using some feature or general working of the package

Comments

@heitortorrezani
Copy link

late Timer _timer;
bool _timerAtivo = true;

@OverRide
void initState() {
super.initState();

statusUpdate();

_timer = Timer.periodic(const Duration(seconds: 1), (timer) {
  if (_timerAtivo) {
    iniciarTemporizadorPegarStatus();
  }
});

}

String statusParametros = '';

Future statusUpdate() async {
Future.delayed(const Duration(seconds: 60), () {
if (_timerAtivo) {
FirebaseFirestore.instance
.collection('parametros')
.doc('fkm2xe8krQ5F0Qsy5OIV')
.update({'status': 'jogar'});
print('status update / wait 2');
}
});
}

Future iniciarTemporizadorPegarStatus() async {
try {
DocumentSnapshot statusDoc = await FirebaseFirestore.instance
.collection('parametros')
.doc('fkm2xe8krQ5F0Qsy5OIV')
.get();

  statusParametros = statusDoc.data().toString();

  print(statusParametros);

  if (statusParametros == 'jogar') {
    print('navigator wait votos / wait 2');
    _timerAtivo = false;
    //!
    Navigator.of(context).pop();
    Navigator.of(context).push(MaterialPageRoute(
      builder: (context) {
        return const WaitVotos();
      },
    ));
  }
} catch (e) {
  print("Erro ao buscar no Firestore: $e");
}

}

estou com um erro nesta parte do codigo o campo esta virando 'jogar' mesmo sem passar os 60 segundos do Future.delayed e nao esta trocando de pagina

@heitortorrezani heitortorrezani added new New issue request attention question Questions about using some feature or general working of the package labels Mar 30, 2024
@eduardoflorence
Copy link

Este não é um problema relacionado ao Modular. Utilize o fórum da Flutterando para postar sua dúvida:
https://github.com/orgs/Flutterando/discussions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new New issue request attention question Questions about using some feature or general working of the package
Projects
None yet
Development

No branches or pull requests

2 participants