contains method

bool contains(
  1. C value
)

Returns whether value is contained in this range.

Implementation

bool contains(C value) {
  final startMatches = switch (startBound) {
    InclusiveBound(value: final start) => start.compareTo(value) <= 0,
    ExclusiveBound(value: final start) => start.compareTo(value) < 0,
    UnboundedBound() => true,
  };
  final endMatches = switch (endBound) {
    InclusiveBound(value: final end) => end.compareTo(value) >= 0,
    ExclusiveBound(value: final end) => end.compareTo(value) > 0,
    UnboundedBound() => true,
  };
  return startMatches && endMatches;
}