isFileValid static method

Future<bool> isFileValid(
  1. String filePath, {
  2. int minSizeBytes = _defaultMinSizeBytes,
})

Validates if a file exists and meets minimum size requirements

Implementation

static Future<bool> isFileValid(
  String filePath, {
  int minSizeBytes = _defaultMinSizeBytes,
}) async {
  try {
    final file = File(filePath);

    if (!await file.exists()) {
      return false;
    }

    // Basic size check - model files should be at least the minimum size
    final sizeInBytes = await file.length();
    if (sizeInBytes < minSizeBytes) {
      debugPrint('File $filePath too small: $sizeInBytes bytes (minimum: $minSizeBytes)');
      return false;
    }

    return true;
  } catch (e) {
    debugPrint('Error validating file $filePath: $e');
    return false;
  }
}