allowsScreen method

bool allowsScreen(
  1. String? currentScreen
)

Whether this campaign may render while the host is on currentScreen.

An untargeted campaign (empty targetScreenNames) always passes. A targeted one requires an exact match, so a null current screen — the host never called setCurrentScreen, or cleared it — drops it. Mirrors Android's routeCampaign and iOS's routeByCampaignKey gate.

Implementation

bool allowsScreen(String? currentScreen) =>
    targetScreenNames.isEmpty || targetScreenNames.contains(currentScreen);