asMap property

Map<String, dynamic> asMap

Map representation of this object

Implementation

Map<String, dynamic> get asMap {
  Map<String, dynamic> _map = {
    "key": key,
    "label": label,
    "icon": icon == null ? null : icon!.codePoint,
    "iconColor": iconColor == null ? null : iconColor!.toString(),
    "selectedIconColor":
        selectedIconColor == null ? null : selectedIconColor!.toString(),
    "expanded": expanded,
    "parent": parent,
    "children": children.map((Node child) => child.asMap).toList(),
  };
  if (data != null) {
    _map['data'] = data as T;
  }
  //TODO: figure out a means to check for getter or method on generic to include map from generic
  return _map;
}