addDataToStringFiled static method

dynamic addDataToStringFiled({
  1. required String key,
  2. required String value,
  3. required String currentString,
})

Implementation

static addDataToStringFiled({
  required String key,
  required String value,
  required String currentString,
}) {
  Map<String, String> currentObj;
  try {
    currentObj = json.decode(currentString);
  } catch (err) {
    currentObj = {};
  }
  currentObj[key] = value;
  currentString = json.encode(currentObj);

  return currentString;
}