replaceFileName static method
converts /some/path/file.json to /some/path/newFile.json
Implementation
static String replaceFileName({
required String path,
required String newFileName,
required String pathSeparator,
}) {
final index = path.lastIndexOf(pathSeparator);
if (index == -1) {
return newFileName;
} else {
return path.substring(0, index + pathSeparator.length) + newFileName;
}
}