How farazsd/interest_calculator works
Project type and purpose
• This is a cross-platform Flutter application (“calculator_app”) that provides at least two screens: a home screen and an interest calculation screen.
• It targets mobile (Android, iOS), desktop (macOS, Linux, Windows), and web, using a single Dart codebase under lib/.
File structure
• Top-level directories:
• android/ – Android embedding code (MainActivity.kt, Gradle files)
• ios/, macos/, linux/, windows/ – Native runner projects for each platform (AppDelegate.swift, main.cc, CMakeLists, etc.)
• web/ – Web entrypoint (index.html, manifest.json)
• lib/ – The entire Dart UI & business logic:
– main.dart (app entrypoint)
– home/home_screen.dart (home UI)
– home/intrest_screen.dart (interest calculation UI & logic)
• assets/ – Static resources (rate_interest.json)
• test/ – Automated widget test (widget_test.dart)
• pubspec.yaml – Dependency & asset declarations
• .github/workflows – CI configuration (actions.yml)
README
• Default Flutter boilerplate README: confirms this is a starter Flutter project, no bespoke architecture docs.
Main components & interactions
a. Components
1. Presentation Layer (Dart/Flutter Widgets in lib/)
2. Business Logic (Dart code in intrest_screen.dart)
3. Asset Loader (reads assets/rate_interest.json via Flutter’s AssetBundle)
4. Flutter Framework & Engine (renders UI, handles input)
5. Platform Embedders (per-platform host code):
– Android Embedder (android/app/src/.../MainActivity.kt)
– iOS Embedder (ios/Runner/AppDelegate.swift)
– macOS Embedder (macos/Runner/AppDelegate.swift)
– Linux Embedder (linux/main.cc, generated_plugin_registrant.cc)
– Windows Embedder (windows/runner/main.cpp, etc.)
– Web Embedder (web/index.html, web engine)
6. CI/CD Workflow (.github/workflows/actions.yml)
b. Relationships & data flow
• UI Widgets ←→ Business Logic ←→ Asset Loader
• UI/Logic → Flutter Framework → Flutter Engine
• Engine ↔ Native Embedder (via platform channels for plugins, input events, rendering surfaces)
• Native Embedder → OS window / runtime
• CI Workflow → build/test pipelines on GitHub
c. Architectural patterns
• Single-codebase multi-platform layering
• Separation of concerns: Presentation vs. Logic vs. Platform embedding
• Flutter’s reactive UI pattern (widgets rebuild on state changes)
d. Key technologies
• Dart & Flutter SDK
• Flutter Engine (C++)
• Platform toolchains (Gradle/Android SDK, Xcode, CMake for Linux/Windows)
• AssetBundle for JSON data
• GitHub Actions for CI
Diagramming recommendations
[Presentation Layer]
[Business Logic]
[Asset Loader]
[Flutter Framework & Engine]
[Android Embedder] [iOS Embedder] [macOS Embedder] [Linux Embedder] [Windows Embedder] [Web Embedder]
• Presentation → Business Logic → Asset Loader
• Presentation/Logic → Framework → Engine
• Engine ↔ each Embedder → OS
• Blue = Dart code (UI + Logic)
• Green = Asset subsystem
• Gray = Flutter Framework & Engine
• Orange = Native Embedders