FetchPool class

Class used to fetch a list of URLs in parallel, only using a set number of operations in parallel.

Constructors

FetchPool({required int maxConcurrent, required List<String> urls, required String destinationDirectory, FetchPoolFileNamingStrategy fileNamingStrategy = FetchPoolFileNamingStrategy.basename, FetchPoolFileOverwritingStrategy fileOverwritingStrategy = FetchPoolFileOverwritingStrategy.overwrite})
Creates a new instance allowing maxConcurrent parallel downloads

Properties

client ↔ Client
The HTTP client to use
getter/setter pair
destinationDirectory String
Destination download directory
final
fileNamingStrategy FetchPoolFileNamingStrategy
Indicates how the local filename should be named. Defaults to basename.
final
fileOverwritingStrategy FetchPoolFileOverwritingStrategy
Indicates how to handle files of the same name that already exist in the target directory. Defaults to overwrite.
final
hashCode int
The hash code for this object.
no setterinherited
maxConcurrent int
Max number of concurrent operations (downloads)
final
resultsByUrl Map<String, FetchPoolResult>
Results keyed by the URL string
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
urls List<String>
List of URLs to download
final

Methods

fetch({dynamic progressCallback(double)?}) Future<Map<String, FetchPoolResult>>
Starts fetching the list of URLs
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

filenameFromUrl(String urlString, [FetchPoolFileNamingStrategy fileNamingStrategy = FetchPoolFileNamingStrategy.basename]) String
Convert the given Url string to a local filename, applying the given naming strategy