Abhishek Balani
ย ยทย Founder at SuprFollow.com & SuprLabs.io

Rebuild Page/Component not working when API call is in ListView

Widgets & Design
Resolved

Hi,

I have a posts feed on my app like this:

The feed API gets the feed and in each post element it has the data if the post is already liked or not.
I have the like button in a conditional builder. If the post is liked it has color otherwise it has outline.

This is the action I have defined for the button like:

Similarly I have one for unlike.

The expected functionality is that the button should change state based on action success.

I am able to achieve expected functionality if I keep the API call for feed outside (in a parent container) the ListView for feed.

But I need to paginate the feed and for that I need to make the API call in the ListView widget.

When I move the API call to ListView the visual state change stops. The api call works fine but the button doesn't change as per the state until I pull down to refresh the list. But then the track of the current post is lost.

Any way to solve this? Please help.

What have you tried so far?

Looking at documentation, searched flutterflow community.

Did you check FlutterFlow's Documentation for this topic?
Yes
2
7 replies