tryLoadRawSettingsSync static method

String? tryLoadRawSettingsSync({
  1. required String localStoragePath,
})

Synchronously loads Serverpod Cloud settings data from local storage and returns the raw content as a string.

Returns null if the file does not exist or cannot be read.

Implementation

static String? tryLoadRawSettingsSync({
  required final String localStoragePath,
}) {
  try {
    final file = File(
      p.join(localStoragePath, ResourceManagerConstants.settingsFilePath),
    );
    if (!file.existsSync()) {
      return null;
    }
    final json = file.readAsStringSync();
    return json;
  } catch (_) {
    return null;
  }
}