Project Structure
Project Structure
Section titled “Project Structure”Understanding the project structure is crucial for effective development and customization. Lumo follows Flutter best practices with a feature-driven architecture.
Overview
Section titled “Overview”lumo/├── lib/ # Main source code├── android/ # Android-specific code├── ios/ # iOS-specific code├── assets/ # Static assets├── test/ # Tests├── docs/ # Documentation (this site)├── pubspec.yaml # Dependencies and project config└── README.md # Project overviewMain Source Directory (lib/)
Section titled “Main Source Directory (lib/)”Core Architecture
Section titled “Core Architecture”lib/├── main.dart # Application entry point├── core/ # Core utilities and shared code│ ├── constants/ # App constants and enums│ ├── exceptions/ # Custom exception classes│ ├── extensions/ # Dart extensions│ ├── theme/ # App theming and colors│ └── utils/ # Utility functions├── features/ # Feature-based modules│ ├── authentication/ # User authentication│ ├── otp/ # OTP generation and management│ ├── backup/ # Backup and restore│ ├── settings/ # App settings│ └── security/ # Security features├── shared/ # Shared widgets and components│ ├── widgets/ # Reusable UI components│ ├── providers/ # Global state providers│ └── services/ # Shared services└── app.dart # App configuration and routingFeature-Based Architecture
Section titled “Feature-Based Architecture”Each feature follows a consistent structure based on Clean Architecture principles:
features/otp/├── data/ # Data layer│ ├── datasources/ # Data sources (local/remote)│ ├── models/ # Data models│ └── repositories/ # Repository implementations├── domain/ # Business logic layer│ ├── entities/ # Domain entities│ ├── repositories/ # Repository interfaces│ └── usecases/ # Business use cases└── presentation/ # Presentation layer ├── pages/ # UI screens/pages ├── widgets/ # Feature-specific widgets └── providers/ # State management (Riverpod)Key Directories Deep Dive
Section titled “Key Directories Deep Dive”Contains shared utilities and foundational code:
-
constants/: App-wide constantsapp_constants.dart- General app constantsstorage_keys.dart- Secure storage keysapi_endpoints.dart- API endpoints
-
exceptions/: Custom exception handlingapp_exceptions.dart- Base exception classesotp_exceptions.dart- OTP-specific exceptions
-
theme/: Application themingapp_theme.dart- Theme configurationapp_colors.dart- Color definitionstext_styles.dart- Typography styles
-
utils/: Utility functionscrypto_utils.dart- Encryption utilitiesotp_utils.dart- OTP generation logicvalidators.dart- Input validation
features/otp/
Section titled “features/otp/”The main OTP functionality:
Data Layer:
datasources/otp_local_datasource.dart- Local storage operationsmodels/otp_entry_model.dart- OTP data modelsrepositories/otp_repository_impl.dart- Repository implementation
Domain Layer:
entities/otp_entry.dart- Core OTP entityrepositories/otp_repository.dart- Repository interfaceusecases/generate_otp.dart- OTP generation use case
Presentation Layer:
pages/otp_list_page.dart- Main OTP list screenpages/qr_scanner_page.dart- QR code scannerwidgets/otp_tile.dart- Individual OTP display widgetproviders/otp_provider.dart- State management
features/authentication/
Section titled “features/authentication/”User authentication and security:
Key Files:
pages/auth_gate.dart- Authentication wrapperpages/biometric_setup_page.dart- Biometric configurationproviders/auth_provider.dart- Authentication stateservices/biometric_service.dart- Biometric authentication
features/backup/
Section titled “features/backup/”Cloud backup and restore functionality:
Key Files:
pages/backup_page.dart- Backup management UIservices/firebase_backup_service.dart- Firebase integrationmodels/backup_model.dart- Backup data structure
shared/
Section titled “shared/”Shared components across features:
Widgets:
custom_button.dart- Standardized buttonsloading_overlay.dart- Loading indicatorserror_dialog.dart- Error display widgets
Services:
storage_service.dart- Secure storage wrappernavigation_service.dart- Navigation utilities
Platform-Specific Code
Section titled “Platform-Specific Code”Android (android/)
Section titled “Android (android/)”android/├── app/│ ├── src/main/│ │ ├── AndroidManifest.xml # App permissions and config│ │ ├── kotlin/ # Native Android code│ │ └── res/ # Android resources│ ├── build.gradle.kts # Build configuration│ └── google-services.json # Firebase config└── gradle/ # Gradle wrapperImportant Android Files:
AndroidManifest.xml- Permissions, app identitybuild.gradle.kts- Build settings, signing configMainActivity.kt- Main Android activity
iOS (ios/)
Section titled “iOS (ios/)”ios/├── Runner/│ ├── Info.plist # iOS app configuration│ ├── GoogleService-Info.plist # Firebase config│ └── Assets.xcassets/ # iOS app icons├── Runner.xcodeproj/ # Xcode project└── Podfile # CocoaPods dependenciesImportant iOS Files:
Info.plist- App configuration, permissionsGoogleService-Info.plist- Firebase configurationPodfile- Native iOS dependencies
Assets Structure
Section titled “Assets Structure”assets/├── icons/ # App icons and UI icons│ ├── issuers/ # Service provider icons│ └── ui/ # Interface icons├── images/ # Static images├── lottie/ # Lottie animations└── fonts/ # Custom fonts (if any)Configuration Files
Section titled “Configuration Files”pubspec.yaml
Section titled “pubspec.yaml”Main project configuration:
- Dependencies and dev dependencies
- Asset declarations
- Flutter and Dart SDK constraints
- App metadata
analysis_options.yaml
Section titled “analysis_options.yaml”Code analysis and linting rules
Build Configuration
Section titled “Build Configuration”android/app/build.gradle.kts- Android build settingsios/Runner.xcodeproj/- iOS build settings
State Management Architecture
Section titled “State Management Architecture”Lumo uses Riverpod for state management with a specific pattern:
// Provider definitionfinal otpListProvider = StateNotifierProvider<OtpListNotifier, List<OtpEntry>>( (ref) => OtpListNotifier(ref.read(otpRepositoryProvider)),);
// State notifierclass OtpListNotifier extends StateNotifier<List<OtpEntry>> { // Implementation}
// UI consumptionclass OtpListPage extends ConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { final otpList = ref.watch(otpListProvider); // Build UI }}Navigation Structure
Section titled “Navigation Structure”The app uses named routes with a centralized routing system:
// Route definitions in app.dartclass AppRouter { static const String home = '/'; static const String scanner = '/scanner'; static const String settings = '/settings'; // ... more routes}Database Schema
Section titled “Database Schema”Lumo uses Realm for local data storage:
@RealmModel()class _OtpEntry { @PrimaryKey() late String id; late String issuer; late String account; late String secret; // ... more fields}Testing Structure
Section titled “Testing Structure”test/├── unit/ # Unit tests├── widget/ # Widget tests├── integration/ # Integration tests└── mocks/ # Mock objectsKey Design Patterns
Section titled “Key Design Patterns”- Repository Pattern: Data access abstraction
- Provider Pattern: Dependency injection with Riverpod
- Clean Architecture: Separation of concerns
- Feature-driven: Modular organization by functionality
Customization Points
Section titled “Customization Points”When rebranding or customizing:
- App Identity:
android/app/src/main/AndroidManifest.xml,ios/Runner/Info.plist - Colors & Theme:
lib/core/theme/ - Icons & Assets:
assets/directory - App Name:
pubspec.yaml, platform manifests - Package Name: Platform-specific configuration files
Next Steps
Section titled “Next Steps”Now that you understand the structure:
- Rebranding Overview - Start customizing the app
- Development Setup - Learn the development workflow
- Architecture Deep Dive - Understand the technical details
The modular structure makes Lumo easy to understand, customize, and extend! 🏗️