title: The await expression can only be used in an async function
body: <p>I am trying to load some data from Firestore when the user logs in and need to wait until the data is loaded before continuing. However, my efforts to await the results are not working.</p>
  
  <pre><code>Future&lt;bool&gt; userListener() async {
    _auth.onAuthStateChanged.listen((firebaseUser) {
      bool isDone = false; 
  
      if (firebaseUser != null) {
        isDone = await loadUserData(firebaseUser);   // This line is killing me!!
        return isDone;
      } else {
        return false;
      }
    }, onError: (error) {
      print('error in UserListener: $error');
    });
  }
  
  Future&lt;bool&gt; loadUserData(FirebaseUser user) async {
    Firestore database = Firestore();
    DocumentReference data = database.collection('userData').document(user.uid);
  
    try {
      DocumentSnapshot myQuery = await data.get();
      theNumber = myQuery.data['theNumber'];
      return true;
    } on PlatformException catch (e) {
      print(e);
      return false;
    }
  }
  </code></pre>
  
  <p>I get a lovely error from the line:</p>
  
  <pre><code> isDone = await loadUserData(firebaseUser);
  </code></pre>
  
  <p>that "<strong>the await expression can only be used in an async function</strong>". </p>
  
  <p>I'm not sure how these functions could get any more async. Further, if I don't add <code>await</code> then I am told that a Future can't be assigned to a bool, which makes perfect sense, and suggest to me that my function is, in fact, async. </p>
  
  <p>Why can't I await the results of my <code>loadUserData</code> function?</p>