title: The method '[]' can't be unconditionally invoked because the receiver can be 'null'
body: <p>I'm new to Flutter. I am trying to develop an application.</p>
  <p>I want to show the staff list in the Firebase database. However, I am getting the following error.</p>
  <p><strong>Error :</strong></p>
  <blockquote>
  <p>The method '[]' can't be unconditionally invoked because the receiver
  can be 'null'. Try making the call conditional (using '?.') or adding
  a null check to the target ('!').</p>
  </blockquote>
  <p>Kodlarım :</p>
  <pre><code>`import 'package:calendar/page/mainPage.dart';
  import 'package:flutter/material.dart';
  import 'package:cloud_firestore/cloud_firestore.dart';
  
  class Staff extends StatefulWidget {
    @override
    _StaffState createState() =&gt; _StaffState();
  }
  
  class _StaffState extends State&lt;Staff&gt; {
    
    final _firestore = FirebaseFirestore.instance;
  
    @override
    Widget build(BuildContext context) {
      // ignore: unused_local_variable
      CollectionReference staffRef = _firestore.collection('staff');
  
      return Scaffold(
        appBar: AppBar(
          title: Text(&quot;Personel Listesi&quot;),
          backgroundColor: Colors.redAccent[400],
          actions: &lt;Widget&gt;[
            IconButton(
              icon: Icon(Icons.home),
              onPressed: () {
                Navigator.pushAndRemoveUntil(
                    context,
                    MaterialPageRoute(builder: (_) =&gt; MainPage()),
                    (route) =&gt; true);
              },
            ),
          ],
        ),
        body: Container(
          child: Padding(
            padding: const EdgeInsets.all(8.0),
            child: Center(
              child: Column(
                children: [
                  StreamBuilder&lt;QuerySnapshot&gt;(
                    stream: staffRef.snapshots(),
                    builder: (BuildContext context, AsyncSnapshot asyncSnapshot) {
                      if (asyncSnapshot.hasError) {
                        return Center(
                            child: Text(
                                &quot;Bir hata oluştu, lütfen tekrar deneyiniz.&quot;));
                      } else {
                        if (asyncSnapshot.hasData) {
                          List&lt;DocumentSnapshot&gt; listStaff =
                              asyncSnapshot.data.docs;
                          return Flexible(
                            child: ListView.builder(
                                itemBuilder: (context, index) {
                                  return Card(
                                    elevation: 20,
                                    color: Colors.greenAccent[200],
                                    child: ListTile(
                                      trailing: IconButton(
                                        icon: Icon(Icons.delete),
                                        onPressed: () async {
                                          await listStaff[index]
                                              .reference
                                              .delete();
                                        },
                                      ),
                                      title: Text(
                                        '${listStaff[index].data['nameSurname']}',
                                        style: TextStyle(fontSize: 20),
                                      ),
                                      subtitle: Column(
                                        children: [
                                          Row(
                                            mainAxisAlignment:
                                                MainAxisAlignment.start,
                                            children: [
                                              Text(
                                                '${listStaff[index].data['tip']}',
                                                style: TextStyle(fontSize: 14),
                                              ),
                                            ],
                                          ),
                                          Row(
                                            mainAxisAlignment:
                                                MainAxisAlignment.start,
                                            children: [
                                              Text(
                                                '${listStaff[index].data['mail']}',
                                                style: TextStyle(fontSize: 14),
                                              ),
                                            ],
                                          ),
                                          Row(
                                            mainAxisAlignment:
                                                MainAxisAlignment.start,
                                            children: [
                                              Text(
                                                '${listStaff[index].data['phone']}',
                                                style: TextStyle(fontSize: 14),
                                              ),
                                            ],
                                          ),
                                        ],
                                      ),
                                    ),
                                  );
                                },
                                itemCount: listStaff.length),
                          );
                        } else {
                          return Center(
                            child: CircularProgressIndicator(),
                          );
                        }
                      }
                    },
                  ),
                ],
              ),
            ),
          ),
        ),
      );
    }
  }
  `
  </code></pre>