fromEntity method Null safety

dynamic fromEntity(
  1. AppModel app,
  2. SwitchAppEntity entity
)
override

Implementation

static Future<ActionModel> fromEntity(
    AppModel app, SwitchAppEntity entity) async {
  if (entity.appID == null) throw Exception('entity SwitchApp.appID is null');
  if (entity.toAppID == null) {
    throw Exception('entity SwitchApp.toAppID is null');
  }
  return SwitchApp(app,
      conditions: await DisplayConditionsModel.fromEntity(entity.conditions),
      toAppID: entity.toAppID!);
}