Once you start a match or open any other page in the app, the parent page is also rebuilt in the backgroud multiple times. If we navigate to the friends tab and back to play tab, then all tabs on the way get rebuilt too. This is awful because it refetches data (specially the main tab match stream is reset, but also the who is online checker for the friends tab), which is slow for low connectivy and costs us lots of DB reads. Plus the app glitches and there are hiccups when activating the keyboard.

2 culprits:

Solutions:

More links:

https://github.com/flutter/flutter/pull/41763

https://stackoverflow.com/questions/52249578/how-to-deal-with-unwanted-widget-build

https://github.com/flutter/flutter/issues/11655#issuecomment-552818136

https://medium.com/saugo360/flutter-my-futurebuilder-keeps-firing-6e774830bc2

https://github.com/flutter/flutter/issues/37878

https://github.com/flutter/flutter/issues/75971