fromMap static method

ActionEntity fromMap(
  1. Map snap, {
  2. Map<String, String>? newDocumentIds,
})

Implementation

static ActionEntity fromMap(Map snap, {Map<String, String>? newDocumentIds}) {
  var actionType = snap['actionType'];
  if (actionType != null) {
    var mapper = Apis.apis().getActionModelApi().getMapper(actionType);
    if (mapper != null) {
      var fromSnap = Apis.apis()
          .getActionModelApi()
          .getMapper(actionType)!
          .fromMap(snap);
      if (fromSnap != null) {
        return fromSnap;
      } else {
        throw Exception("fromSnap is null");
      }
    } else {
      throw Exception("Mapper for $actionType is null");
    }
  } else {
    throw Exception("actionType is null");
  }
}