fromMap static method

StringResources fromMap(
  1. Map? stringResourcesData
)

Implementation

static StringResources fromMap(Map? stringResourcesData) {
  Map<String, Map<String, String>> map = {};
  if (stringResourcesData != null) {
    final entries = stringResourcesData["languages"] as List;
    final keys = stringResourcesData["keys"] != null
        ? stringResourcesData["keys"] as List
        : [];
    final values = stringResourcesData["values"] != null
        ? stringResourcesData["values"] as List<List>
        : [];

    for (var i = 0; i < entries.length; i++) {
      Map<String, String> entriesMap = {};
      for (var j = 0; j < keys.length; j++) {
        var key = keys[j];
        var value = values[j][i] ?? "";
        entriesMap[key] = value;
      }
      map[entries[i]] = entriesMap;
    }
  }
  return StringResources(map);
}