getRemoteKey method

String getRemoteKey(
  1. String keyConstant
)

Gets a remote key value from CDN config (e.g. API keys). Returns empty string if missing or not initialized.

Implementation

String getRemoteKey(String keyConstant) {
  _ensureInitialized();
  try {
    final cachedConfig = getCDNConfig();
    if (cachedConfig?.remoteKeys?[keyConstant] != null) {
      return cachedConfig!.remoteKeys![keyConstant]!;
    }
    final defaultValue =
        (_bundledConfig['remoteKeys'] as Map<String, dynamic>?)?[keyConstant]
            as String?;
    return defaultValue ?? '';
  } catch (e) {
    return (_bundledConfig['remoteKeys'] as Map<String, dynamic>?)?[keyConstant]
            as String? ??
        '';
  }
}