I want to make a setState everytime the user pass the log in phase. "litems" is a list of items, that I use in "MyHomePage" for a listView. But when the user pass to "MyHomePage" the list "litems" have all the elements but the listView does not update therefore the listView does not show anything until a SetState happends in "MyHomePage"
class AuthenticationWrapper extends StatelessWidget { @override Widget build(BuildContext context) { var firebaseUser = context.watch<User>(); if (firebaseUser != null) { uid = firebaseUser.uid; Database db = new Database(uid); db.getListPersonalReminder(litems); //Add all the necessary elements in litems return MyHomePage(litems); } return SignInPage(); } }
Convert this > StatelessWidget widget to StatefulWidget and Then void initState() { super.initState(); ---- do your task here }
1.4m articles
1.4m replys
5 comments
57.0k users