getParameter method

dynamic getParameter(
  1. String? parametersJson,
  2. String parameterKey
)

Implementation

dynamic getParameter(String? parametersJson, String parameterKey) {
if (parametersJson == null) return null;

try {
  // Decode the parameters JSON string into a Map
  final Map<String, dynamic> parameters = json.decode(parametersJson);

  // Access the dynamic parameter based on the provided key
  return parameters[parameterKey] ?? 'Not Found';
} catch (e) {
  // In case of any error (invalid JSON), return a default value
  return 'Not found';
}
}