timedFuture method

Future<bool> timedFuture()

Implementation

Future<bool> timedFuture() async {
  final completer = Completer<bool>();
  Timer(minDuration, () async {
    if (taskCompleted) completer.complete(success);
    timerCompleted = true;
  });
  future.then((value) {
    taskCompleted = true;
    success = value;
    if (timerCompleted) {
      completer.complete(success);
    }
  });
  return completer.future;
}