flutter_multiple_downloader 1.0.0 copy "flutter_multiple_downloader: ^1.0.0" to clipboard
flutter_multiple_downloader: ^1.0.0 copied to clipboard

A Flutter package for multiple concurrent downloads with chunk-based downloading support.

flutter_multiple_downloader #

A Flutter package for multiple concurrent downloads with chunk-based downloading support. This package supports null safety and is compatible with Flutter 3.10+.

Features #

  • Multiple Concurrent Downloads: Download files using multiple concurrent connections
  • Chunk-based Downloading: Split large files into chunks for efficient downloading
  • Progress Tracking: Monitor download progress with percentage callbacks
  • Stream Support: Use streams for real-time download progress updates
  • Null Safety: Fully supports Dart null safety
  • Error Handling: Comprehensive error handling for network issues

Installation #

Add this to your package's pubspec.yaml file:

dependencies:
  flutter_multiple_downloader: ^1.0.0

Usage #

Basic Download #

import 'package:flutter_multiple_downloader/flutter_multiple_downloder.dart';

// Create a downloader instance
final downloader = Downloader(
  'https://example.com/large-file.zip',
  chunkSize: 1024 * 1024, // 1MB chunks
  p: 3, // 3 concurrent connections
);

// Download with progress callback
await downloader.download(
  onPercentage: (done, total) {
    print('Downloaded: $done/$total chunks');
  },
);

// Get the downloaded data
if (downloader.noError) {
  final data = downloader.state.asList();
  print('Downloaded ${data.length} bytes');
}

// Clean up
downloader.markFinished();

Stream-based Download #

// Get download stream
final stream = await downloader.downStream();

// Listen to progress updates
await for (final state in stream) {
  print('Progress: ${state.successCount}/${state.chunks.length}');
}

// Check if download was successful
if (downloader.noError) {
  final data = downloader.state.asList();
  // Process downloaded data
}

Configuration #

Downloader Parameters #

  • url: The URL of the file to download
  • chunkSize: Size of each download chunk (default: 501001 bytes)
  • p: Number of concurrent connections (default: 2)

Error Handling #

The package throws specific exceptions:

  • UnsupportedException: When the server doesn't support range requests
  • DownloadFailureException: When download fails due to network issues

Requirements #

  • Dart SDK: >=3.0.0 <4.0.0
  • Flutter: >=3.10.0

License #

This project is licensed under the terms specified in the LICENSE file.

0
likes
140
points
50
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package for multiple concurrent downloads with chunk-based downloading support.

Homepage

Documentation

API reference

License

GPL-3.0 (license)

Dependencies

flutter

More

Packages that depend on flutter_multiple_downloader