Home > Back-end >  When using a ListView in flutter to retrieve a list of json objects from an API. Is it the right way
When using a ListView in flutter to retrieve a list of json objects from an API. Is it the right way

Time:09-28

So say I have a simple app with 2 routes. The home route is profile and the second is items. So the idea is that when the user clicks in the item icon the app should move to that route and display all the user's items. The question is should this item Widget be Stateless or Stateful? Take in consideration that I expect the user to pull to refresh this Route and reload the api in the Listview.

CodePudding user response:

It should definitely be a Stateful widget since you are expecting data from an API. A stateless widget can't change, you should only use a Stateless widget if the data on the page is static.

CodePudding user response:

Its definitely an stateful widget because stateless widget can't change their state.

  • Related