tryLoadSettingsSync static method

ServerpodCloudSettingsData? tryLoadSettingsSync({
  1. required String localStoragePath,
})

Synchronously loads Serverpod Cloud settings data from local storage.

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

Implementation

static ServerpodCloudSettingsData? tryLoadSettingsSync({
  required final String localStoragePath,
}) {
  try {
    final json = tryLoadRawSettingsSync(localStoragePath: localStoragePath);
    if (json == null) {
      return null;
    }
    final decoded = jsonDecode(json) as Map<String, dynamic>;
    return ServerpodCloudSettingsData.fromJson(decoded);
  } catch (_) {
    return null;
  }
}