triggerIdOrNull static method

String? triggerIdOrNull(
  1. String presentationId,
  2. CEPTriggerPayload payload
)

The delivering presentation's id, so every presentation asks for its own chance. Routing passes presentationId in because the payload is only stamped at acceptance, after routing. Without one (a live test) it falls back to cepCampaignId. Null means there is none.

Implementation

static String? triggerIdOrNull(
    String presentationId, CEPTriggerPayload payload) {
  final explicit = presentationId.trim();
  if (explicit.isNotEmpty) return explicit;
  final stamped = (payload.presentationId ?? '').trim();
  if (stamped.isNotEmpty) return stamped;
  final cep = payload.cepCampaignId.trim();
  return cep.isNotEmpty ? cep : null;
}