interpretDict function

Map<String, dynamic> interpretDict(
  1. dynamic dict,
  2. dynamic meta,
  3. dynamic strings
)

Implementation

Map<String, dynamic> interpretDict(dict, meta, strings) {
  Map<String, dynamic> newDict = {};
  var value;

  // Because we also want to include missing values, we start out from the meta list
  // and lookup values in the dict.
  for (var i = 0; i < meta.length; i += 1) {
    Map<String, dynamic> m = meta[i];

    if (m["type"] is List) {
      var values = [];
      values.length = m["type"].length;
      for (var j = 0; j < m["type"].length; j++) {
        value = dict[m["op"]] != null ? dict[m["op"]][j] : null;
        if (value == null) {
          value = m["value"] != null && m["value"][j] != null
              ? m["value"][j]
              : null;
        }
        if (m["type"][j] == 'SID') {
          value = getCFFString(strings, value);
        }
        values[j] = value;
      }
      newDict[m["name"]] = values;
    } else {
      value = dict[m["op"]];
      if (value == null) {
        value = m["value"] != null ? m["value"] : null;
      }

      if (m["type"] == 'SID') {
        value = getCFFString(strings, value);
      }
      newDict[m["name"]] = value;
    }
  }

  return newDict;
}