Annotate `Version` with `@sealed`. (dart-lang/pub_semver#49)
diff --git a/pkgs/pub_semver/CHANGELOG.md b/pkgs/pub_semver/CHANGELOG.md index 5140fe2..d53b950 100644 --- a/pkgs/pub_semver/CHANGELOG.md +++ b/pkgs/pub_semver/CHANGELOG.md
@@ -1,3 +1,7 @@ +# 2.0.1-dev +- Annotated `Version` with `@sealed` to discourage users from implementing the + interface. + # 2.0.0 - Stable null safety release.
diff --git a/pkgs/pub_semver/lib/src/version.dart b/pkgs/pub_semver/lib/src/version.dart index 552b498..73402af 100644 --- a/pkgs/pub_semver/lib/src/version.dart +++ b/pkgs/pub_semver/lib/src/version.dart
@@ -5,6 +5,7 @@ import 'dart:math' as math; import 'package:collection/collection.dart'; +import 'package:meta/meta.dart' show sealed; import 'patterns.dart'; import 'version_constraint.dart'; @@ -14,6 +15,7 @@ final _equality = const IterableEquality(); /// A parsed semantic version number. +@sealed class Version implements VersionConstraint, VersionRange { /// No released version: i.e. "0.0.0". static Version get none => Version(0, 0, 0);
diff --git a/pkgs/pub_semver/pubspec.yaml b/pkgs/pub_semver/pubspec.yaml index f628d38..fce9bb0 100644 --- a/pkgs/pub_semver/pubspec.yaml +++ b/pkgs/pub_semver/pubspec.yaml
@@ -1,5 +1,5 @@ name: pub_semver -version: 2.0.0 +version: 2.0.1-dev description: >- Versions and version constraints implementing pub's versioning policy. This is very similar to vanilla semver, with a few corner cases. @@ -10,6 +10,7 @@ dependencies: collection: ^1.15.0 + meta: ^1.3.0 dev_dependencies: test: ^1.16.0-nullsafety.1