restorePubspec method

void restorePubspec({
  1. String? sourcePath,
  2. String? targetPath,
})

Restore pubspec.yaml from backup file

Implementation

void restorePubspec({String? sourcePath, String? targetPath}) {
  try {
    File(sourcePath ?? 'pubspec_backup.yaml')
        .renameSync(targetPath ?? 'pubspec.yaml');
  } catch (exception) {
    stderr.writeln("Couldn't restore main pubspec.yaml");
    stderr.writeln(exception);
  }
}