engine_web library
dart:js_interop helpers for the web arms of engine packages.
Import only from files that compile for web alone: the web arm of a
conditional import or export. Usually that is the DEFAULT branch of a
directive whose condition is dart.library.ffi or dart.library.io (false
on web), e.g. export 'src/engine_web.dart' if (dart.library.ffi) 'src/engine_io.dart';; sometimes it is the if (dart.library.js_interop)
branch. It imports dart:js_interop, so keep it off native code paths. The
web-safe engine SPI is engine.dart; tool/check_web_graph.dart walks the
web branch of every public library.
Classes
- BlobUrlModelSource
-
WebStorageMode.cacheApi/WebStorageMode.nonepath. url is ablob:URL produced byWebCacheService/BlobUrlManager, or anhttps:URL when caching is disabled. - OpfsStreamModelSource
-
WebStorageMode.streaming+opfs://<filename>path. Carries theWebOPFSServiceand the OPFS filename so each engine can ask for the form it consumes — MediaPipe wants aReadableStreamDefaultReader,@litert-lm/corewants the rawReadableStream. - WebModelSource
-
Result of resolving an active web model into a form an engine
(MediaPipe
LlmInferenceOR@litert-lm/coreEngine) can consume. - WebModelSourceResolver
-
Resolves the active inference model from
WebModelManagerinto the correct WebModelSource subtype based onServiceRegistryuseStreamingStorageand the resolved path prefix. This is the single piece of code that decides blob-URL vs OPFS-stream — bothWebInferenceModel(MediaPipe) andLiteRtLmWebInferenceModel(@litert-lm/core) consume it.
Functions
-
resolveWebModelUrl(
String rawPath) → Future< String> -
Resolves
rawPath— a model or tokenizer path core registered for an installed file — to a URL thatfetch()can load.