exec method

Future<File> exec(
  1. {required File file,
  2. required String newFileName}
)

ファイル名をリネームする

Implementation

Future<File> exec({required File file, required String newFileName}) async {
  try {
    final dir = file.parent;
    final newPath = '${dir.path}/$newFileName';
    final newFile = await file.rename(newPath);
    return newFile;
  } catch (e) {
    throw ServiceException(ServiceErrorType.fileRenameError,
        ServiceErrorType.fileRenameError.message);
  }
}