颤振延迟功能的问题

时间:2018-10-09 05:43:17

标签: flutter delay

我试图制作一个循环进度指示器,目前大多数时间都在工作,但有时我无法找到答案。通常,我会等待60秒钟,然后再测试_inAsyncCall的状态以应用操作。但是有一段时间我有erreurcommunication();谁在60年代之前出演...一段时间erreurcommunication();在3s,10s或20s等之后显示。

ps:_inAsyncCall调用modal_progress_hud插件 https://pub.dartlang.org/packages/modal_progress_hud

            _inAsyncCall = true;  // launch the progress indicator
              new Future.delayed(new Duration(seconds: 60), () { // wait 60s
                setState(() {
                  if (_inAsyncCall==false){ // If false, it's OK, I do nothing because I receive my data correctly before 60s
                  }
                  else{  // if true, I didn't received my data before 60s 
                    erreurcommunication();  // pop up to show an error
                    _inAsyncCall = false; // close the progress indicator
                  }
                });
              });

我尝试了其他代码:

 const twentyMillis = const Duration(milliseconds:60000);
                        new Timer(twentyMillis, () =>   setState(() {

但这是同样的问题。

0 个答案:

没有答案