rename method
Renames this file system entity.
Returns a Future<FileSystemEntity>
that completes with a
FileSystemEntity
instance for the renamed file system entity.
Implementation
@override
Future<Link> rename(String newPath) {
final completer = Completer<Link>();
void cb(Object? err) {
if (err != null) {
completer.completeError(err);
} else {
completer.complete(Link(newPath));
}
}
final jsCallback = js.allowInterop(cb);
fs.rename(path, newPath, jsCallback);
return completer.future;
}