fromMap method Null safety

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 = ActionModelRegistry.registry()!.getMapper(actionType);
    if (mapper != null) {
      var fromSnap = ActionModelRegistry.registry()!
          .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");
  }
}