我想转换以下

Future<UserDetl> f = AppDatabase().userById('55e62a90-273c-11ea-9441-f75d5cd0114b');


进入List<UserDetl> lstUser

class UserDetl {
  String userId;
  String userName;
  String userPlace;
  String userUrl;

  UserDetl(this.userId,this.userName, this.userPlace, this.userUrl);

}


我想从列表中获取用户名

String user = lstUser[0].userName;

最佳答案

尝试这个 !

getUser() async {

UserDetl tmp = await  AppDatabase().userById('55e62a90-273c-11ea-9441-f75d5cd0114b');

if(tmp!=null)
 setState((){
    UserDetl u = v;
});
}

08-07 22:52