MenuItem.fromJson constructor

MenuItem.fromJson(
  1. dynamic jsonRes
)

Implementation

MenuItem.fromJson(jsonRes) {
  id = jsonRes['id'];
  menuLevel = jsonRes['menuLevel'];
  parentId = jsonRes['parentId'];
  type = jsonRes['type'];
  name = jsonRes['name'];
  typeValue = jsonRes['typeValue'];
  subMenuList = jsonRes['subMenuList'] == null ? null : [];

  List<MenuItem> datas = [];
  for (var subMenuListItem in subMenuList == null ? [] : jsonRes['subMenuList']){
    subMenuList!.add(subMenuListItem == null ? null : MenuItem.fromJson(subMenuListItem));
    if(subMenuListItem != null){
      datas.add(MenuItem.fromJson(subMenuListItem));
    }
  }

  this.addChildrenMenu(this, datas);
}