WebFileSourceHandler class

Handles installation of models from external file paths (WEB PLATFORM)

On web, FileSource can ONLY work with:

  1. HTTP/HTTPS URLs (e.g., https://example.com/model.task)
  2. Asset paths (e.g., assets/models/model.task)

Local file paths (e.g., /path/to/model.task) are NOT supported because web browsers cannot access the local file system.

This handler:

  1. Validates that the path is a URL or asset path
  2. Registers the URL with WebFileSystemService
  3. Saves metadata to ModelRepository
  4. MediaPipe loads directly from the URL

Features:

  • URL validation (must be http://, https://, or assets/)
  • Direct URL registration (no copying)
  • Single-step progress (URL already exists)
  • Clear error messages for unsupported paths

Platform: Web only

Implemented types

Constructors

WebFileSourceHandler.new({required WebFileSystemService fileSystem, required ModelRepository repository})

Properties

fileSystem WebFileSystemService
final
hashCode int
The hash code for this object.
no setterinherited
repository ModelRepository
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

install(ModelSource source) Future<void>
Installs the model from the given source
override
installWithProgress(ModelSource source) Stream<int>
Installs the model with progress tracking
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
supports(ModelSource source) bool
Checks if this handler supports the given source type
override
supportsResume(ModelSource source) bool
Checks if this source supports resume after interruption
override
toString() String
A string representation of this object.
inherited

Operators

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