getAttributes method

Structure getAttributes([
  1. List<String>? attributes = null
])

Implementation

Structure getAttributes([List<String>? attributes = null]) {
  var st = new Structure();

  if (attributes == null) {
    var clone = this.attributes.keys.toList();
    clone.add("managers");
    attributes = clone.toList();
  }

  for (var attr in attributes) {
    if (attr == "name")
      st["name"] = _name;
    else if (attr == "managers") {
      var mngrs = <Structure>[];

      for (var i = 0; i < _managers.length; i++) {
        var mst = new Structure();
        mst["type"] = _managers[i].runtimeType;
        mst["settings"] = _managers[i].settings;

        mngrs.add(mst);
      }

      st["managers"] = mngrs;
    } else if (attr == "parents") {
      st["parents"] = _parents.toList();
    } else if (attr == "children") {
      st["children"] = _children.toList();
    } else if (attr == "childrenCount") {
      st["childrenCount"] = _children.count;
    } else if (attr == "type") {
      st["type"] = resource.runtimeType;
    } else
      st[attr] = _attributes[attr];
  }

  return st;
}