contains method

bool contains(
  1. Version version
)

Checks if a version is within this range.

Returns true if the version is greater than or equal to start (if provided) and less than end (if provided). Otherwise returns false.

Example:

final range = Range(start: Version(2,0,0), end: Version(3,0,0));
print(range.contains(Version(2,5,0))); // true
print(range.contains(Version(3,0,0))); // false

Implementation

bool contains(Version version) {
  final afterStart = start == null || version >= start!;
  final beforeEnd = end == null || version < end!;
  return afterStart && beforeEnd;
}