How rajvardhant/infoniche works
Project Type and Purpose
• This is a cross-platform Flutter news application (Android, iOS, Web, Windows, Linux, macOS).
• Purpose: fetch and display real-time news, current affairs, quizzes, user profiles, bookmarks and support offline storage, voice search, sharing, theming.
File Structure
• Top-level “android/”, “ios/”, “web/”, “linux/”, “macos/”, “windows/” directories: platform-specific embedding and native code.
• “lib/” directory: core app code, organized by MVC:
• lib/view/ – UI screens (Widgets)
• lib/controller/ – GetX controllers (business logic & routing)
• lib/model/ – Data models (from JSON/API)
• lib/repositry/ – Data access layer (API, local cache)
• lib/utils/ – Helpers (string utilities, date formatting)
• lib/view_model/ – (If used) view-specific state transformations
• “assets/” for images, “pubspec.yaml” for dependencies, test/ for widget tests.
README Insights
• Uses GetX for state management & routing, MVC pattern.
• Dependencies: http (REST API), get_storage/shared_preferences (local persistence), cached_network_image, speech_to_text, image_picker, permission_handler, shimmer, flutter_rating_bar, google_nav_bar.
Main Components
a. Presentation Layer (Flutter UI)
• View Widgets: HomeScreen, NewsDetailScreen, QuizScreen, ProfileScreen, etc.
• Theme management (light/dark)
• Native plugins: image_picker, speech_to_text, permission_handler
b. State Management Layer
• GetX Controllers: NewsController, BookmarkController, ThemeController, LanguageController, etc.
• Routing via GetX
c. Data Layer
• Repositories/Services:
• NewsRepository: HTTP calls to external News API
• CurrentAffairsRepository
• LocalStorageService: get_storage/shared_preferences wrapper
• HTTP Client: “http” library
• Caching: get_storage and cached_network_image
d. Domain Models
• Article, User, Source, Category, CurrentAffairs, Quiz, etc.
e. External & Platform Services
• External News API (REST endpoint)
• Native OS (speech recognition, image selection, share sheet)
• Device local storage (file system, shared preferences)
f. Cross-cutting Utilities
• Logging, string_utils, error handling
Relationships & Data Flows
• User taps UI → View sends event to Controller.
• Controller checks cache via LocalStorageService; if stale or offline, calls Repository.
• Repository issues HTTP request to News API.
• API returns JSON → Repository parses into Model objects.
• Controller updates Observables → View reacts and rebuilds UI.
• Bookmark actions write to local DB or shared_preferences.
• Voice search invokes speech_to_text plugin → Controller processes transcription → triggers search.
Architectural Patterns & Principles
• MVC with clear separation of concerns.
• Unidirectional data flow: View → Controller → Repository → API/Local → Model → Controller → View.
• Dependency inversion: Controllers depend on abstract repository interfaces.
• Caching and offline-first strategy.