after I've retrieved data (an user) from an http request, I want to put this data into a singleton. Then, in another view, I want to show the name of this user in the sidebar, but it says "The getter 'user' was called on null." Here's my code:
var user = await getUser(_username, _password);
if (user.loginError == false){
model.user = user;
Navigator.of(context).pushNamedAndRemoveUntil(
'/home_view', ModalRoute.withName('/home_view'));
}
And here's when I try to use the user.name:
Widget hamburgerMenu() {
Model model;
return new Drawer(
child: ListView(
children: <Widget>[
new UserAccountsDrawerHeader(
accountName: Text(model.user.name,
...