file_system_management 1.0.1
file_system_management: ^1.0.1 copied to clipboard
A Flutter package for managing file download and upload tasks with progress tracking, customizable handlers, and social media-inspired UI widgets.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
1.0.0 - 2025-12-27 #
⚠️ Breaking Changes #
- Minimum Dart SDK upgraded to 3.5.0
- Minimum Flutter SDK upgraded to 3.24.0
- Updated
background_downloaderto ^9.4.3
Added #
Clean Architecture Restructuring
-
Domain Layer - Pure business logic without external dependencies
TransferEntity- Core transfer business entityTransferConfigEntity- Transfer configuration entityTransferRepository- Abstract repository interfaceStorageRepository- Storage operations interfaceCacheRepository- Cache operations interfacePermissionRepository- Permission handling interfaceResult<T>- Functional error handling withSuccess/Fail- Sealed
Failureclasses:NetworkFailure,StorageFailure,CancelledFailure, etc. - Use cases:
EnqueueDownloadUseCase,EnqueueParallelDownloadUseCase,EnqueueUploadUseCase,PauseTransferUseCase,ResumeTransferUseCase,CancelTransferUseCase,GetTransferUseCase,GetAllTransfersUseCase,CheckAvailableSpaceUseCase
-
Data Layer - Repository implementations
DownloaderDataSource- Wrapper for background_downloaderTransferRepositoryImpl- Full repository implementationTransferModel- Data transfer object with mapping
-
Infrastructure Layer - Cross-cutting concerns
FileCacheManager- LRU cache with stale entry cleanupAppDirectory- Application directory management
-
Presentation Layer - UI components
TransferController- Facade controller with clean API- Maintains existing widgets and themes
-
Core Module - Shared utilities
- Extensions, mutex, queue managers
New background_downloader Features
- Parallel Downloads -
createParallelDownloadTask()for faster large file downloads- Split files into multiple chunks for simultaneous download
- Support for multiple URLs/mirrors
- Configurable chunk count
- Resume Failed Downloads -
resumeFailedDownload()continues from failure point- Works even without
allowPauseenabled - Requires server ETag support
- Works even without
- Reschedule Missing Tasks -
rescheduleMissingTasks()recovers tasks after crash- Compares database with native downloader
- Returns success/failure lists
- Skip Existing Files -
Config.skipExistingFilesoption- Skip downloads if file already exists
- Optional minimum size threshold
- Foreground Mode - Run in foreground on Android for longer tasks
- Request Timeout - Configurable timeout duration
- Storage Space Check -
availableSpace()before downloading large files - Permissions Helper -
permissionsgetter for notifications/storage permissions
Enhanced FileSystemController
- New
initialize()parameters:skipExistingFiles- Skip if file existsskipExistingFilesMinSize- Size threshold for skippingrunInForeground- Android foreground moderequestTimeout- Request timeout duration
Enhanced createDownloadTask
priority- Task priority (0-10)requiresWiFi- Require WiFi connectionretries- Auto-retry countoptions- Advanced TaskOptions (onTaskStart, onTaskFinished, auth)
Individual Download Controls
pauseDownload(url)- Pause specific downloadresumeDownload(url)- Resume specific downloadisDownloadPaused(url)- Check pause state- UI controls in example app for pause/resume/cancel
Changed #
- Improved concurrency on mobile (JSON encoding in isolate)
- Better thread safety with job queue for message execution
0.2.1 - 2025-12-27 #
Added #
Queue Management System with Custom Executors
QueuedTransferProvider- Flexible provider with multiple integration options- Constructor with optional
downloadExecutorcallback QueuedTransferProvider.withHandler()- Integration withDownloadHandlerclassesQueuedTransferProvider.withCallback()- Simple callback-based integrationcreateDownloadCallback()for widget integration
- Constructor with optional
RealDownloadProvider- Production-ready provider usingFileSystemController- Real file downloads with progress tracking
- Automatic file caching with URL recognition
- Cache lookup with
getCachedPath()andgetCompletedPath() - Full queue management with pause/resume/cancel/retry
- Integration with
background_downloaderpackage
WhatsApp-like Example App
- Redesigned
QueuedChatDemoScreenwith WhatsApp-inspired UI- Chat bubble styling with incoming/outgoing message differentiation
- Green color scheme matching WhatsApp theme
- Timestamps and read receipts (blue ticks)
- Arabic RTL support
- Video playback integration using
video_playerandchewie- Full video controls after download
- Aspect ratio preservation
- WhatsApp-style progress colors
- Audio playback integration using
just_audio- Waveform visualization with progress indicator
- Play/pause controls
- Duration and position display
- Full-screen image viewer with zoom support
- Document/file opening with
open_filex - Download progress shown inside circular buttons
Queue Management System
TransferQueueManager<T>- Generic queue manager with configurable concurrency- Priority-based queue (urgent, high, normal, low)
- Configurable
maxConcurrenttransfers - Auto-retry support with configurable
maxRetries - Pause/resume queue operations
- Cancel individual or all transfers
- Change priority of queued transfers
- Move transfers to front of queue
- Stream-based state updates
- Overall progress tracking
DownloadQueueManager- Specialized download queue- Integration with
FileSystemController - Add by URL or
DownloadTask - Add multiple URLs at once
- Progress tracking per download
- Pause/resume individual downloads
- Wait for specific or all downloads
- Integration with
UploadQueueManager- Specialized upload queue- Similar API to
DownloadQueueManager - Add files by path or
UploadTask
- Similar API to
QueuedTransfer<T>- Individual transfer wrapper- Progress stream
- Future completion
- Cancellation token
- Queue position tracking
- Metadata support
TransferPriorityenum - Priority levels for queue orderingQueuedTransferStatusenum - Status tracking for queued transfersTransferQueueState<T>- Queue state snapshot with statisticsTransferQueueResult<T>- Result wrapper for completed transfers
Queue Integration with Message Widgets
QueuedTransferProvider- Provider for integrating queue with message widgetsenqueueDownload()- Enqueue downloads from widget callbackscreateDownloadCallback()- Create reusable download callbacks- Queue position tracking per widget
- Priority support for widget downloads
QueuedChatDemoScreen- Example screen demonstrating queue with widgets- Real-time queue status display
- Dynamic concurrent limit adjustment
- Queue position indicators per message
- Move to front / cancel controls
- Real Firebase Storage URLs demonstration
- Multiple file types (images, PDF, video, audio, ZIP)
Changed #
DownloadPayloadnow includesheadersproperty for custom request headersTransferQueueManagernow exposesallTransfersgetter for accessing all queued transfers- Improved generic type handling in
TransferQueueState<T>stream
0.2.0 - 2025-12-26 #
Added #
Injectable Upload/Download Handlers
UploadHandlerandDownloadHandlerabstract classes for custom backend integrationTransferProgressmodel with comprehensive progress tracking (bytes, speed, ETA)TransferResultsealed class withTransferSuccess,TransferFailure,TransferCancelledCancellationTokenfor fine-grained transfer controlTransferConfigfor configuring headers, timeouts, retriesUploadPayloadandDownloadPayloadfor transfer parametersTransferBuilderfor fluent API with callbacks
Social Media Skins & Theming
SocialTransferThemeDatawith comprehensive theming supportSocialTransferThemeInheritedWidget for theme propagationSocialSkinenum:whatsapp,telegram,instagram,custom- Pre-built themes:
SocialTransferThemeData.whatsapp()- WhatsApp-inspired designSocialTransferThemeData.telegram()- Telegram-inspired designSocialTransferThemeData.instagram()- Instagram-inspired design
- Dark mode support for all skins (
isDark: true) - RTL support built-in
- Customizable colors, typography, shapes, icons, animations
Message Transfer Widgets
AudioMessageTransferWidget- Audio/voice message transfers- Waveform visualization
- Duration display
- Play/pause controls
- Playback progress
ImageMessageTransferWidget- Image message transfers- Thumbnail preview with blur overlay
- Full image display after completion
- Caption support
- Full-screen preview
VideoMessageTransferWidget- Video message transfers- Thumbnail preview
- Duration badge
- Play button overlay
- Mute indicator
FileMessageTransferWidget- Generic file transfers- Auto-detected file type icons
- Extension badge
- Multiple file type support
DocumentMessageTransferWidget- Document transfers (PDF, DOCX, etc.)- Document type icons with colors
- Page count display
- Thumbnail preview option
Base Widget System
BaseMessageTransferWidgetabstract class for common functionalityTransferWidgetStateenum for UI statesTransferWidgetConfigfor widget configurationBubbleDirectionenum for incoming/outgoing messages- Built-in state management
- Progress tracking
- Pause/resume/cancel/retry support
Changed #
- Enhanced
TransferItemwith more status helpers - Updated main library exports to include new modules
- Improved documentation with comprehensive examples
Deprecated #
TaskItem- UseTransferIteminstead (still exported for compatibility)
0.1.0 Initial Release #
Added #
- File download with progress tracking
- Pause, resume, and cancel downloads
- Background download support
- Notification support for download status
- Thumbnail preview for media files
- Stream-based progress updates
FileSystemControllersingleton for global access- Mutex-based locking to prevent duplicate operations
- Automatic file caching with URL recognition
MediaDownloadCardwidgetDocumentDownloadCardwidgetTransferCardwidgetTransferProgressIndicatorwidgetTransferItemmodel with comprehensive propertiesFileModelfor file metadataFileTypeEnumfor file categorization- Core utilities:
AppDirectory,FileCacheManager,TaskMutex - String and path extensions