PrismDownloadManager class

Streams a file to disk with progress reporting and cancellation.

Used for direct downloads on platforms without a store flow (Windows, macOS, Linux, web-style links). Pure Dart — works everywhere.

final manager = PrismDownloadManager();
await for (final event in manager.download(
  url: Uri.parse('https://example.com/app.exe'),
  savePath: '/tmp/app.exe',
)) {
  if (event is PrismDownloadProgress) {
    print('${(event.fraction ?? 0) * 100}%');
  } else if (event is PrismDownloadComplete) {
    print('saved to ${event.file.path}');
  }
}

Constructors

PrismDownloadManager({HttpClient? client})
Creates a download manager. client is injectable for tests.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

cancelAll() → void
Cancels all active downloads.
close() → void
Closes the manager and its client.
download({required Uri url, required String savePath, Duration throughputWindow = const Duration(seconds: 1)}) → Stream<PrismDownloadEvent>
Streams url into savePath, emitting PrismDownloadProgress events on every chunk and exactly one terminal event at the end.
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