I have this sample code for use cases:
final class AuthUseCases { final DataProxy dataProxy; const AuthUseCases(this.dataProxy); Future<AuthSession> login(TCredential credential) async { // a lot of lines here... } AuthSession logout(AuthSession session) { // a few lines here... }}
and I have this sample code for BloC events by using Freezed package:
@freezedsealed class TmdbEvent with _$TmdbEvent { const factory TmdbEvent.login(TCredential credential) = LoginEvent; const factory TmdbEvent.logout() = LogoutEvent;}class TmdbBloc extends Bloc<TmdbEvent, PageState> { // more lines here...}
So I was asking myself if I could join these classes together because I think BloC events are the same as use-cases. So some questions here:
- is that idea correct?
- how would this new class look like? I'm new with Freezed package
- is it a good idea to keep a single class or have them separate?