Warn about publishing in mixed mode (#2583)
diff --git a/lib/src/pubspec.dart b/lib/src/pubspec.dart
index 8bcc3a9..b309e04 100644
--- a/lib/src/pubspec.dart
+++ b/lib/src/pubspec.dart
@@ -14,6 +14,7 @@
import 'exceptions.dart';
import 'feature.dart';
import 'io.dart';
+import 'language_version.dart';
import 'log.dart';
import 'package_name.dart';
import 'sdk.dart';
@@ -445,6 +446,17 @@
bool get isEmpty =>
name == null && version == Version.none && dependencies.isEmpty;
+ /// The language version implied by the sdk constraint.
+ ///
+ /// Given no or unbounded constraint we assume language version 1.0.
+ LanguageVersion get languageVersion {
+ final constraint = originalDartSdkConstraint;
+ if (constraint is VersionRange && constraint.min != null) {
+ return LanguageVersion.fromVersionRange(constraint);
+ }
+ return LanguageVersion(1, 0);
+ }
+
/// Loads the pubspec for a package located in [packageDir].
///
/// If [expectedName] is passed and the pubspec doesn't have a matching name