【发布时间】:2020-10-08 16:23:18
【问题描述】:
为什么我收到此错误“未为类型文档引用定义的方法”? 还有其他过滤文档的方法吗?
buildPostHeader() {
return FutureBuilder(
future:Firestore.instance.collection('users').document(id).where('designer',isEqualTo:true).get(),
builder: (context, snapshot) {
if (!snapshot.hasData) {
return circularProgress();
}
User user = User.fromDocument(snapshot.data);
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(20.0))
),
margin: EdgeInsets.only(top:10.0,left: 10.0,right: 10.0, bottom: 10.0 ),
child: Column(
children: <Widget> [
ListTile(
leading: CircleAvatar(
backgroundImage: CachedNetworkImageProvider(user.photoUrl),
backgroundColor: Colors.grey,
),
title: Text(user.displayName,style: TextStyle(color: Colors.white),),
subtitle: GestureDetector(
onTap: () => showProfile(context, profileId: user.id),
child: Text(
user.username,
style: TextStyle(
color: kText,
fontWeight: FontWeight.bold,
),
),
),
【问题讨论】: