move method

  1. @override
Future<void> move(
  1. String from,
  2. String to
)
override

Moves/renames from to to.

Implementation

@override
Future<void> move(String from, String to) async {
  final src = _resolve(from);
  final dst = _resolve(to);
  final type = FileSystemEntity.typeSync(src, followLinks: false);
  if (type == FileSystemEntityType.notFound) {
    throw RepoException('Path not found: $from');
  }
  File(dst).parent.createSync(recursive: true);
  if (type == FileSystemEntityType.directory) {
    Directory(src).renameSync(dst);
  } else {
    File(src).renameSync(dst);
  }
}