Firebase 从云firestore加载数据时出错
我正在使用此id检索特定的学生详细信息,但在首次加载错误时它会给出错误Firebase 从云firestore加载数据时出错,firebase,flutter,google-cloud-firestore,Firebase,Flutter,Google Cloud Firestore,我正在使用此id检索特定的学生详细信息,但在首次加载错误时它会给出错误 数据库快照是因为是快照。数据['first\u name']在firestore中没有值在firestore中first\u name包含StringOnhotload的值它显示first\u name的值 body: StreamBuilder( stream: Firestore.instance.collection('students').document(_userId).snapshots(),
数据库快照是因为是快照。数据['first\u name']在firestore中没有值在firestore中first\u name包含StringOnhotload的值它显示first\u name的值
body: StreamBuilder(
stream: Firestore.instance.collection('students').document(_userId).snapshots(),
builder: (context,snapshot) {
return Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
SizedBox(
height: 20.0,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left:20.0),
child: Align(
alignment: Alignment.centerRight,
child: CircleAvatar(
radius: 100,
backgroundColor: Colors.white,
child: ClipOval(
child: new SizedBox(
width: 180.0,
height: 180.0,
child: (_image!=null)?Image.file(
_image,
fit: BoxFit.fill,
):
Image.network(""),
),
),
),
),
),
Padding(
padding: EdgeInsets.only(top: 60.0),
child: IconButton(
icon: Icon(
Icons.camera,
size: 30.0,
),
onPressed: () {
getImage();
},
),
),
],
),
SizedBox(
height: 20.0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left:40.0),
child: Align(
alignment: Alignment.center,
child: Container(
child: Column(
children: <Widget>[
Align(
alignment: Alignment.center,
child: Text('Student Name',
style: TextStyle(
color: Colors.white, fontSize: 20.0)),
),
Align(
alignment: Alignment.center,
child: Text(snapshot.data['first_name'],
style: TextStyle(
color: Colors.black,
fontSize: 18.0,
)),
),
],
),
),
),
),
FirebaseAuth.instance.currentUser().then((user) {
_userId = user.uid;
});