exec method

Future<void> exec(
  1. String path
)

ディレクトリを削除する

Implementation

Future<void> exec(String path) async {
  try {
    final directory = Directory(path);

    // ファイルが存在しない場合はエラー
    if (!await directory.exists()) {
      throw ServiceException(ServiceErrorType.fileDeleteError,
          ServiceErrorType.fileDeleteError.message);
    }
    await directory.delete(recursive: true);
  } catch (e) {
    throw ServiceException(ServiceErrorType.fileDeleteError,
        ServiceErrorType.fileDeleteError.message);
  }
}