moveFile method

void moveFile(
  1. String sourcePath,
  2. String destinationPath
)

Implementation

void moveFile(String sourcePath, String destinationPath) {
  final sourceFile = File(sourcePath);
  final destinationFile = File(destinationPath);

  // 检查源文件是否存在
  if (sourceFile.existsSync()) {
    // 移动文件
    sourceFile.renameSync(destinationPath);
    if (kDebugMode) {
      print('File moved to: $destinationPath');
    }
  } else {
    if (kDebugMode) {
      print('Source file does not exist.');
    }
  }
}