toJson method
Converts the menu item into a JSON-serializable map.
Implementation
Map<String, dynamic> toJson() {
final map = <String, dynamic>{
'key': key.toString().split('.').last,
};
if (subItems != null && subItems!.isNotEmpty) {
map['subItems'] = subItems;
}
map['identifier'] = identifier;
map['title'] = title;
map['icon'] = icon;
map['showType'] = showType.name;
return map;
}