Flutter flow problem - UI update needs to happen after database info has been added to my list

213 views Asked by At

Class A is preparing to fill list from the database class. I want my checkPrefsUploaded() and updateUI() to run after the database has been read and filled the list. At the moment it is isn't being read because the flag is always false. How do I change the flow to make sure it is ready to run. It's in the memoizer method because this is when the user turns on their phone and all stored preferences restores pre-saved list attributes.

enter image description here

1

There are 1 answers

0
diegoveloper On

You just need to wait until the database is ready.

await DatabaseHelper.instance.database;

Also check if your checkPrefsUploaded() method is async, so you can await for the response.

await checkPrefsUploaded();