Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Firebase 从云firestore加载数据时出错_Firebase_Flutter_Google Cloud Firestore - Fatal编程技术网

Firebase 从云firestore加载数据时出错

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(),

我正在使用此id检索特定的学生详细信息,但在首次加载错误时它会给出错误
数据库快照是

因为是快照。数据['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;
});