VersionRange? matchComparison()

in lib/src/version_constraint.dart [69:97]


    VersionRange? matchComparison() {
      var comparison = startComparison.firstMatch(text);
      if (comparison == null) return null;

      var op = comparison[0];
      text = text.substring(comparison.end);
      skipWhitespace();

      var version = matchVersion();
      if (version == null) {
        throw FormatException('Expected version number after "$op" in '
            '"$originalText", got "$text".');
      }

      switch (op) {
        case '<=':
          return VersionRange(max: version, includeMax: true);
        case '<':
          return VersionRange(
              max: version,
              includeMax: false,
              alwaysIncludeMaxPreRelease: true);
        case '>=':
          return VersionRange(min: version, includeMin: true);
        case '>':
          return VersionRange(min: version, includeMin: false);
      }
      throw FallThroughError();
    }