Screenshot of the AuthenticationBloc

Screenshot of the AuthenticationBloc ...

how to handle these errors?

This is my AuthenticatationState.

part of 'authentication_bloc.dart';

@immutable
abstract class AuthenticationState extends Equatable {
  //
  final AuthenticationStatus status;
  final User user;

  AuthenticationState._({
    this.status = AuthenticationStatus.unknown,
    this.user = User.empty,
  });

  AuthenticationState.unknown() : this._();

  AuthenticationState.authenticated(User user)
      : this._(status: AuthenticationStatus.authentidated, user: user);

  AuthenticationState.unauthenticated()
      : this._(status: AuthenticationStatus.unauthenticated);

  @override
  List<Object> get props => [status, user];
}


Solution 1: quoci

Your AuthenticationState is an abstact class. So you can't instantied it, which means you can't create an object from it. To fix this omit the abstract.
I'm quite familar with Bloc and I would suggest you to create a new class for each state and extend from AuthenticationState.

@immutable
abstract class AuthenticationState extends Equatable {
  final AuthenticationStatus status;
  final User user;

  AuthenticationState({
    this.status = AuthenticationStatus.unknown,
    this.user = User.empty,
  });

  @override
  List<Object> get props => [status, user];
}

class AuthenticationStateUnknown extends AuthenticationState {
  AuthenticationStateUnknown() : super();
}

class AuthenticationStateAuthenticated extends AuthenticationState {
  AuthenticationStateAuthenticated(User user)
      : super(status: AuthenticationStatus.authenticated, user: user);
}

class AuthenticationStateUnAuthenticated extends AuthenticationState {
  AuthenticationStateUnAuthenticated()
      : super(status: AuthenticationStatus.unAuthenticated);
}


Solution 2: Kasujja Muhammed

Maybe you want to use a single state, for that u need to remove the abstract keyword from state class declaration. U can use

Note class is not abstract

part of 'authentication_bloc.dart';

@immutable
class AuthenticationState extends Equatable {
  //
  final AuthenticationStatus status;
  final User user;

  AuthenticationState._({
    this.status = AuthenticationStatus.unknown,
    this.user = User.empty,
  });

  AuthenticationState.unknown() : this._();

  AuthenticationState.authenticated(User user)
      : this._(status: AuthenticationStatus.authentidated, user: user);

  AuthenticationState.unauthenticated()
      : this._(status: AuthenticationStatus.unauthenticated);

  @override
  List<Object> get props => [status, user];
}


Solution 3: CrimsonPiiiik

Try to change the class name. You might be using an existed class reserved name in flutter lib. :)