opposite function Null safety

TimeComparisonResult opposite(
  1. TimeComparisonResult r
)

Returns the opposite of r.

Implementation

TimeComparisonResult opposite(TimeComparisonResult r) {
  return r == TimeComparisonResult.after
      ? TimeComparisonResult.before // before is opposite of after
      : r == TimeComparisonResult.before
          ? TimeComparisonResult.after // after is opopsite of before
          : r; // same and overlapping are identical in inverse
}