HasithaAthukorala / flutter-clean-architecture-sample

Sample for flutter clean architecture with blocs and test driven development
242 stars 60 forks source link

bloc in presenter is not clean #6

Open lxknvlk opened 2 years ago

lxknvlk commented 2 years ago

bloc is business logic component presenter is not for logic, it is for views logic should be in domain

sbatezat commented 2 years ago

@lxknvlk BLoC should remains in presentation layer.

Please see : https://medium.com/ideas-by-idean/a-flutter-bloc-clean-architecture-journey-to-release-the-1st-idean-flutter-app-db218021a804

"BLoC can be seen as — yet another presenter disguised in ViewModel —inserted inside your widget tree through a BlocProvider, and helping you respond to events by returning states that can be used to build the corresponding UI (with a BlocBuilder) or perform corresponding actions (with a BlocListener)."

Just ask yourself, how can I reuse BLoC in a completely different application with the same domain? You can't - it's specific to your views.