title: Flutter test future throws an error, can't test exception
body: <p>I'm looking to test a function that returns a Future</p>
  
  <p>however when you pass in bad parameters it throws an exception. </p>
  
  <p>I'm trying to write tests for this, however when I run</p>
  
  <pre><code>test("When a new practice is created with an empty name, an exception is thrown", () async {
        //arrange
        //act
        //assert
        expect(newUserRepository.saveUser("", "Test"), throwsA(TypeMatcher&lt;Exception&gt;()));
      }); 
  </code></pre>
  
  <p>I get the following</p>
  
  <pre><code>Expected: throws &lt;Instance of 'TypeMatcher&lt;Exception&gt;'&gt;
    Actual: &lt;Instance of 'Future&lt;void&gt;'&gt;
     Which: threw ?:&lt;Exception&gt; 
  </code></pre>
  
  <p>Any way I can get it to pass this test?</p>
  
  <p>My saveUser function</p>
  
  <pre><code>Future&lt;void&gt; saveUser(String username, String practiceName) async {
      if (username == null || username.isEmpty || practiceName == null || practiceName.isEmpty) {
        throw Exception("Unable to save empty username or pracice name");
      }
  
      var firebaseUser = await userRepository.getFirebaseUser();
      var newUser = DomainUser(userName: username, email: firebaseUser.email);
      await userRepository.saveUser(newUser);
  
      var newPractice = DomainPractice(users: [newUser.email], practiceName: practiceName);
      await practiceRepository.savePractice(newPractice);
      return;
    } 
  </code></pre>