manager-app/lib/Models/menuSection.dart

31 lines
722 B
Dart

class MenuSection {
String name;
String type;
int menuId;
List<MenuSection> subMenu;
MenuSection({required this.name, required this.type, required this.menuId, required this.subMenu});
factory MenuSection.fromJson(Map<String, dynamic> json) {
return new MenuSection(
name: json['name'] as String,
type: json['type'] as String,
menuId: json['menuId'] as int,
subMenu: json['subMenu'] as List<MenuSection>,
);
}
Map<String, dynamic> toMap() {
return {
'name': name,
'type': type,
'menuId': menuId,
'subMenu': subMenu
};
}
@override
String toString() {
return '{name: $name, type: $type, menuId: $menuId, subMenu: $subMenu}';
}
}