WebAssetSourceHandler class

Handles installation of models from Flutter assets on web platform

On web, Flutter assets are served by the web server at paths like:

  • assets/models/gemma.task
  • assets/lora/weights.bin

This handler:

  1. Registers the asset URL with WebFileSystemService
  2. Saves metadata to ModelRepository
  3. MediaPipe loads directly from the URL (no file copy)

Features:

  • No file copying (web has no local file system)
  • Direct URL registration for MediaPipe
  • Simulated progress for UX consistency
  • Instant "installation" (assets already bundled)

Platform: Web only

Implemented types

Constructors

WebAssetSourceHandler.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