WebDownloadService class

Web implementation of DownloadService

This implementation doesn't actually download files. Instead, it registers URLs with the WebFileSystemService so MediaPipe can fetch them directly.

Features:

  • URL registration (no actual download)
  • Progress simulation for UX consistency (matches mobile experience)
  • Authentication token support (passed to MediaPipe)
  • Fast "installation" (just URL registration)

Design rationale:

  • Web browsers handle download/caching automatically
  • MediaPipe fetches models from URLs at session creation time
  • Simulating progress gives users consistent UX across platforms
  • No local storage needed (browser manages cache)

Platform: Web only

Implemented types

Constructors

WebDownloadService.new(WebFileSystemService _fileSystem, WebJsInterop _jsInterop, BlobUrlManager _blobUrlManager)

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

cancel(String taskId) Future<void>
Cancels an active download
override
canResume(String taskId) Future<bool>
Checks if a download task can be resumed
override
download(String url, String targetPath, {String? token}) Future<void>
Downloads a file from URL to target path
override
downloadWithProgress(String url, String targetPath, {String? token, int maxRetries = 10}) Stream<int>
Downloads a file with progress tracking
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resume(String taskId) Future<void>
Resumes a previously interrupted download
override
toString() String
A string representation of this object.
inherited

Operators

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