DEV Community

Discussion on: Clean architecture of Flutter application. Part 2 - Practice

ricardv profile image
Vincent RICARD

Hi there, thanks for this great post. If I may, I have some questions.

I have difficulties understanding in which layer I can define some logic that describes how my app behave, what a feature is all about and how it behaves.

To me it is hard to understand what is application logic and what is business logic. So let's take some examples.

1) Assume you want to get continuous update of something happening and you have a remote data source that provides a dart stream to do so. Where (in which layer) and when (which class, method) do you define how frequent you want this update to be ? Who should decide how frequent it is?

2) Assume you that data you received to be raw and you want it to be processed to extract some information from it in order to fill the UI.

Where do you define the rules behind such logic that will drive the process to extract the raw data?
I know the actual data processing is to take place in a data source. But its job is to process data. How to process data is not its decision, right? So where do I define the configuration of the processing?

3) Final question. Once 2 and 3 are solved, I am still facing with some issues.
You might gather 2 and 3 are specific use cases:
1 - to get the data
2 - to process it
But in order to process data (2), I need to receive it (1). In terms of flow, where does it end when I receive the data (1) ?

  • in the use case to get it ?
  • in the BLoC, without notifying the UI ?
  • in the UI, via a BLoC state, then firing a new event ?

I hope you can help. Thanks a lot in advance!