I am implementing an app that I should handle offline mode. When I check the internet connection and it is not connected, I should add the API request to a queue to be executed when the internet connection is back again.
How can I do that?
I tried to add class names and the method names to the queue, but couldn't call the method from a class dynamically.
I am using Dio package to handle API requests.
if you remove await from your requests you can save them as Future<dynamic> for Example
Future<dynamic> response = Dio().get("http://www.google.com");
now You can save it in List<Future<dynamic>> myList = List() and when you want to call it
await myList[0]
Or
myList[0].then()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With