# fromEntity method Null safety

dynamic fromEntity(

1. AppModel app,
2. PopupMenuEntity entity

)
override

## Implementation

    static Future<ActionModel> fromEntity(
        AppModel app, PopupMenuEntity entity) async {
      MenuDefModel? menuDefModel;
      if (entity.menuDefID != null) {
        try {
          await menuDefRepository(appId: entity.appID)!
              .get(entity.menuDefID)
              .then((val) {
            menuDefModel = val;
          }).catchError((error) {});
        } catch (_) {}
      }

      if (entity.appID == null) throw Exception('entity PopupMenu.appID is null');

      return PopupMenu(app,
          conditions: await DisplayConditionsModel.fromEntity(entity.conditions),
          menuDef: menuDefModel);
    }