Skip to content

Instantly share code, notes, and snippets.

@alperefesahin
Created February 2, 2022 06:34
Show Gist options
  • Save alperefesahin/26bb03c93ab44a073b07280f09ff6ad4 to your computer and use it in GitHub Desktop.
Save alperefesahin/26bb03c93ab44a073b07280f09ff6ad4 to your computer and use it in GitHub Desktop.
class AuthCubit extends Cubit<AuthState> {
AuthCubit() : super(const AuthState.initial(isSignedIn: false)) {
FirebaseAuth.instance.authStateChanges().listen((User? user) {
if (user == null) {
return emit(state.copyWith(isSignedIn: false));
} else {
emit(state.copyWith(isSignedIn: true));
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment