Я получаю поток уже прослушал ошибку в виджете ящика - PullRequest
0 голосов
/ 21 марта 2020
 drawer: Drawer(
      child:Column(
        children:<Widget>[         
         StreamBuilder(
           stream:getUsersTripsStreamSnapshots(context),
           builder: (context, snapshot) {
            if (!snapshot.hasData) return const Text("Loading...");
            return ListView.builder(
                       shrinkWrap: true,
                       itemCount: snapshot.data.documents.length,
                //padding: const EdgeInsets.only(top: 5.0),
               itemBuilder: (context,int index){
                 DocumentSnapshot ds = snapshot.data.documents[index];
                 return UserAccountsDrawerHeader(   
                    accountName:Text(ds["firstName"]),     
                    accountEmail:Text(ds["lastName"]),
                    currentAccountPicture: new CircleAvatar(
                  backgroundColor: Colors.white,
                  child: new Icon(Icons.person),
                    ),
                    otherAccountsPictures: <Widget>[
                  FlatButton(onPressed: (){
                    Navigator.of(context).push(new CupertinoPageRoute(
                    builder: (BuildContext context) => new Namedetail()));

                  }, child:Icon(Icons.edit) )
                 ],
                    );
               },

            );
           }
         ), 

            Expanded(
                            child: ListTile(leading:CircleAvatar(
                child:Icon(
                  Icons.notifications,
                  color: Colors.white,
                  size: 20.0,
                ),
              ),
               title: new Text("Order Notifications"),
               onTap: () {

              },
               ),
            ),
                ListTile(leading:CircleAvatar(
              child:Icon(
                Icons.history,
                color: Colors.white,
                size: 20.0,
              ),
            ),
             title: new Text("Order History"),
             onTap: () {

            },
             ),
                Expanded(
                                    child: ListTile(leading:CircleAvatar(
              child:Icon(
                  Icons.person,
                  color: Colors.white,
                  size: 20.0,
              ),
            ),
             title: new Text("Profile Settings"),
             onTap: () {

            },
             ),
                ),
                Expanded(
                                    child: ListTile(leading:CircleAvatar(
              child:Icon(
                  Icons.home,
                  color: Colors.white,
                  size: 20.0,
              ),
            ),
             title: new Text("Delivery Address"),
             onTap: () {
            },
             ),
                ),
              Divider(),
                Expanded(
              child: ListTile(trailing:CircleAvatar(
              child:Icon(
                  Icons.help,
                  color: Colors.white,
                  size: 20.0,
              ),
            ),
             title: new Text("About Us"),
             onTap: () {
              Navigator.of(context).push(new CupertinoPageRoute(
                    builder: (BuildContext context) =>
                        new Forest()));
            },
             ),
                ),
                Expanded(
                                    child: ListTile(trailing:CircleAvatar(
              child:Icon(
                  Icons.exit_to_app,
                  color: Colors.white,
                  size: 20.0,
              ),
            ),
             title: new Text("Logout"),
             onTap: () {

            },
             ),
                ),


                ]
              )
            ),

Первый раз, когда он извлекает данные из firebase, но во второй раз он показывает эту ошибку. GetUsersTripsStreamSnapshots - это асинхронная функция, которую я создал для извлечения данных из firebase. пожалуйста, посмотрите на этот код ниже.

...