How khysokhorn/nexgennote works
Main Components
• User Interface (UI) Layer:
• Located in the lib/ui folder, this layer contains all the views and widget components (for example, in lib/ui/views/home, lib/ui/views/Password).
• It includes the visual components (buttons, dropdowns, dialogs) and presents screens like the home screen, login, recent transactions, etc.
• Business Logic / ViewModels:
• Found under lib/core/viewmodel, these files (home_view_model.dart, login_view_model.dart, etc.) contain the business logic that binds the UI to the underlying services.
• Core Modules:
• Services and Repositories:
• Services (lib/core/services and lib/services) handle operations like API interactions (using a service like api_provider_service.dart with Dio interceptors for network requests), local storage operations, notification handling, and any external integrations (like google_api_service.dart).
• The repository pattern is exemplified by lib/core/repositories/api_repository.dart which abstracts and manages data fetching from remote sources.
• Data Persistence / Database:
• The lib/database folder shows configuration files and setup for any local database or caching mechanism the app might use.
• Assets and Resources:
• Located under lib/assets (images, fonts, language JSON files), which support internationalization and the app’s look-and-feel.
• Platform-Specific Code:
• Each platform (Android, iOS, web, Linux, macOS, Windows) has its own directory containing native configuration files and project setup files, which allow the Flutter code to run across these different environments.
• Inside the app, break down the following layers:
• UI Layer: Represented by the “UI / Views” component, show the key screens like Home, Login, and Money Collection screens.
• Business Logic Layer: The “ViewModels & Controllers” that interact directly with UI components.
• Data Persistence: Represent the “Database / Local Storage” module that feeds into the service layer.
Architectural Patterns and Design Principles
• Separation of concerns and the use of the MVVM or similar pattern. The UI (views) is decoupled from the business logic (view models), which in turn interacts with service layers for data operations.
• Repository pattern that abstracts API calls and data persistence.
• Use of dependency injection, network interceptors (Dio interceptors), and potentially reactive programming if the view models update the UI based on service responses.