I'm getting an error "Error type 'AuthResult' is not a subtype of type 'FirebaseUser' in type cast" when I'm trying to login or signup : <p>I'm making a flutter app for my college project, where I'm adding a login and signup page and authenticating it via Firebase, and when I click login the debug console says <strong>"Error type 'AuthResult' is not a subtype of type 'FirebaseUser' in type cast"</strong> and when I reload the app after this error it successfully logs in.</p>

<p>Everything was working best before the update of the <strong>firebase_auth</strong> package to 0.12.0 after this update, the methods "signInWithEmailAndPassword()" and "createUserWithEmailAndPassword()" throwing an error <strong>"A value of type 'AuthResult' can't be assigned to a variable of type 'FirebaseUser'.
Try changing the type of the variable, or casting the right-hand type to 'FirebaseUser'"</strong>, so I added a cast <strong>as FirebaseUser</strong> which fixed the error and the app was built successfully but when i clicked on login or create account, debug console said <strong>Error type 'AuthResult' is not a subtype of type 'FirebaseUser' in type cast</strong></p>

<p>the main login and create account function code before the update of firebase_auth 0.12.0</p>

<pre><code>Future&lt;String&gt; signIn(String email, String password) async {
FirebaseUser user = await 
FirebaseAuth.instance.signInWithEmailAndPassword(
    email: email, password: password);
return user.uid;
}

Future&lt;String&gt; createUser(String email, String password) async {
FirebaseUser user = await 
FirebaseAuth.instance.createUserWithEmailAndPassword(
    email: email, password: password);
return user.uid;
}
</code></pre>

<p>the above code was working fine,
after the update (firebase_auth 0.12.0) the same code started throwing this error,</p>

<pre><code>A value of type 'AuthResult' can't be assigned to a variable of type 
'FirebaseUser'.
Try changing the type of the variable, or casting the right-hand type to 
'FirebaseUser'.dart(invalid_assignment)
</code></pre>

<p>I fixed the error by casting "FirebaseUser" as shown below</p>

<pre><code>Future&lt;String&gt; signIn(String email, String password) async {
FirebaseUser user = await 
FirebaseAuth.instance.signInWithEmailAndPassword(
    email: email, password: password) as FirebaseUser;
return user.uid;
}

Future&lt;String&gt; createUser(String email, String password) async {
FirebaseUser user = await 
FirebaseAuth.instance.createUserWithEmailAndPassword(
    email: email, password: password) as FirebaseUser;
return user.uid;
}
</code></pre>

<p>this new code didn't threw an error in compilation but when I try to login or create new account it throws an error in debug console 
    Error type 'AuthResult' is not a subtype of type 'FirebaseUser' in type 
    cast
and the new created account is successfully created on firebase but the app doesn't go on the next page but as soon as i reload it starts with the page that should come after login and creation of account(sign out is working perfectly)</p>
