isModelDownloaded method

Future<bool> isModelDownloaded(
  1. String modelId
)

Whether the GGUF file backing modelId is installed locally. Verifies existence + (when populated in _LlamaSpec.sha256) integrity.

Implementation

Future<bool> isModelDownloaded(String modelId) async {
  final spec = _modelSpecs[modelId];
  if (spec == null) return false;
  final path = await _modelPath(spec);
  final file = File(path);
  if (!await file.exists()) return false;
  if (spec.sha256 == null) return true;
  return await _verifySha256(file, spec.sha256!);
}