# fromEntity method Null safety

dynamic fromEntity(

1. AppModel app,
2. InternalActionEntity entity

)
override

## Implementation

    static Future<ActionModel> fromEntity(
        AppModel app, InternalActionEntity entity) async {
      var internalAction = entity.action;
      if (entity.appID == null) {
        throw Exception('entity InternalAction.appID is null');
      }
      if (internalAction != null) {
        if (internalAction.toLowerCase() ==
            InternalActionEnum.login.toString().toLowerCase()) {
          return InternalAction(app,
              internalActionEnum: InternalActionEnum.login);
        }
        if (internalAction.toLowerCase() ==
            InternalActionEnum.logout.toString().toLowerCase()) {
          return InternalAction(app,
              internalActionEnum: InternalActionEnum.logout);
        }
        if (internalAction.toLowerCase() ==
            InternalActionEnum.goHome.toString().toLowerCase()) {
          return InternalAction(app,
              internalActionEnum: InternalActionEnum.goHome);
        }
        if (internalAction.toLowerCase() ==
            InternalActionEnum.otherApps.toString().toLowerCase()) {
          return InternalAction(app,
              internalActionEnum: InternalActionEnum.otherApps);
        }
      }
      return InternalAction(app,
          conditions: await DisplayConditionsModel.fromEntity(entity.conditions),
          internalActionEnum: InternalActionEnum.unknown);
    }