toMap method
Convert all the TouchBarItem data to a Map that will be used in the platform channel communication.
Implementation
@override
Map<String, dynamic> toMap() {
Map<String, dynamic> map = {
'id': id,
'type': type,
'children': children?.map((item) => item.toMap()).toList(),
'showCloseButton': showCloseButton,
'iconPosition': iconPosition.toString(),
};
if (label != null) map['label'] = label;
if (icon != null) map['icon'] = icon;
return map;
}