嗨,我是颤振和异步编程的新手。我需要做这样的事情:
List<Widget> usersProfiles = [];
getUsers('DcofOiHWcjbjD0i18miW').then((user) {
user.forEach((u) {
usersProfiles.add(new ListTile(
leading: CircleAvatar(
backgroundImage: AssetImage(u.profilePicture),
),
trailing: u.icon,
title: new Text(u.name),
onTap: () {
Navigator.push(context,
new MaterialPageRoute(builder: (context) => new Home()));
},
));
});
});
Run Code Online (Sandbox Code Playgroud)
但usersProfiles返回null
我会非常感激