countFlags property

  1. @override
int countFlags

Implementation

@override
int get countFlags {
  var flags = 0;
  if (visitsShouldBeCounted) flags |= CountFlags.Visits;
  if (turnIndexShouldBeCounted) flags |= CountFlags.Turns;
  if (countingAtStartOnly) flags |= CountFlags.CountStartOnly;
  // If we're only storing CountStartOnly, it serves no purpose,
  // since it's dependent on the other two to be used at all.
  // (e.g. for setting the fact that *if* a gather or choice's
  // content is counted, then is should only be counter at the start)
  // So this is just an optimisation for storage.
  if (flags == CountFlags.CountStartOnly) {
    flags = 0;
  }
  return flags;
}
  1. @override
void countFlags=(int value)

Implementation

@override
set countFlags(int value) {
  if ((value & CountFlags.Visits) > 0) visitsShouldBeCounted = true;
  if ((value & CountFlags.Turns) > 0) turnIndexShouldBeCounted = true;
  if ((value & CountFlags.CountStartOnly) > 0) countingAtStartOnly = true;
}