title: How do I have my flutter code wait for a function to complete before continuing?
body: <p>I am having problems finding out a way to have my code wait for a function to complete before continuing on. The reason for this is because I need the function to retrieve the current user from firebase first, before then going on to use this value and decide which screen to show next.</p>
  
  <p>The way I intend for the code to work is to check if there is already a user signed in. If there is then perform another check to see whether or not information exists for that user - if it does then return the home screen and if it doesnt return the user information screen. If there is no user currently signed in then the Authenticate screen should show.</p>
  
  <pre><code>class SignedInState extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
  
     final user = _getCurrentUser();
  
      if (user == null) {
        return Authenticate();
      } else {
       final snapShot = checkifDocumentExists(user);
        if (snapShot == null) {
        return UserInformation();
        } else {
        return Home();
      }
      }
    }
  }
  </code></pre>
  
  <pre><code>Future _getCurrentUser() async {
     final user = await FirebaseAuth.instance.currentUser();
     print(user);
     print(user.toString());
     return user;
      }
  </code></pre>
  
  <p>This is my first time posting here so just let me know if you need more details etc. </p>