Skip to content

On Startup

Annika Muecke edited this page Jun 16, 2022 · 3 revisions

Every time MainScreen is build, initializeLocalData() is called. If globalController.isInitialized is set to false (as per default), this means the method is called for the first time, which triggers fetching all team information from the database and instantiating all team objects as well as their member lists of player objects based on the player references in firestore. This takes some time for loading, as the method is asynchronous and is awaited to finish before the main screen is rendered. Finally, globalController.isInitialized is set to true. To prevent unnecessary requests and long waiting times every time when switching to MainScreen, if globalController.isInitialized is true, e.g. initializeLocalData() was called before, nothing happens.

Clone this wiki locally