checkTargetingForList method

bool checkTargetingForList(
  1. dynamic currentValue,
  2. FSOperator opType,
  3. List listAudience
)

Implementation

bool checkTargetingForList(dynamic currentValue, FSOperator opType, List<dynamic> listAudience) {
  // Check the type list before
  bool isOkay = false;
  bool isTargetingOkayForList = true;
  for (dynamic subAudienceValue in listAudience) {
    isOkay = checkCondition(currentValue, opType, subAudienceValue);
    // For those operator, we use  --- OR ---
    if (opType == FSOperator.CONTAINS || opType == FSOperator.EQUALS) {
      if (isOkay == true) {
        return true; // Exit no need to check others
      } else {
        isTargetingOkayForList = false;
      }
      // For those operator, we use  --- AND ---
    } else if (opType == FSOperator.NOT_EQUALS || opType == FSOperator.NOT_CONTAINS) {
      if (isOkay == false) {
        return false; // Exit No need to check others
      }
    } else {
      // Return false for others operator
      isTargetingOkayForList = false;
    }
  }
  return isTargetingOkayForList;
}