Reputation: 15
I have problem in my app that I have to create a Database Class User , But also I have in the new FirebaseAuth there is User now instead of FirebaseUser , How can I separate them functionally ?
Upvotes: 1
Views: 772
Reputation: 994
It's probably better to import firebase_auth
package with an as
keyword.
import 'package:firebase_auth/firebase_auth.dart' as firebase_auth;
Now you can use any firebase_auth
function or class by prepending firebase_auth.
to the name like:
final firebaseUser = firebase_auth.User(...);
final user = User(...);
I prefer this to the other way around because User class is a part of your code and you usually want to import external code as something
.
Upvotes: 0
Reputation: 1067
Anna's solution should work. But if you're not using FirebaseAuth user in this class, you could just hide the User class from firebase auth like this:
import 'package:firebase_auth/firebase_auth.dart' hide User;
This will, as its name says, hide the class User so it won't be available in the current file.
Upvotes: 1
Reputation: 650
Import your user model as an alias
import '../../User.dart' as userModel;
use it like
userModel.User user = .........
Upvotes: 2