fromMap static method

EnvironmentData fromMap(
  1. Map? environmentData
)

Implementation

static EnvironmentData fromMap(Map? environmentData) {
  Map<String, Map<String, String>> map = {};
  if (environmentData != null) {
    final environments = environmentData["environments"] as List;
    final keys = environmentData["keys"] != null
        ? environmentData["keys"] as List
        : [];
    final values = environmentData["values"] != null
        ? environmentData["values"] as List<List>
        : [];

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