How arafipro/jpstockminimemo works
Project Type and Purpose
• Type: Cross-platform mobile application built with Flutter (Dart) targeting Android and iOS.
• Purpose: Allow users to locally record short investment memos for Japanese stocks (supporting market reorg and alphanumeric codes).
High-Level Architectural Layers
Layer 1 (UI / Presentation)
Layer 2 (ViewModel / Business Logic)
Layer 3 (Data / Persistence)
Layer 4 (Platform & Deployment)
Main Components
a. Presentation Layer
– Views (lib/views/*): LoadPage, ListPage, EditPage, SettingsPage, ErrorPage
– Components (lib/components/*): StockCard, CustomTextFormField, AdBanner, etc.
b. Business Logic Layer
– ViewModels (lib/viewmodels/*): ListModel, EditModel, SettingsModel
– Validators & Utilities (lib/utils/stock_code_validator.dart)
c. Data Layer
– Models (lib/models/stock_memo.dart)
– Local DB Helper (lib/utils/dbhelper.dart) – likely using sqflite or similar
d. Platform & Deployment
– Flutter Engine & Dart VM
– Android native project (android/)
– iOS native project (ios/)
– Build scripts (pubspec.yaml, android/gradle, ios/Podfile)
– Packaging & Distribution (Google Play, App Store links)
Relationships & Data Flow
1) User taps a button on View → View calls its ViewModel
2) ViewModel orchestrates validation (stock_code_validator) and calls DBHelper
3) DBHelper performs CRUD on local SQLite DB → returns Model objects
4) ViewModel formats data → notifies View to update UI
5) Settings toggle (e.g., “いきなり入力”) persists to local storage → read by LoadPage on startup
– UI→ViewModel (Invoke action)
– ViewModel→DBHelper (Data request)
– DBHelper→SQLite (Write/Read)
– DBHelper→ViewModel (Data response)
– ViewModel→UI (State update)
Important Architectural Patterns
• MVVM (Model-View-ViewModel) – separation of concerns between UI, state, and data.
• Repository pattern via DBHelper – isolate persistence logic behind an interface.
• Offline-first design – no external network calls. All storage is local.
• Flutter’s platform channels – embedding within native Android/iOS shells.
Final Checklist
– [ ] UI Components layer with Views & Widgets
– [ ] ViewModel layer showing state managers
– [ ] Data layer with Models & DB helper
– [ ] Native shells (android/, ios/) and Flutter engine boundary
– [ ] Call out important files or directories where relevant (e.g., lib/utils/dbhelper.dart)