TFLiteModelDownloader class
Downloads and caches a TFLite anti-spoof model on first use.
Mirrors the FaceModelDownloader pattern: the model is fetched once from modelUrl, stored permanently in the app documents directory, and returned instantly from cache on all subsequent calls.
Constructors
- TFLiteModelDownloader({required String modelUrl, String? fallbackUrl, void onProgress(double progress)?})
Properties
- fallbackUrl → String?
-
Optional fallback URL tried if modelUrl returns a bad response.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- modelUrl → String
-
Remote URL to download the model from.
final
- onProgress → void Function(double progress)?
-
Called with 0.0–1.0 during download; not called when served from cache.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
ensureModel(
) → Future< String> - Returns the absolute filesystem path to the cached model, downloading it first if it is missing or corrupted.
-
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
Static Methods
-
clearCache(
) → Future< void> - Delete the cached model to force a fresh download next time.
Constants
- bundledInputSize → const int
- Input size required by the bundled model.
- bundledModelUrl → const String
- Default bundled anti-spoof model — used automatically when LivenessConfig.enableTFLite is true and no custom URL/path is set.