AuthenticationBloc constructor Null safety
- {required AuthenticationRepository auth,
- required UserRepository user}
Create a new AuthenticationBloc.
Implementation
AuthenticationBloc({
required this.auth,
required this.user
})
: super(const AuthenticationState.unauthenticated()) {
on<AuthenticationLoginRequested>((event, emit) {
auth.login();
});
on<AuthenticationLogoutRequested>((event, emit) {
auth.logout();
});
on<AuthenticationStatusChanged>(_statusChanged);
auth.status.listen((status) => add(AuthenticationStatusChanged(status)));
}