import 'dart:io'; import 'package:path/path.dart' as path; /// 文件工具类 class FileUtil { /// 文件是否存在 static bool fileExists(File file) { return file.existsSync(); } /// 获取文件的绝对路径 static String getFilePath(File file) { return file.path; } /// 获取文件名(带扩展名) static String getFileName(File file) { return path.basename(file.path); } /// 获取文件名(不带扩展名) static String getFileNameWithoutExt(File file) { return path.basenameWithoutExtension(file.path); } }