load method

Loads configuration from file. Throws ConfigException if it does not exist or fails to parse.

Implementation

DeepLinkConfig load() {
  if (!configExists()) {
    throw ConfigException('Configuration file not found. Please run "deeplink init" first.');
  }
  try {
    final content = FileUtils.readAsString(configPath);
    final json = jsonDecode(content) as Map<String, dynamic>;
    return DeepLinkConfig.fromJson(json);
  } catch (e) {
    throw ConfigException('Failed to read or parse configuration file.', e);
  }
}