readJSMap method

  1. @override
VoltronMap readJSMap()
override

Implementation

@override
VoltronMap readJSMap() {
  var object = VoltronMap();
  assignId(object);
  int tag;
  var read = 0;
  while ((tag = readTag()) != SerializationTag.kEndJsMap) {
    read++;
    var key = readValue(tag: tag, location: StringLocation.mapKey).toString();
    var value = readValue(location: StringLocation.mapValue, relatedKey: key);
    if (value != undefined) {
      if (key == "null") {
        object.push("NULL", value);
      } else {
        object.push(key, value);
      }
    }
  }
  var expected = reader.getVarint();
  if (2 * read != expected) {
    throw UnsupportedError("unexpected number of entries");
  }
  return object;
}