How frostnova721/animestream works
Project Type and Purpose
• This is a cross-platform Flutter application (“animestream”) for streaming and downloading anime, with built-in tracking via third-party anime databases (Anilist, MAL, Simkl).
• It targets Android, iOS, Web, Windows, macOS, and Linux using a single Dart/Flutter codebase + platform embedder code (Kotlin/Java for Android, Swift for iOS/macOS, C++/CMake for desktop, HTML/CSS/JS for Web).
File-Structure Analysis & Architectural Patterns
• Top-Level:
• android/, ios/, macos/, linux/, windows/, web/ – Flutter embedder and native platform code
• lib/ – Dart code, subdivided into:
– core/ – domain-level logic (download manager, extractors, providers, data & database handlers, news, app versioning)
– ui/ – presentation layer (widgets, pages, models, theme, assets)
– main.dart – application entrypoint
• pubspec.yaml / buildscripts – dependency & build configuration
• test/ – widget tests
• Architectural Pattern:
• Presentation layer uses Provider-style dependency injection (ui/models/providers).
• Domain layer in core/ separates business logic (downloadManager, providerManager, extractors) from data access.
• Data layer uses Hive (local NoSQL), secureStorage, and HTTP/GraphQL handlers for Anilist, MAL, Simkl.
Key Components
A. Flutter Engine & Embedder
B. Presentation Layer (UI)
• Pages (home, discover, info, watch, downloads, settings)
• Widgets (cards, controls, subtitle viewer, bottom sheets)
• Theme management
C. State Management / Provider Layer
• Provider instances (playerProvider, themeProvider, infoProvider, etc.)
• They act as controllers binding UI → domain
D. Domain / Core Logic
• Download Manager: handles stream extraction, file writes, progress events
• Extractors & Providers: anime source plugins (kwik, streamwish, AnimePahe, etc.)
• News module for fetching Anime news
• App runtime (version checking, updates)
E. Data Access Layer
• HTTP / GraphQL clients for Anilist, MAL, Simkl
• Secure storage for sensitive data (tokens)
F. External Services
• Anime streaming hosts (via plugins)
• Tracking APIs (Anilist GraphQL, MAL API, Simkl API)
• Subtitle parsers for SRT, ASS, VTT
G. File System
• Downloaded video files saved on device storage
• Persistent caches & config files
Relationships & Data Flows
• UI → Provider → Core Logic → Data Access → External Service → Core Logic → Provider → UI
• Download Flow: UI (download page) triggers Download Manager → Extractor plugin retrieves stream URL → DownloadManager writes to FS → signals progress back up
• Tracking Flow: UI triggers “mark as watched” → GraphQL client sends mutation to Anilist/MAL/Simkl → updates hive database for offline sync → Provider updates UI
• Settings Flow: UI toggles setting → Preferences module writes to Hive/SecureStorage → Provider notifies UI
Architectural Patterns & Principles
• Layered architecture: Presentation / State / Domain / Data / Infrastructure
• Plugin pattern for providers & extractors – easy to register new anime sources
• Repository/Data Access abstraction for external APIs
• Provider / Dependency Injection for decoupling UI from business logic