I am working on a flutter app that calls an API to get all the servers from the backend. My backend is in the Laravel.
When I run the API in postman it gives me the correct result, but when I call the API in app it fetch the result but did not display in list on screen.!This is the error I am getting on running the APP](https://i.sstatic.net/7C5rlUeK.png)
Belwo is the code where the error is occuring in terminal on running the app.
I have tried to json decode the data, but it did not work.
I have also commented these code and then run the app, then the API call is not working.
2
Answers
Ensure you’re using await with the asynchronous operation to guarantee the data is available before accessing it:
Try using null safety type by replace
ApiResponse<App<String, dynamic>>
toApiResponse<App<String, dynamic>>?
and modify check condition by