Flutter Tip🔥: Getting Data more faster!

Flutter Queen✨
2 min readMay 19, 2023

Code Snippet-1: I have three api’s endpoints and getting data from todos, post and users , my each http request to complete before moving on to the next one. Frist will execute, after that the second one then the third one right.

if you want data more faster

Code Snippet-2: has the same code I just remove await keyword and in return future.wait function is then used to wait for all the futures to complete, and it returns a single future that completes when all
the provided futures are completed.

The main difference between the two approaches:

1- One request depend on the result of a previous request.
2- All three requests are initiated concurrently,
allowing them to be sent simultaneously. don’t rely on each other.

If you want data more faster, you the second approach.

I hope this article was helpful to you. Thank you for taking the time to read it. Your feedback and suggestions are always welcome.

Support Me:

--

--