I am a beginner in Dart language development. I try to create a sample flutter application BLOC pattern inspired by this GitHub repo, but I got some error message related to the class inheritance. I am already familiar with the inheritance and superclass and subclass programming in the dot net C# language. But in the case of the dart, I need some advice.
Here is my code:
class UserRegBloc extends Bloc<UserRegEvent, UserRegState> {
UserRepository userRepository;
UserRegBloc({@required UserRepository userRepository}) {
userRepository = UserRepository();
}
@override
UserRegState get initialState => UserRegInitial();
@override
Stream<UserRegState> mapEventToState(UserRegEvent event) async* {
if (event is SignUpButtonPressed) {
yield UserRegLoading();
try {
var user = await userRepository.signUpUserWithEmailPass(
event.email, event.password);
print("BLOC : ${user.email}");
yield UserRegSuccessful(user: user);
} catch (e) {
yield UserRegFailure(message: e.toString());
}
}
}
}
Edit
My pubspec.yaml dependencies are below: