style: lint



The download_assets package is a powerful library that facilitates the process of downloading assets into the application. With this library, you can easily download files, images, videos, and other resources in your app, providing a smooth and efficient user experience.



Init method for setting up the assetsDir, which is required to be called during app initialization.

await downloadAssetsController.init();


Starts the asset download process.

  • assetsUrls: A list of URLs representing each file to be downloaded.
  • uncompressDelegates: A list of custom decompression delegates for different types of file, such as ZIP, RAR, etc (optional).
  • onProgress: Optional callback function that provides download progress information.
  • onCancel: Cancels the ongoing download.
  • requestQueryParams: Query params to be used in the request (optional).
  • requestExtraHeaders: Extra headers to be added in the request (optional).
await downloadAssetsController.startDownload(
    onCancel: () {
        //TODO: implement cancel here
    assetsUrls: [
    onProgress: (progressValue) {
        //TODO: Implement progress here


Remove all downloaded assets from local storage.

await downloadAssetsController.clearAssets();


Path to the files.



Returns true if the assetsDir path exists.

return await downloadAssetsController.assetsDirAlreadyExists();


Return true if the file exists.

return await downloadAssetsController.assetsFileExists(<file_name>);

Uncompress delegate

Uncompress delegates are responsible for implementing the logic to uncompress different types of files, such as ZIP, RAR, etc. By providing a list of delegates, it becomes possible to support multiple file formats during the download.

To implement your own uncompression delegate, you should implement the interface below.

/// Abstract class representing a delegate for asset decompression.
abstract class UncompressDelegate {
  const UncompressDelegate();

  /// Gets the file extension associated with the delegate.
  String get extension;

  /// uncompress the asset located at [compressedFilePath] to the specified [assetsDir].
  /// [compressedFilePath] -> The path to the compressed asset file.
  /// [assetsDir] -> The directory where the uncompressed asset should be stored.
  Future uncompress(String compressedFilePath, String assetsDir);

Note: This kind of delegate is essential for enabling the download process to handle various file formats by implementing the necessary decompression logic. This flexibility allows users to download and work with a wide range of compressed file types effortlessly. UnzipDelegate(), is already included, which handles the decompression of ZIP files.


You can find an example here:


Contributions are welcome! If you encounter any issues or have suggestions for improvement, please create an issue on the GitHub repository.