toggleAttribution method

void toggleAttribution({
  1. required dynamic attribution,
  2. required int start,
  3. required int end,
})

If ALL of the units between start and end, inclusive, contain the given attribution, that attribution is removed from those units. Otherwise, all of the units between start and end, inclusive, are assigned the attribution.

Implementation

void toggleAttribution({
  required dynamic attribution,
  required int start,
  required int end,
}) {
  _log.info('Toggling attribution $attribution from $start to $end');
  if (_isContinuousAttribution(attribution: attribution, start: start, end: end)) {
    removeAttribution(attributionToRemove: attribution, start: start, end: end);
  } else {
    addAttribution(newAttribution: attribution, start: start, end: end);
  }
}