'The getter 'documents' isn't defined for the type 'Object'

I have a collection called status in Firebase. I'm trying to pull data from here. However I am getting this error.

I tried some solutions but I still get the same errors. For example; I used StreamBuilder<QuerySnapshot() instead of StreamBuilder(). However, I got this error. "The getter 'documents' isn't defined for the type 'QuerySnapshot<Object?>'.". Another example,I used docs instead of the word documents. Again I got the same error. Finally, when I removed the words docs or documents I got an error as follows."The getter 'lenght' isn't defined for the type 'QuerySnapshot<Object?>'."

My code:

class Home extends StatefulWidget {
  const Home({Key? key}) : super(key: key);
  @override
  State<Home> createState() => _HomeState();
}
class _HomeState extends State<Home> {
      final FirebaseFirestore _database = FirebaseFirestore.instance;
      final StatusService _statusService = StatusService();
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Colors.orange,
        automaticallyImplyLeading: false,
        title: Center(
          child: Text(
            'Home',
            style: TextStyle(color: Colors.white),
          ),
        ),
      ),
      body: StreamBuilder(
        stream: _statusService.getStatus(),
        builder: (BuildContext context, snaphot){
          return !snaphot.hasData
              ? CircularProgressIndicator()
              : ListView.builder(
               itemCount: snaphot.data?.documents.lenght, //Error in here "documents"
              itemBuilder: (context, index){
                DocumentSnapshot mypost = snaphot.data?.documents[index]; // also another error in here " documents"
                return Padding(
                  padding: const EdgeInsets.all(12.0),
                  child: Container(
                    child: Column(children: [
                      Text("${mypost['status']}")
                    ],),
                  ),
                );
          }
          );
        },
      ) ,
    );
  }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source