allowsUser method

bool allowsUser(
  1. List<String> eligibleCampaigns
)

Whether this campaign may be shown to the current user.

An untargeted campaign always passes. A targeted one must appear in eligibleCampaigns, which the backend worked out for this user — so an unidentified user, or one whose context never arrived, sees no targeted campaign at all. Showing a targeted campaign to the wrong person is worse than not showing it.

Implementation

bool allowsUser(List<String> eligibleCampaigns) =>
    !audienceGated || eligibleCampaigns.contains(campaignKey);