getMap method

Map getMap()

Implementation

Map getMap() {
  if (data == null || data!.length == 0) return {};
  var newData = _replaceAll({'\r'.codeUnitAt(0): 0, '\n'.codeUnitAt(0): 0});
  var lines = _split(newData, ';'.codeUnitAt(0));
  Map maps = Map();
  lines.forEach((buffer) {
    var line = getString2(buffer);
    if (line.contains("=")) {
      List<String> keyValue = line.split("=");
      if (keyValue.length >= 2) {
        if (keyValue[0].trim().replaceAll("var ", "") == 'AiCfg') {
          var value = keyValue[1].trim().replaceFirst('"', '');
          int lastIndex = value.lastIndexOf('"');
          value = value.substring(0, lastIndex);
          maps.putIfAbsent(
              keyValue[0].trim().replaceAll("var ", ""), () => value.trim());
        } else {
          maps.putIfAbsent(keyValue[0].trim().replaceAll("var ", ""),
              () => keyValue[1].trim().replaceAll('"', ""));
        }
      }
    }
  });

  return maps;
}