tryLoadSettings static method

Future<ServerpodCloudSettingsData?> tryLoadSettings({
  1. required String localStoragePath,
})

Loads Serverpod Cloud settings data from local storage.

Throws FailureException if the file cannot be read or deserialized.

Implementation

static Future<ServerpodCloudSettingsData?> tryLoadSettings({
  required final String localStoragePath,
}) async {
  try {
    return await LocalStorageManager.tryFetchAndDeserializeJsonFile(
      fileName: ResourceManagerConstants.settingsFilePath,
      localStoragePath: localStoragePath,
      fromJson: ServerpodCloudSettingsData.fromJson,
    );
  } on Exception catch (e, s) {
    throw FailureException.nested(e, s, 'Failed to load settings.');
  }
}