Question: I had been working on a project that uses Firebase Authentication.

Everything worked fine until I updated to Flutter 2.

Now it's telling me that "User" isn't a type. I can't find anything in their changelog that might have caused this error.

```
splashScreenFunction: () async {
            //// check if login
            User result = FirebaseAuth.instance.currentUser;
            print("User: $result");
            if (result != null)
              return mainPage(userID: result.uid,);
            else
              return LoginPage();
          },

```

Here's an example of one of the parts in my project that is giving me an error. This specific part is where I check if the user is logged in by trying to fetch the User ID.
In other parts of the code I am using similar ways in order to obtain the user ID. What is the new way of doing this?? Did i miss something?

I can't seem to find any information as this is a somewhat new update.

Answer: 
try prefixing firebase\_auth import (like firebase\_auth)

```
import 'package:firebase_auth/firebase_auth.dart' as firebase_auth;
.
.
.
//Change
firebase_auth.User result = firebase_auth.FirebaseAuth.instance.currentUser;

```
The problem seems to have been caused by dependencies not having been well updated to support null-safety. I used [this guide](https://dart.dev/null-safety/migration-guide) to make sure that everything was migrated properly, and then it worked again.

So basically it wasn't working because I updated Flutter and Dart, but didn't make sure that all the packages were updated to support null safety.

For future reference: not all of your previously used packages will support null safety(unless they have been updated to do so), but for some reason unknown, you can still use them in your project regardless. I also noticed there's quite a few packages that have not been updated, but users have created new versions of them called "another\_[packageNameHere]" and it will usually work the same way. If you don't update your packages to use null safety you will get a rain of deprecation warnings.