makeFilenameUniqueSync method
Synchronously changes only the name of this file to a new unique name that does not already exist in parent.
-
See MyUtilityExtensionDirectoryGetUniqueFilename.getUniqueFilename for creating uniquely named files.
-
See changeFilename to asynchronously change the name of a file.
-
See makeFilenameUnique.
Implementation
File makeFilenameUniqueSync({
lib_path.Context? pathContext,
}) {
pathContext ??= lib_path.context;
final names = get_unique_file_impl.getNamesInDirSync(
directory: parent,
pathContext: pathContext,
);
final uniqueName = get_unique_file_impl.getUniqueFilename(
namesInDir: names,
currentDir: parent,
);
return changeFilenameSync(uniqueName, pathContext: pathContext);
}