rename method
Renames or moves from to to; an existing to is refused.
Implementation
@override
Future<void> rename(Uri from, Uri to) async {
final source = localPathOf(from);
final destination = localPathOf(to);
if (FileSystemEntity.typeSync(destination) !=
FileSystemEntityType.notFound) {
throw FileSystemException('already exists', destination);
}
await (FileSystemEntity.isDirectorySync(source)
? Directory(source)
: File(source))
.rename(destination);
emitChange(from, TomFileChangeType.deleted);
emitChange(to, TomFileChangeType.created);
}