WebOPFSService class

Service for OPFS file management

Features:

  • Download large files (>2GB) directly to OPFS
  • Check cache status
  • Get stream readers for MediaPipe
  • Storage quota management

Constructors

WebOPFSService(OPFSInterop _opfs)
WebOPFSService.fromWindow()
Factory constructor using global window.flutterGemmaOPFS
factory

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

clearAll() Future<int>
Clear all models from OPFS (for testing/development)
deleteModel(String filename) Future<void>
Delete a model from OPFS
downloadToOPFS(String url, String filename, {String? authToken, required void onProgress(int percentage), JSAny? abortSignal}) Future<void>
Download a model to OPFS with progress tracking and cancellation support
getCachedModelSize(String filename) Future<int?>
Get the size of a cached model file
getStorageStats() Future<Map<String, int>>
Get current storage statistics
getStreamReader(String filename) Future<JSAny>
Get a ReadableStreamDefaultReader for streaming a model file
isModelCached(String filename) Future<bool>
Check if a model is cached in OPFS
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