restoreFromBackup static method

Future<bool> restoreFromBackup()

Restore pubspec.yaml from backup Returns true if restore was successful

Implementation

static Future<bool> restoreFromBackup() async {
  try {
    final backupFile = File(FileConfig.backupFile);

    // Check if backup exists
    if (!backupFile.existsSync()) {
      throw Exception('No backup file found (${FileConfig.backupFile})');
    }

    // Restore by copying backup to pubspec.yaml
    await backupFile.copy(FileConfig.pubspecFile);

    return true;
  } catch (e) {
    return false;
  }
}