-2

I want to await a future for at least a second. However, the future can finish quite quickly, what method can I use to await the longer of 2 futures? Something like Future.any but the other way around.

Thank you!

Emmanuel
  • 315
  • 1
  • 3
  • 15

2 Answers2

1

update I just used

await Future.wait([
  future1,
  future2,
]);

which waits for both to complete.

Emmanuel
  • 315
  • 1
  • 3
  • 15
0

Well you can set a Timer and in its callback return the method. That way you can set the end to your like.

Vincenzo
  • 5,304
  • 5
  • 38
  • 96