withName method

FileSystemEntity withName(
  1. String newName
)

Returns a new File with the name part changed

File('path/to/foo.dart').withName('bar.txt'); // -> File('path/to/bar.txt')
File('path/to/foo').withName('bar') // -> File('path/to/bar')

Implementation

FileSystemEntity withName(String newName) {
  return File('$dirName${Platform.pathSeparator}$newName');
}