Project Structure
DashLearn is built on a scalable and modular architecture using the GetX Pattern. This structure is designed to separate presentation logic, business logic, and data handling, ensuring code maintainability and testability.
Root Directory
Section titled “Root Directory”The root of the project contains configuration files for the Flutter environment and tooling.
dash_learn_getx/├── android/ # Native Android project files├── ios/ # Native iOS project files├── lib/ # Main application source code├── assets/ # Static assets (images, fonts, icons)├── docs/ # Documentation (this site)├── pubspec.yaml # Dependencies and project metadata└── analysis_options.yaml # Linter rulesSource Code (lib/)
Section titled “Source Code (lib/)”The core logic resides in lib/. We strictly follow the module-based separation provided by the GetX ecosystem.
lib/├── app/│ ├── data/ # Data & Logic Layer│ │ ├── demo_data/ # Mock data sources (JSON adapters)│ │ └── repository/ # Interfaces/Impls for APIs│ ││ ├── modules/ # Feature Modules (Presentation Layer)│ │ ├── authentication/│ │ ├── home/│ │ ├── courses/│ │ └── ... (20+ feature modules)│ ││ ├── routes/ # Navigation & Routing│ │ ├── app_pages.dart # Route Map (Path -> Binding -> View)│ │ └── app_routes.dart # String Constants│ ││ ├── translations/ # Internationalization (i18n)│ │ ├── app_translations.dart│ │ ├── en_US.dart│ │ ├── es_ES.dart│ │ └── val_MX.dart│ ││ └── widgets/ # Shared Reusable Components│ ├── constants/ # Colors, Dimensions, Styles│ └── ... # Custom Buttons, Inputs, Cards│└── main.dart # Application Entry PointModule Architecture
Section titled “Module Architecture”Every feature in DashLearn (e.g., Home, Auth, Profile) is a self-contained module. This makes adding or removing features incredibly safe and easy.
Anatomy of a Module
Section titled “Anatomy of a Module”Taking the home module as an example:
lib/app/modules/home/├── bindings/│ └── home_binding.dart # Dependency Injection (Lazily puts Controller)├── controllers/│ └── home_controller.dart # Business Logic & State (Observable variables)└── views/ └── home_view.dart # UI Code (StatelessWidget using GetView)- Binding: Decouples dependency injection from the view. It initializes the controller only when the route is accessed.
- Controller: Contains all the logic (what happens when a button is clicked, API calls, state variables). It extends
GetxController. - View: A pure UI layer that listens to the Controller. It usually extends
GetView<HomeController>.
Key Directories Explained
Section titled “Key Directories Explained”lib/app/data/
Section titled “lib/app/data/”This is where the app connects to the outside world.
- Repositories: Abstract classes defining what data operations are possible.
- Providers/Services: Implementations that actually fetch the data (from API or Mock).
- Currently, DashLearn relies heavily on
demo_datato simulate a rich backend experience out-of-the-box.
lib/app/widgets/
Section titled “lib/app/widgets/”Contains the Design System of the application.
app_colors.dart: The source of truth for the color palette.app_text_styles.dart: Typography configurations.- Reusable Widgets: Ensure consistency across screens (e.g.,
CoolButton,CoolInputField).
lib/app/routes/
Section titled “lib/app/routes/”Centralized navigation management.
app_routes.dart: Defines constant strings like/LOGIN,/HOME.app_pages.dart: Maps these strings to the corresponding View and Binding. This allows specialized navigation options like Middlewares (Route Guards).