skip to Main Content

I have a problem when i navigate to multiple pages and then show search.
More specifically, i have a product page with some details. At the bottom there is a list of similar products.
The flow is:

  1. open many similar products (so I navigate to the same screen using Navigator pushNamed).
  2. then, navigate from the las product page to the search page
  3. tap on search bar, open search delegate using the showSearch function

My issue is that when i tap on the search bar, then the whole widget tree is rebuilded and my app is very heavy because rebuilds the previous product pages and everything else.

2

Answers


  1. This happens due to the general rebuild on keyboard changes(i.e: showing and hiding Keyboard).

    I recommend to have a heavy operation like loading data from backend should be held on initState in State with StatefullWidget.

    Login or Signup to reply.
  2. Try to debug and understand why do you rebuild the tree. It seems to me, that you need to simplify a navigation flow.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search