delayedConnectionCheck method
returns a future that completes after two seconds with the connection status
Implementation
Future<ProConnectionStatus> delayedConnectionCheck() {
var completer = Completer<ProConnectionStatus>();
// wait a bit to see if we are actually connected or not
Timer(Duration(seconds: 2), () {
if (connected == false) {
status = ProConnectionStatus.failed;
completer.complete(status);
} else {
status = ProConnectionStatus.connected;
completer.complete(status);
}
});
return completer.future;
}