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<File> rename(String newPath) {
final completer = Completer<File>();
void cb(Object? err) {
if (err != null) {
completer.completeError(err);
} else {
completer.complete(File(newPath));
}
}
final jsCallback = js.allowInterop(cb);
fs.rename(path, newPath, jsCallback);
return completer.future;
}