AuthenticationBloc constructor Null safety

AuthenticationBloc(
  1. {required AuthenticationRepository auth,
  2. 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)));
}