How to Prevent rerender of a widget based on custom logic in flutter?

Posted by Editorial Staff | Updated on

Want to Prevent rerender of a widget based on custom logic in flutter? Usually when you have performance issues because you are rendering too many widgets, you are using ListView or GridView. You can prevent this performance issue by using ListView.builder() or GridView.builder() methods. ListView.builder and GridView.builder will only render the widgets that are on screen, thus preventing performance issues.

Here are some examples:

With GridView:

With ListView:


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers