ModelLoadOptions class
Options used when resolving and loading model sources.
Native/file-backed backends use the package-managed download/cache manager for remote HTTP(S) and Hugging Face sources. Local ModelSource.path(...) values are already files: only sha256 verification and cancellation are meaningful for them. Remote/download-only options such as authenticated headers, explicit cache policies, cache directories, resume, and retries are rejected for local paths. URL-loading web backends can load remote URLs directly and reject options that require native cache IO, such as authenticated headers, checksum verification, and explicit cache policy changes.
Constructors
-
ModelLoadOptions({ModelCachePolicy cachePolicy = ModelCachePolicy.preferCached, String? cacheDirectory, String? sha256, String? bearerToken, Map<
String, String> headers = const <String, String>{}, ModelDownloadCancelToken? cancelToken, bool resume = true, int maxRetries = 3}) -
Creates model load options.
factory
Properties
- bearerToken → String?
-
Optional bearer token for authenticated remote model access.
final
- cacheDirectory → String?
-
Optional package-managed cache directory override.
final
- cachePolicy → ModelCachePolicy
-
Cache behavior for this load.
final
- cancelToken → ModelDownloadCancelToken?
-
Optional cancellation token for cooperative cancellation.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
headers
→ Map<
String, String> -
Additional HTTP headers for remote model access.
final
- maxRetries → int
-
Maximum retry attempts for native downloads.
final
- resume → bool
-
Whether interrupted native downloads may be resumed with HTTP Range.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sha256 → String?
-
Optional expected SHA-256 checksum for the model file.
final
Methods
-
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
Constants
- defaults → const ModelLoadOptions
- Compile-time default options for API default parameters.