exists static method

Future<bool> exists({
  1. required String path,
})

检查文件是否存在

path 文件路径 返回文件是否存在

Implementation

static Future<bool> exists({required String path}) async {
  if (path.isEmpty || kIsWeb) {
    return false;
  }

  try {
    return await File(path).exists();
  } catch (e) {
    developer.log('检查文件是否存在失败: $e');
    return false;
  }
}