title: The argument type 'Future<UserCredential>' can't be assigned to the parameter type 'dynamic Function()'
body: <p>I am learning about TDD and practicing my test writing. I want to write a test for my login through Firebase.
  here is the test file:</p>
  <pre><code>import 'package:firebase/firebase.dart';
  import 'package:firebase_auth/firebase_auth.dart' as fa;
  import 'package:flutter_test/flutter_test.dart';
  
  import 'package:mocktail/mocktail.dart';
  import 'package:scopetik/features/login/data/login_data_impl.dart';
  import 'package:scopetik/features/login/models/user_model.dart';
  
  class MockFirebaseAuth extends Mock implements fa.FirebaseAuth {}
  
  class MockFirebaseUser extends Mock implements fa.User {}
  
  class MockAuthResult extends Mock implements fa.UserCredential {}
  
  void main() {
    late LoginDataImpl sut;
    late MockFirebaseAuth mockFirebaseAuth;
  
    setUp(() {
      mockFirebaseAuth = MockFirebaseAuth();
      sut = LoginDataImpl(mockFirebaseAuth);
    });
  
    group(
      'Test LoginDataImpl class',
      () {
        when(mockFirebaseAuth.signInWithEmailAndPassword(
                email: 'email', password: 'password'))
            .thenAnswer((_) async {
          return MockAuthResult();
        });
        test(
          &quot;get UserModel&quot;,
          () async {
            //arrange
          },
        );
      },
    );
  }
  </code></pre>
  <p>I don't know why the when function won't let me return a <code>future&lt;UserCredential&gt;</code>.</p>