isModelInstalled static method

Future<bool> isModelInstalled(
  1. ModelSpec spec
)

Checks if a specific model specification is currently installed

Implementation

static Future<bool> isModelInstalled(ModelSpec spec) async {
  try {
    final prefs = await _prefs;

    // Check if ALL files of this spec are in the appropriate lists
    for (final file in spec.files) {
      final isFileInstalled = _isFileInLists(prefs, file);
      if (!isFileInstalled) {
        return false;
      }
    }

    return true;
  } catch (e) {
    debugPrint('Failed to check if model is installed: ${spec.name}: $e');
    return false;
  }
}