toMap method

  1. @override
Map<String, dynamic> toMap()
override

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,
    'iconPosition': iconPosition.toString(),
  };
  if (label != null) map['label'] = label;
  if (accessibilityLabel != null)
    map['accessibilityLabel'] = accessibilityLabel;
  if (backgroundColor != null) map['backgroundColor'] = backgroundColor;
  map['onClick'] = _onClick;
  if (icon != null) map['icon'] = icon;

  return map;
}