@@ -10,6 +10,7 @@ import 'package:pub_semver/pub_semver.dart';
1010import '../dart_dev_tool.dart' ;
1111import '../utils/arg_results_utils.dart' ;
1212import '../utils/assert_no_positional_args_nor_args_after_separator.dart' ;
13+ import '../utils/dart_semver_version.dart' ;
1314import '../utils/executables.dart' as exe;
1415import '../utils/global_package_is_active_and_compatible.dart' ;
1516import '../utils/logging.dart' ;
@@ -213,15 +214,19 @@ WebdevServeExecution buildExecution(
213214 'Arguments can be passed to the build process via the --build-args '
214215 'option.' );
215216 }
217+
218+ final webdevVersion = dartSemverVersion.major == 2 ? '^2.0.0' : '^3.0.0' ;
219+
216220 if (! globalPackageIsActiveAndCompatible (
217- 'webdev' , VersionConstraint .parse ('^2.0.0' ),
221+ 'webdev' , VersionConstraint .parse (webdevVersion ),
218222 environment: environment)) {
219223 _log.severe (red.wrap (
220224 '${styleBold .wrap ('webdev serve' )} could not run for this project.\n ' )! +
221225 yellow.wrap ('You must have `webdev` globally activated:\n '
222- ' dart pub global activate webdev ^2.0.0 ' )! );
226+ ' dart pub global activate webdev ${ webdevVersion } ' )! );
223227 return WebdevServeExecution .exitEarly (ExitCode .config.code);
224228 }
229+
225230 final args = buildArgs (
226231 argResults: argResults,
227232 configuredBuildArgs: configuredBuildArgs,
0 commit comments