How autsunset/vidbee_flutter works
Purpose and Entry Points
VidBee is a Flutter Material 3 client for parsing and downloading video/audio through yt-dlp, primarily targeting Android while carrying a Windows runner. The Dart application starts at lib/main.dart; Android embeds Flutter through android/app/src/main/kotlin/com/vidbee/vidbee_flutter/MainActivity.kt. Android packages a ytdlp executable at android/app/src/main/res/raw/ytdlp.
Application Composition
Feature pages organize the primary user workflows:
• Add and parse a URL, select formats, and manage active downloads: lib/features/download/add_url_dialog.dart, lib/features/download/downloads_page.dart.
• View persisted completed/failed items and retry or open/share files: lib/features/history/history_page.dart.
• Configure cookies, WebView-based logins, logs, and app settings: lib/features/settings/settings_page.dart, lib/features/settings/cookie_settings_section.dart, lib/features/settings/webview_login_page.dart.
Shared task presentation lives in lib/shared/widgets/task_widgets.dart; localized UI resources are centralized under lib/shared/i18n/.
State, Models, and Dependency Boundary
Riverpod providers form the dependency and state-management boundary, wiring services to UI instead of allowing pages to directly own infrastructure concerns: lib/core/providers/service_providers.dart, lib/core/providers/providers.dart. Core transfer/domain records include task lifecycle state and parsed video/playlist metadata: lib/core/models/download_task.dart, lib/core/models/video_info.dart, lib/core/models/playlist_info.dart.
Download Pipeline
The download flow accepts a URL, invokes the yt-dlp/extractor integration to inspect available media, creates DownloadTask records, and executes/downloads while exposing progress to the UI. lib/core/services/ytdlp_service.dart is the external-engine adapter; lib/core/services/download_service.dart coordinates transfer lifecycle; lib/core/utils/download_filename.dart and lib/core/utils/media_scanner.dart handle output naming and device media visibility. yt-dlp provides multi-site extraction, while FFmpeg is an expected multimedia-processing dependency.
Persistence and Recovery
Download history is local SQLite managed through Drift. The schema/database layer is lib/core/database/app_database.dart; query and history-specific persistence are in lib/core/database/download_history_dao.dart; generated Drift bindings are checked in as lib/core/database/app_database.g.dart. lib/core/services/history_service.dart bridges persisted history to task restoration, deduplication, retry, and file actions after application restart.
Authentication, Files, and Device Services
Cookie storage/import and custom request identity are handled behind lib/core/services/cookie_service.dart, supporting Netscape-format cookies for authenticated extraction. Settings may launch embedded platform logins via lib/features/settings/bilibili_login_page.dart and lib/features/settings/webview_login_page.dart. Platform boundaries—permissions, external file opening/sharing, and notifications—are isolated in lib/core/utils/permission_helper.dart, lib/core/utils/file_opener.dart, and lib/core/services/notification_service.dart.
Platform and Release Infrastructure
The Android project supplies manifests, network/file-provider policy, and the bundled native downloader: android/app/src/main/AndroidManifest.xml, android/app/src/main/res/xml/network_security_config.xml, android/app/src/main/res/xml/file_paths.xml. Windows is a conventional Flutter desktop host under windows/runner/main.cpp. Update checks are encapsulated in lib/core/services/app_update_service.dart, likely consuming release infrastructure rather than being part of download execution. CI build automation is defined in .github/workflows/build.yml.
Main entry points: service_providers.dart Riverpod boundary · download_service.dart Download coordinator · downloads_page.dart Download workflow · history_service.dart History recovery
Components 21
Flutter client
- App entry
lib/main.dart - Download workflow · Adds URLs, selects formats, and manages active tasks.
lib/features/download/downloads_page.dart - URL parser dialog
lib/features/download/add_url_dialog.dart - History page
lib/features/history/history_page.dart - Settings & login · Settings, cookie controls, and embedded login flows.
lib/features/settings/settings_page.dart - Task presentation
lib/shared/widgets/task_widgets.dart - Riverpod boundary · Wires UI state to application services.
lib/core/providers/service_providers.dart - Tasks & media metadata · Download lifecycle plus video and playlist records.
lib/core/models/download_task.dart
Download pipeline
- Download coordinator · Creates tasks and manages transfer lifecycle.
lib/core/services/download_service.dart - yt-dlp adapter · Inspects media and invokes the external extractor.
lib/core/services/ytdlp_service.dart - Output & media scan · Names files and exposes completed media to the device.
lib/core/utils/download_filename.dart
Persistence & device
- History recovery · Restores, deduplicates, retries, and acts on saved tasks.
lib/core/services/history_service.dart - History DAO
lib/core/database/download_history_dao.dart - SQLite database
lib/core/database/app_database.dart - Cookie service · Imports and stores Netscape-format cookies.
lib/core/services/cookie_service.dart - Notifications & file actions · Permissions, file opening/sharing, and completion notifications.
lib/core/services/notification_service.dart
Platform & release
- Bundled yt-dlp
android/app/src/main/res/raw/ytdlp - Android host & policy · Flutter host, manifest, and network/file-provider policy.
android/app/src/main/AndroidManifest.xml - Windows host
windows/runner/main.cpp - Update checks
lib/core/services/app_update_service.dart - Build CI
.github/workflows/build.yml
Connections 25
- App entry → Riverpod boundary: initializes
- App entry → Download workflow: renders
- Download workflow → URL parser dialog: opens
- Download workflow → Task presentation: uses
- History page → Task presentation: uses
- Download workflow → Riverpod boundary: consumes state
- History page → Riverpod boundary: consumes state
- Settings & login → Riverpod boundary: consumes state
- Riverpod boundary → Download coordinator: provides
- Riverpod boundary → History recovery: provides
- Riverpod boundary → Cookie service: provides
- Riverpod boundary → Update checks: provides
- Download coordinator → Tasks & media metadata: creates and updates
- Download coordinator → yt-dlp adapter: extracts and downloads
- Download coordinator → Output & media scan: writes output
- Download coordinator → History recovery: persists lifecycle
- Download coordinator → Notifications & file actions: reports completion
- yt-dlp adapter → Cookie service: uses authenticated requests
- yt-dlp adapter → Bundled yt-dlp: invokes on Android
- History recovery → History DAO: queries and saves
- History DAO → SQLite database: reads and writes
- History page → History recovery: retries and opens files
- Android host & policy → App entry: embeds Flutter
- Build CI → Android host & policy: builds
- Build CI → Windows host: builds