content: import 'package:firebase_auth/firebase_auth.dart';
  import 'package:google_sign_in/google_sign_in.dart';
  
  class UserRepository {
    final FirebaseAuth _firebaseAuth;
    final GoogleSignIn _googleSignIn;
  
    UserRepository({FirebaseAuth? firebaseAuth, GoogleSignIn? googleSignIn})
        : _firebaseAuth = firebaseAuth ?? FirebaseAuth.instance,
          _googleSignIn = googleSignIn ?? GoogleSignIn();
  
    Future<User> signInWithGoogle() async {
      final GoogleSignInAccount? googleUser = await _googleSignIn.signIn();
      final GoogleSignInAuthentication googleAuth =
          await googleUser!.authentication;
      final AuthCredential credential = GoogleAuthProvider.credential(
          idToken: googleAuth.idToken, accessToken: googleAuth.accessToken);
  
      await _firebaseAuth.signInWithCredential(credential);
      return Future.value(_firebaseAuth.currentUser);
    }
  
    Future<void> signInWithCredentials(String email, String password) {
      return _firebaseAuth.signInWithEmailAndPassword(
          email: email, password: password);
    }
  
    Future<void> signUp(
        {required String email,
        required String password,
        required String displayName}) async {
      await _firebaseAuth.createUserWithEmailAndPassword(
          email: email, password: password);
      var currentUser = _firebaseAuth.currentUser;
  
      //update info
      await currentUser!.updateDisplayName(displayName);
    }
  
    Future signOut() async {
      return Future.wait([
        _firebaseAuth.signOut(),
        _googleSignIn.signOut(),
      ]);
    }
  
    Future<bool> isSignedIn() async {
      final currentUser = _firebaseAuth.currentUser;
      return currentUser != null;
    }
  
    Future<String> getUser() async {
      return _firebaseAuth.currentUser!.displayName!;
    }
  }
  