FileUtils class

File utility functions for common file operations

Constructors

FileUtils()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

formatFilePathForDisplay(String filePath, {int maxLength = 50}) String
Format file path for display
generateUniqueFileName(String originalName, {String? prefix, String? suffix}) String
Generate unique file name
getDirectoryPath(String filePath) String
Get directory path from file path
getFileExtension(String filePath) String
Get file extension from file path
getFileName(String filePath) String
Get file name from file path
getFileNameWithoutExtension(String filePath) String
Get file name without extension from file path
getHumanReadableFileSize(int bytes) String
Get file size in human readable format
getMimeType(String filePath) String
Get MIME type from file extension
hasValidExtension(String filePath, List<String> allowedExtensions) bool
Check if file path has valid extension
isAbsolutePath(String path) bool
Check if path is absolute
isAudioFile(String filePath) bool
Check if file is audio
isDocumentFile(String filePath) bool
Check if file is document
isImageFile(String filePath) bool
Check if file is image
isVideoFile(String filePath) bool
Check if file is video
joinPath(List<String> segments) String
Join multiple path segments
normalizePath(String path) String
Normalize path by removing redundant separators
sanitizeFileName(String fileName) String
Sanitize file name for safe usage