Skip to content

Commit

Permalink
Bump lints, require Dart 3.0 (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevmoo authored May 31, 2023
1 parent c034352 commit 3930557
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
matrix:
# Add macos-latest and/or windows-latest if relevant for this package.
os: [ubuntu-latest]
sdk: [2.17.0, dev]
sdk: [3.0.0, dev]
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
- uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.1.5-wip

- Require Dart `3.0.0`.

## 2.1.4

- Added topics to `pubspec.yaml`.
Expand Down
20 changes: 8 additions & 12 deletions lib/src/version_constraint.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ abstract class VersionConstraint {
var comparison = startComparison.firstMatch(text);
if (comparison == null) return null;

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

Expand All @@ -80,17 +80,13 @@ abstract class VersionConstraint {
'"$originalText", got "$text".');
}

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

// Try to parse the "^" operator followed by a version.
Expand Down
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: pub_semver
version: 2.1.4
version: 2.1.5-wip
description: >-
Versions and version constraints implementing pub's versioning policy. This
is very similar to vanilla semver, with a few corner cases.
Expand All @@ -9,12 +9,12 @@ topics:
- semver

environment:
sdk: '>=2.17.0 <3.0.0'
sdk: ^3.0.0

dependencies:
collection: ^1.15.0
meta: ^1.3.0

dev_dependencies:
dart_flutter_team_lints: ^0.1.0
dart_flutter_team_lints: ^1.0.0
test: ^1.16.0

0 comments on commit 3930557

Please sign in to comment.