Map serialize(bool withChildren)

Source

Map serialize(bool withChildren) {
  var rslt = {};
  configs.forEach((key, val) {
    rslt[key] = val;
  });

  attributes.forEach((key, val) {
    rslt[key] = val;
  });

  children.forEach((key, val) {
    if (withChildren) {
      if (val is LocalNodeImpl) {
        rslt[key] = val.serialize(true);
      } else {
        rslt[key] = val.getSimpleMap();
      }
    }
  });

  return rslt;
}