Dart timeout on await Future
问题 How to make a await future not last more than 5 seconds ? I need it because in some networking operation, the connection is sometimes producing silent error. Hence my client just wait for hours with no response. Instead, I want it trigger an error when the clients waits for more than 5 seconds My code can trigger the error but it is still waiting Future shouldnotlastmorethan5sec() async { Future foo = Future.delayed(const Duration(seconds: 10));; foo.timeout(Duration(seconds: 5), onTimeout: (