auth phone and re auth phone
This commit is contained in:
@@ -8,15 +8,13 @@ import 'package:user_repository/user_repository.dart';
|
||||
part 'authentication_event.dart';
|
||||
part 'authentication_state.dart';
|
||||
|
||||
class AuthenticationBloc
|
||||
extends Bloc<AuthenticationEvent, AuthenticationState> {
|
||||
class AuthenticationBloc extends Bloc<AuthenticationEvent, AuthenticationState> {
|
||||
final UserRepository userRepository;
|
||||
late final StreamSubscription<MyUser?> _userSubscription;
|
||||
|
||||
AuthenticationBloc({required UserRepository myUserRepository})
|
||||
: userRepository = myUserRepository,
|
||||
super(const AuthenticationState.unknown()) {
|
||||
_userSubscription = userRepository.streamUser().listen((authUser) {
|
||||
super(const AuthenticationState.unknown()) {_userSubscription = userRepository.streamUser().listen((authUser) {
|
||||
add(AuthenticationUserChanged(authUser));
|
||||
});
|
||||
on<AuthenticationUserChanged>(_onAuthenticationUserChanged);
|
||||
@@ -32,8 +30,7 @@ class AuthenticationBloc
|
||||
);
|
||||
}
|
||||
|
||||
void _onAuthenticationLogoutRequested(AuthenticationLogoutRequested event,
|
||||
Emitter<AuthenticationState> emit) async {
|
||||
void _onAuthenticationLogoutRequested(AuthenticationLogoutRequested event, Emitter<AuthenticationState> emit) async {
|
||||
await userRepository.logOut();
|
||||
emit(const AuthenticationState.unauthenticated());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user