MockFirebaseAuth constructor
MockFirebaseAuth({})
Implementation
MockFirebaseAuth(
{bool signedIn = false,
MockUser? mockUser,
Map<String, List<String>>? signInMethodsForEmail,
bool verifyEmailAutomatically = true})
: _mockUser = mockUser,
_verifyEmailAutomatically = verifyEmailAutomatically,
_signInMethodsForEmail = signInMethodsForEmail ?? {},
app = MockFirebaseApp() {
stateChangedStream =
stateChangedStreamController.stream.asBroadcastStream();
userChangedStream = userChangedStreamController.stream.asBroadcastStream();
// Based on https://firebase.google.com/docs/rules/rules-and-auth#identify_users
// and https://firebase.google.com/docs/reference/rules/rules.firestore.Request#auth.
authForFakeFirestore =
authForFakeFirestoreStreamController.stream.asBroadcastStream();
if (signedIn) {
if (mockUser?.isAnonymous ?? false) {
signInAnonymously();
} else {
signInWithCredential(null);
}
} else {
// Notify of null on startup.
signOut();
}
}