Implement Pragmatic Flutter Architecture (PFA)
mainPragmatic Flutter Architecture (PFA) organizes an application into three distinct components to ensure separation of concerns:
- Services: These wrap a single external boundary (e.g., a REST API, database, or OS service). They are responsible for converting data between external formats (like JSON) and domain models. Crucially, Services must not change app state.
- Managers: These encapsulate semantically related business logic (e.g.,
UserManager,BookingManager). They are not 1:1 ViewModels; instead, they provideCommandsandValueListenablesfor the UI to consume. Managers can depend on Services or other Managers. - Views: These are full pages or high-level widgets. They are 'self-responsible', meaning they know which data they need. Views read data from Managers via
ValueListenablesand trigger modifications through Managers, never by calling Services directly.