title: How to fix this error, the 'documents' was called on null
body: <p>I am trying to build mobile app using flutter and firebase, when I run my code I get the following error on console and a red screen with yellow text pop's out and disappears quickly.</p>
  
  <pre><code>I/flutter ( 6397): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
  I/flutter ( 6397): The following NoSuchMethodError was thrown building ProjectDetailsPage(dirty, state:
  I/flutter ( 6397): _ProjectDetailsPageState#210e3):
  I/flutter ( 6397): The getter 'documents' was called on null.
  I/flutter ( 6397): Receiver: null
  I/flutter ( 6397): Tried calling: documents
  </code></pre>
  
  <p>I have tried to use if statement, to check wether it is null or not null but still am getting the same exception. Am not sure what to do next, I would appreciate your effort</p>
  
  <pre><code> 68   @override
   69   Widget build(BuildContext context) {
   70     var getprojname;
   71     var getprojdesc;
   72     var numberofempperproj;
   73     var projectmanger;
   74     var projectbudget;
   75
   76     var projectobj;
   77
   78     if (Projects.documents != null) { //this is where i checked if null or not
   79
   80        getprojname =  Projects.documents[0].data['projectname'];
   81        getprojdesc =  Projects.documents[0].data['projectdesc'];
   82        numberofempperproj =  Projects.documents[0].data['numberofempPerproj'].toString();
   83        projectmanger =  Projects.documents[0].data['projectmanager'];
   84        projectbudget = Projects.documents[0].data['projectbudget'].toString();
   85        projectobj = Projects.documents[0].data['objectives'];
   86        name = getprojname;
   87        print(getprojname);
   88
   89       // TODO: implement build
   90          return Scaffold(
   91              appBar: AppBar(
   92                // title: Text('Project details'),
   93                elevation: 2.0,
   94                backgroundColor: Colors.white,
   95
   96                title: Text(getprojname, style: TextStyle(color: Colors.black,
   97                    fontWeight: FontWeight.w700,
   98                    fontSize: 19.0)),
   99                actions: &lt;Widget&gt;
  100                [
  101                  Container
  102                    (
  103                    margin: EdgeInsets.only(right: 8.0),
  104                    child: Row
  105                      (
  106                      mainAxisAlignment: MainAxisAlignment.center,
  107                      crossAxisAlignment: CrossAxisAlignment.center,
  108
  109                    ),
  110                  )
  111                ],
  112              ),
  </code></pre>
  
  <p>I expect it not to pop up the red screen but to proceed to the next page of the app which displays data from firebase database.</p>