Where and when should I store values in BLoC itself or its state Where and when should I store values in BLoC itself or its state dart dart

Where and when should I store values in BLoC itself or its state


Implement "category" as a parameter for the event that is triggering ad loading process. This way, for example, you will tell BLoC to "LoadAds" with "category: Category.DOGS".

class LoadAds extends AdsEvent {  final Category category;    LoadAds({    @required this.category,  });  @override  List<Object> get props => [category];}

This way you will be able to use single bloc instance to load different ad types when needed. Load DOGS first, 2 minutes later load CATS instead of dogs.
If you do not need this ability - then defining category inside bloc itself is perfectly fine.