0

I am calling an API using async and await and want to navigate to next screen after the api call is over.
I am not using async loader or futurebuilder coz I don't want to show any new widget till I get the response of the api call. I am able to call the API, show the circular progress indicator until I get response but I don't know how to execute time out of the api. I am not using Future.delayed for timeout coz I want the api to be called immediately.

Keerti Purswani
  • 4,878
  • 3
  • 16
  • 29
  • How do I handle the case when net is off and SocketException oocurs? – Keerti Purswani Jan 16 '19 at 18:21
  • Remi Rousselet, I tried using your answer to the question - final result = await Future.value(42).timeout(const Duration(seconds: 3)); I am trying to test the case by switching off net, how do I add timeout for Socket Exception case? Is there a way to keep trying for a period of time? Say user turns on net at 30th sec, API should get hit automatically. – Keerti Purswani Jan 16 '19 at 18:25

0 Answers0