You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class NumberTriviaBloc extends Bloc<NumberTriviaEvent, NumberTriviaState> {
final GetConcreteNumberTrivia getConcreteNumberTrivia;
final GetRandomNumberTrivia getRandomNumberTrivia;
Which is hardcoding a dependency on GetConcreteNumberTrivia and GetRandomNumberTrivia types.
Shouldn't that really be:
class NumberTriviaBloc extends Bloc<NumberTriviaEvent, NumberTriviaState> {
final UseCase<NumberTrivia, Params> getConcreteNumberTrivia;
final UseCase<NumberTrivia, NoParams> getRandomNumberTrivia;
where Params would be a type (probably better named) in entities or better yet just use int instead and make GetConcreteNumberTrivia implement UseCase<NumberTrivia, int>
The text was updated successfully, but these errors were encountered:
It isn't as problematic as it would be in Java where you don't have implicit interfaces, but any time you can reduce dependencies it is a good thing.
I am not saying that an abstraction needs to be created. The UseCase abstraction already exists and I am just suggesting that the existing abstraction is used instead of the concrete class. The only issue then is where Params is declared.
You have this:
Which is hardcoding a dependency on GetConcreteNumberTrivia and GetRandomNumberTrivia types.
Shouldn't that really be:
where Params would be a type (probably better named) in entities or better yet just use int instead and make
GetConcreteNumberTrivia
implementUseCase<NumberTrivia, int>
The text was updated successfully, but these errors were encountered: