I am creating an Application for Kiosk Devices which is running the API recursively and updating the data on Screen, but I realized after some days the App got Crashed due to a recursive function it's a StackOverflow Error. What is the solution to avoid this error or the best approach to Call Infinite Recurising API with delay?
Following is the Approach, I am using in my app
CallRestApi(){
await getResponseFromServer();
updateUi();
await Future.delayed(Duration(seconds: 2));
CallRestApi();
}
Edit: I also used the timer approach but result is same