Version 2.14.0-363.0.dev

Merge commit '32038798c6a719d54c198c57bc82e2773b0fccf5' into 'dev'
diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json
index b225f74..faad814 100644
--- a/.dart_tool/package_config.json
+++ b/.dart_tool/package_config.json
@@ -244,7 +244,7 @@
       "name": "dds",
       "rootUri": "../pkg/dds",
       "packageUri": "lib/",
-      "languageVersion": "2.14"
+      "languageVersion": "2.12"
     },
     {
       "name": "dev_compiler",
diff --git a/DEPS b/DEPS
index bfb110f..613addf 100644
--- a/DEPS
+++ b/DEPS
@@ -139,7 +139,7 @@
   "ply_rev": "604b32590ffad5cbb82e4afef1d305512d06ae93",
   "pool_rev": "7abe634002a1ba8a0928eded086062f1307ccfae",
   "process_rev": "56ece43b53b64c63ae51ec184b76bd5360c28d0b",
-  "protobuf_rev": "0d03fd588df69e9863e2a2efc0059dee8f18d5b2",
+  "protobuf_rev": "c1eb6cb51af39ccbaa1a8e19349546586a5c8e31",
   "pub_rev": "70b1a4f9229a36bac6340ec7eae2b2068baac96c",
   "pub_semver_rev": "f50d80ef10c4b2fa5f4c8878036a4d9342c0cc82",
   "resource_rev": "6b79867d0becf5395e5819a75720963b8298e9a7",
diff --git a/pkg/_fe_analyzer_shared/lib/src/messages/codes.dart b/pkg/_fe_analyzer_shared/lib/src/messages/codes.dart
index 7299a94..ca0f816 100644
--- a/pkg/_fe_analyzer_shared/lib/src/messages/codes.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/messages/codes.dart
@@ -279,7 +279,7 @@
       this.severity, this.uri, this.involvedFiles, this.codeName);
 
   factory DiagnosticMessageFromJson.fromJson(String jsonString) {
-    Map<String, Object> decoded = json.decode(jsonString);
+    Map<String, Object?> decoded = json.decode(jsonString);
     List<String> ansiFormatted =
         new List<String>.from(_asListOfString(decoded["ansiFormatted"]));
     List<String> plainTextFormatted =
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
index 293559f..e6b028b 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -55,7 +55,6 @@
 import 'package:analyzer_plugin/src/utilities/navigation/navigation.dart';
 import 'package:analyzer_plugin/utilities/navigation/navigation_dart.dart';
 import 'package:http/http.dart' as http;
-import 'package:process/process.dart';
 import 'package:telemetry/crash_reporting.dart';
 import 'package:telemetry/telemetry.dart' as telemetry;
 import 'package:watcher/watcher.dart';
@@ -131,7 +130,6 @@
     CrashReportingAttachmentsBuilder crashReportingAttachmentsBuilder,
     InstrumentationService instrumentationService, {
     http.Client? httpClient,
-    ProcessManager? processManager,
     RequestStatisticsHelper? requestStatistics,
     DiagnosticServer? diagnosticServer,
     this.detachableFileSystemManager,
@@ -145,7 +143,6 @@
           baseResourceProvider,
           instrumentationService,
           httpClient,
-          processManager,
           NotificationManager(channel, baseResourceProvider.pathContext),
           requestStatistics: requestStatistics,
           enableBazelWatcher: enableBazelWatcher,
@@ -432,11 +429,9 @@
     bool isPubspec(String filePath) =>
         file_paths.isPubspecYaml(resourceProvider.pathContext, filePath);
 
-    // When pubspecs are opened, trigger pre-loading of pub package names and
-    // versions.
-    final pubspecs = files.where(isPubspec).toList();
-    if (pubspecs.isNotEmpty) {
-      pubPackageService.beginCachePreloads(pubspecs);
+    // When a pubspec is opened, trigger package name caching for completion.
+    if (!pubPackageService.isRunning && files.any(isPubspec)) {
+      pubPackageService.beginPackageNamePreload();
     }
 
     priorityFiles.clear();
@@ -693,18 +688,6 @@
   }
 
   @override
-  void pubspecChanged(String pubspecPath) {
-    analysisServer.pubPackageService.fetchPackageVersionsViaPubOutdated(
-        pubspecPath,
-        pubspecWasModified: true);
-  }
-
-  @override
-  void pubspecRemoved(String pubspecPath) {
-    analysisServer.pubPackageService.flushPackageCaches(pubspecPath);
-  }
-
-  @override
   void recordAnalysisErrors(String path, List<AnalysisError> errors) {
     filesToFlush.add(path);
     _notificationManager.recordAnalysisErrors(
diff --git a/pkg/analysis_server/lib/src/analysis_server_abstract.dart b/pkg/analysis_server/lib/src/analysis_server_abstract.dart
index c39dbe8..6a351b1 100644
--- a/pkg/analysis_server/lib/src/analysis_server_abstract.dart
+++ b/pkg/analysis_server/lib/src/analysis_server_abstract.dart
@@ -19,7 +19,6 @@
 import 'package:analysis_server/src/services/completion/dart/extension_cache.dart';
 import 'package:analysis_server/src/services/correction/namespace.dart';
 import 'package:analysis_server/src/services/pub/pub_api.dart';
-import 'package:analysis_server/src/services/pub/pub_command.dart';
 import 'package:analysis_server/src/services/pub/pub_package_service.dart';
 import 'package:analysis_server/src/services/search/element_visitors.dart';
 import 'package:analysis_server/src/services/search/search_engine.dart';
@@ -53,7 +52,6 @@
 import 'package:collection/collection.dart';
 import 'package:http/http.dart' as http;
 import 'package:meta/meta.dart';
-import 'package:process/process.dart';
 
 /// Implementations of [AbstractAnalysisServer] implement a server that listens
 /// on a [CommunicationChannel] for analysis messages and process them.
@@ -154,26 +152,14 @@
     ResourceProvider baseResourceProvider,
     this.instrumentationService,
     http.Client? httpClient,
-    ProcessManager? processManager,
     this.notificationManager, {
     this.requestStatistics,
     bool enableBazelWatcher = false,
   })  : resourceProvider = OverlayResourceProvider(baseResourceProvider),
         pubApi = PubApi(instrumentationService, httpClient,
             Platform.environment['PUB_HOSTED_URL']) {
-    // We can only use a LocalProcessManager to run pub commands when backed by
-    // a real file system, otherwise we may try to run commands in folders that
-    // don't really exist. If processManager was supplied, it's likely a mock
-    // from a test in which case the pub command should still be created.
-    if (baseResourceProvider is PhysicalResourceProvider) {
-      processManager ??= LocalProcessManager();
-    }
-    final pubCommand = processManager != null
-        ? PubCommand(instrumentationService, processManager)
-        : null;
-
-    pubPackageService = PubPackageService(
-        instrumentationService, baseResourceProvider, pubApi, pubCommand);
+    pubPackageService =
+        PubPackageService(instrumentationService, baseResourceProvider, pubApi);
     performance = performanceDuringStartup;
 
     pluginManager = PluginManager(
diff --git a/pkg/analysis_server/lib/src/context_manager.dart b/pkg/analysis_server/lib/src/context_manager.dart
index 28509f0..721f37c 100644
--- a/pkg/analysis_server/lib/src/context_manager.dart
+++ b/pkg/analysis_server/lib/src/context_manager.dart
@@ -122,12 +122,6 @@
   /// TODO(scheglov) Just pass results in here?
   void listenAnalysisDriver(AnalysisDriver driver);
 
-  /// The `pubspec.yaml` at [path] was added/modified.
-  void pubspecChanged(String path);
-
-  /// The `pubspec.yaml` at [path] was removed.
-  void pubspecRemoved(String path);
-
   /// Record error information for the file with the given [path].
   void recordAnalysisErrors(String path, List<protocol.AnalysisError> errors);
 }
@@ -572,21 +566,12 @@
 
     _instrumentationService.logWatchEvent('<unknown>', path, type.toString());
 
-    final isPubpsec = file_paths.isPubspecYaml(pathContext, path);
     if (file_paths.isAnalysisOptionsYaml(pathContext, path) ||
         file_paths.isDotPackages(pathContext, path) ||
         file_paths.isPackageConfigJson(pathContext, path) ||
-        isPubpsec ||
+        file_paths.isPubspecYaml(pathContext, path) ||
         false) {
       _createAnalysisContexts();
-
-      if (isPubpsec) {
-        if (type == ChangeType.REMOVE) {
-          callbacks.pubspecRemoved(path);
-        } else {
-          callbacks.pubspecChanged(path);
-        }
-      }
       return;
     }
 
@@ -742,12 +727,6 @@
   void listenAnalysisDriver(AnalysisDriver driver) {}
 
   @override
-  void pubspecChanged(String pubspecPath) {}
-
-  @override
-  void pubspecRemoved(String pubspecPath) {}
-
-  @override
   void recordAnalysisErrors(String path, List<protocol.AnalysisError> errors) {}
 }
 
diff --git a/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart b/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
index 7194102..cac5665 100644
--- a/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
+++ b/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
@@ -52,7 +52,6 @@
 import 'package:collection/collection.dart';
 import 'package:http/http.dart' as http;
 import 'package:meta/meta.dart';
-import 'package:process/process.dart';
 import 'package:watcher/watcher.dart';
 
 /// Instances of the class [LspAnalysisServer] implement an LSP-based server
@@ -127,7 +126,6 @@
     CrashReportingAttachmentsBuilder crashReportingAttachmentsBuilder,
     InstrumentationService instrumentationService, {
     http.Client? httpClient,
-    ProcessManager? processManager,
     DiagnosticServer? diagnosticServer,
     // Disable to avoid using this in unit tests.
     bool enableBazelWatcher = false,
@@ -139,7 +137,6 @@
           baseResourceProvider,
           instrumentationService,
           httpClient,
-          processManager,
           LspNotificationManager(channel, baseResourceProvider.pathContext),
           enableBazelWatcher: enableBazelWatcher,
         ) {
@@ -187,10 +184,10 @@
       RefactoringWorkspace(driverMap.values, searchEngine);
 
   void addPriorityFile(String filePath) {
-    // When pubspecs are opened, trigger pre-loading of pub package names and
-    // versions.
-    if (file_paths.isPubspecYaml(resourceProvider.pathContext, filePath)) {
-      pubPackageService.beginCachePreloads([filePath]);
+    // When a pubspec is opened, trigger package name caching for completion.
+    if (!pubPackageService.isRunning &&
+        file_paths.isPubspecYaml(resourceProvider.pathContext, filePath)) {
+      pubPackageService.beginPackageNamePreload();
     }
 
     final didAdd = priorityFiles.add(filePath);
@@ -855,18 +852,6 @@
   }
 
   @override
-  void pubspecChanged(String pubspecPath) {
-    analysisServer.pubPackageService.fetchPackageVersionsViaPubOutdated(
-        pubspecPath,
-        pubspecWasModified: true);
-  }
-
-  @override
-  void pubspecRemoved(String pubspecPath) {
-    analysisServer.pubPackageService.flushPackageCaches(pubspecPath);
-  }
-
-  @override
   void recordAnalysisErrors(String path, List<protocol.AnalysisError> errors) {
     final errorsToSend = errors.where(_shouldSendError).toList();
     filesToFlush.add(path);
diff --git a/pkg/analysis_server/lib/src/lsp/mapping.dart b/pkg/analysis_server/lib/src/lsp/mapping.dart
index 5f54403..429920f 100644
--- a/pkg/analysis_server/lib/src/lsp/mapping.dart
+++ b/pkg/analysis_server/lib/src/lsp/mapping.dart
@@ -49,15 +49,6 @@
   ],
 };
 
-/// Pattern for docComplete text on completion items that can be upgraded to
-/// the "detail" field so that it can be shown more prominently by clients.
-///
-/// This is typically used for labels like _latest compatible_ and _latest_ in
-/// the pubspec version items. These go into docComplete so that they appear
-/// reasonably for non-LSP clients where there is no equivalent of the detail
-/// field.
-final _upgradableDocCompletePattern = RegExp(r'^_([\w ]{0,20})_$');
-
 lsp.Either2<String, lsp.MarkupContent> asStringOrMarkupContent(
     Set<lsp.MarkupKind>? preferredFormats, String content) {
   return preferredFormats == null
@@ -965,21 +956,7 @@
   final insertText = insertTextInfo.first;
   final insertTextFormat = insertTextInfo.last;
   final isMultilineCompletion = insertText.contains('\n');
-
-  var cleanedDoc = cleanDartdoc(suggestion.docComplete);
-  var detail = getCompletionDetail(suggestion, completionKind,
-      supportsCompletionDeprecatedFlag || supportsDeprecatedTag);
-
-  // To improve the display of some items (like pubspec version numbers),
-  // short labels in the format `_foo_` in docComplete are "upgraded" to the
-  // detail field.
-  final labelMatch = cleanedDoc != null
-      ? _upgradableDocCompletePattern.firstMatch(cleanedDoc)
-      : null;
-  if (labelMatch != null) {
-    cleanedDoc = null;
-    detail = labelMatch.group(1);
-  }
+  final cleanedDoc = cleanDartdoc(suggestion.docComplete);
 
   // Because we potentially send thousands of these items, we should minimise
   // the generated JSON as much as possible - for example using nulls in place
@@ -994,7 +971,8 @@
     commitCharacters:
         includeCommitCharacters ? dartCompletionCommitCharacters : null,
     data: resolutionData,
-    detail: detail,
+    detail: getCompletionDetail(suggestion, completionKind,
+        supportsCompletionDeprecatedFlag || supportsDeprecatedTag),
     documentation: cleanedDoc != null
         ? asStringOrMarkupContent(formats, cleanedDoc)
         : null,
diff --git a/pkg/analysis_server/lib/src/services/completion/yaml/producer.dart b/pkg/analysis_server/lib/src/services/completion/yaml/producer.dart
index 5d7f681..960346f 100644
--- a/pkg/analysis_server/lib/src/services/completion/yaml/producer.dart
+++ b/pkg/analysis_server/lib/src/services/completion/yaml/producer.dart
@@ -176,11 +176,9 @@
   const Producer();
 
   /// A utility method used to create a suggestion for the [identifier].
-  CompletionSuggestion identifier(String identifier,
-          {int relevance = 1000, String? docComplete}) =>
+  CompletionSuggestion identifier(String identifier, {int relevance = 1000}) =>
       CompletionSuggestion(CompletionSuggestionKind.IDENTIFIER, relevance,
-          identifier, identifier.length, 0, false, false,
-          docComplete: docComplete);
+          identifier, identifier.length, 0, false, false);
 
   /// A utility method used to create a suggestion for the package [packageName].
   CompletionSuggestion packageName(String packageName,
diff --git a/pkg/analysis_server/lib/src/services/completion/yaml/pubspec_generator.dart b/pkg/analysis_server/lib/src/services/completion/yaml/pubspec_generator.dart
index a34d791..724bb6f 100644
--- a/pkg/analysis_server/lib/src/services/completion/yaml/pubspec_generator.dart
+++ b/pkg/analysis_server/lib/src/services/completion/yaml/pubspec_generator.dart
@@ -37,25 +37,18 @@
   @override
   Iterable<CompletionSuggestion> suggestions(
       YamlCompletionRequest request) sync* {
-    final versions = request.pubPackageService
-        ?.cachedPubOutdatedVersions(request.filePath, package);
-    final resolvable = versions?.resolvableVersion;
-    var latest = versions?.latestVersion;
-
-    // If we didn't get a latest version from the "pub outdated" results, we can
-    // use the result from the Pub API if we've called it (this will usually
-    // only be the case for LSP where a resolve() call was sent).
+    // TOOD(dantup): Consider supporting async completion requests so this
+    // could call packageDetails() (with a short timeout, and pub retries
+    // disabled). A user that explicitly invokes completion in the location
+    // of a version may be prepared to wait a short period for a web request
+    // to get completion versions (this is also the only way for non-LSP
+    // clients to get them, since there are no resolve calls).
     //
-    // This allows us (in some cases) to still show version numbers even if the
-    // package was newly added to pubspec and not saved, so not yet in the
-    // "pub outdated" results.
-    latest ??= request.pubPackageService?.cachedPubApiLatestVersion(package);
-
-    if (resolvable != null && resolvable != latest) {
-      yield identifier('^$resolvable', docComplete: '_latest compatible_');
-    }
-    if (latest != null) {
-      yield identifier('^$latest', docComplete: '_latest_');
+    // Supporting this will require making the completion async further up.
+    final details = request.pubPackageService?.cachedPackageDetails(package);
+    final version = details?.latestVersion;
+    if (version != null) {
+      yield identifier('^$version');
     }
   }
 }
diff --git a/pkg/analysis_server/lib/src/services/pub/pub_command.dart b/pkg/analysis_server/lib/src/services/pub/pub_command.dart
deleted file mode 100644
index 0125066..0000000
--- a/pkg/analysis_server/lib/src/services/pub/pub_command.dart
+++ /dev/null
@@ -1,149 +0,0 @@
-// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:async';
-import 'dart:convert';
-import 'dart:io';
-
-import 'package:analyzer/instrumentation/service.dart';
-import 'package:path/path.dart' as path;
-import 'package:process/process.dart';
-
-/// A class for interacting with the `pub` command.
-///
-/// `pub` commands will be queued and not run concurrently.
-class PubCommand {
-  static const String _pubEnvironmentKey = 'PUB_ENVIRONMENT';
-  final InstrumentationService _instrumentationService;
-  late final ProcessManager _processManager;
-  late final String _pubPath;
-  late final String _pubEnvironmentValue;
-
-  /// Tracks the last queued command to avoid overlapping because pub does not
-  /// do its own locking when accessing the cache.
-  ///
-  /// https://github.com/dart-lang/pub/issues/1178
-  ///
-  /// This does not prevent running concurrently with commands spawned by other
-  /// tools (such as the IDE).
-  var _lastQueuedCommand = Future<void>.value();
-
-  PubCommand(this._instrumentationService, this._processManager) {
-    _pubPath = path.join(
-      path.dirname(Platform.resolvedExecutable),
-      Platform.isWindows ? 'pub.bat' : 'pub',
-    );
-
-    // When calling the `pub` command, we must add an identifier to the
-    // PUB_ENVIRONMENT environment variable (joined with colons).
-    const _pubEnvString = 'analysis_server.pub_api';
-    final existingPubEnv = Platform.environment[_pubEnvironmentKey];
-    _pubEnvironmentValue = [
-      if (existingPubEnv?.isNotEmpty ?? false) existingPubEnv,
-      _pubEnvString,
-    ].join(':');
-  }
-
-  /// Runs `pub outdated --show-all` and returns the results.
-  ///
-  /// If any error occurs executing the command, returns an empty list.
-  Future<List<PubOutdatedPackageDetails>> outdatedVersions(
-      String pubspecPath) async {
-    final packageDirectory = path.dirname(pubspecPath);
-    final result = await _runPubJsonCommand(
-        ['outdated', '--show-all', '--json'],
-        workingDirectory: packageDirectory);
-
-    if (result == null) {
-      return [];
-    }
-
-    final packages =
-        (result['packages'] as List<dynamic>?)?.cast<Map<String, Object?>>();
-    if (packages == null) {
-      return [];
-    }
-
-    return packages
-        .map(
-          (json) => PubOutdatedPackageDetails(
-            json['package'] as String,
-            currentVersion: _version(json, 'current'),
-            latestVersion: _version(json, 'latest'),
-            resolvableVersion: _version(json, 'resolvable'),
-            upgradableVersion: _version(json, 'upgradable'),
-          ),
-        )
-        .toList();
-  }
-
-  /// Runs a pub command and decodes JSON from `stdout`.
-  ///
-  /// Returns null if:
-  ///   - exit code is non-zero
-  ///   - returned text cannot be decoded as JSON
-  Future<Map<String, Object?>?> _runPubJsonCommand(List<String> args,
-      {required String workingDirectory}) async {
-    // Atomically replace the lastQueuedCommand future with our own to ensure
-    // only one command waits on any previous commands future.
-    final completer = Completer<void>();
-    final lastCommand = _lastQueuedCommand;
-    _lastQueuedCommand = completer.future;
-    // And wait for that previous command to finish.
-    await lastCommand.catchError((_) {});
-
-    try {
-      final command = [_pubPath, ...args];
-
-      _instrumentationService.logInfo('Running pub command $command');
-      final result = await _processManager.run(command,
-          workingDirectory: workingDirectory,
-          environment: {_pubEnvironmentKey: _pubEnvironmentValue});
-
-      if (result.exitCode != 0) {
-        _instrumentationService.logError(
-            'pub command returned ${result.exitCode} exit code: ${result.stderr}.');
-        return null;
-      }
-
-      try {
-        final results = jsonDecode(result.stdout);
-        _instrumentationService.logInfo('pub command completed successfully');
-        return results;
-      } catch (e) {
-        _instrumentationService
-            .logError('pub command returned invalid JSON: $e.');
-        return null;
-      }
-    } catch (e) {
-      _instrumentationService.logError('pub command failed to run: $e.');
-      return null;
-    } finally {
-      completer.complete();
-    }
-  }
-
-  String? _version(Map<String, Object?> json, String type) {
-    final versionType = json[type] as Map<String, Object?>?;
-    final version =
-        versionType != null ? versionType['version'] as String? : null;
-    return version;
-  }
-}
-
-class PubOutdatedPackageDetails {
-  final String packageName;
-  final String? currentVersion;
-  final String? latestVersion;
-  final String? resolvableVersion;
-  final String? upgradableVersion;
-
-  PubOutdatedPackageDetails(
-    this.packageName, {
-    required this.currentVersion,
-    required this.latestVersion,
-    required this.resolvableVersion,
-    required this.upgradableVersion,
-  });
-}
diff --git a/pkg/analysis_server/lib/src/services/pub/pub_package_service.dart b/pkg/analysis_server/lib/src/services/pub/pub_package_service.dart
index 9c99865..d0990db 100644
--- a/pkg/analysis_server/lib/src/services/pub/pub_package_service.dart
+++ b/pkg/analysis_server/lib/src/services/pub/pub_package_service.dart
@@ -6,11 +6,10 @@
 import 'dart:convert';
 
 import 'package:analysis_server/src/services/pub/pub_api.dart';
-import 'package:analysis_server/src/services/pub/pub_command.dart';
 import 'package:analyzer/file_system/file_system.dart';
+import 'package:analyzer/file_system/physical_file_system.dart';
 import 'package:analyzer/instrumentation/service.dart';
 import 'package:meta/meta.dart';
-import 'package:path/path.dart' as path;
 
 /// Information about Pub packages that can be converted to/from JSON and
 /// cached to disk.
@@ -131,27 +130,16 @@
 
 /// A service for providing Pub package information.
 ///
-/// Uses a [PubApi] to communicate with the Pub API and a [PubCommand] to
-/// interact with the local `pub` command.
-///
-/// Expensive results are cached to disk using [resourceProvider].
+/// Uses a [PubApi] to communicate with Pub and caches to disk using [cacheResourceProvider].
 class PubPackageService {
   final InstrumentationService _instrumentationService;
   final PubApi _api;
-
-  /// A wrapper over the "pub" command line too.
-  ///
-  /// This can be null when not running on a real file system because it may
-  /// try to interact with folders that don't really exist.
-  final PubCommand? _command;
-
   Timer? _nextPackageNameListRequestTimer;
   Timer? _nextWriteDiskCacheTimer;
 
-  /// [ResourceProvider] used for accessing the disk for caches and checking
-  /// project types. This should generally be a [PhysicalResourceProvider]
-  /// outside of tests.
-  final ResourceProvider resourceProvider;
+  /// [ResourceProvider] used for caching. This should generally be a
+  /// [PhysicalResourceProvider] outside of tests.
+  final ResourceProvider cacheResourceProvider;
 
   /// The current cache of package information. Initially `null`, but
   /// overwritten after first read of cache from disk or fetch from the API.
@@ -160,50 +148,25 @@
 
   int _packageDetailsRequestsInFlight = 0;
 
-  /// A cache of version numbers from running the "pub outdated" command used
-  /// for completion in pubspec.yaml.
-  final _pubspecPackageVersions =
-      <String, Map<String, PubOutdatedPackageDetails>>{};
+  PubPackageService(
+      this._instrumentationService, this.cacheResourceProvider, this._api);
 
-  PubPackageService(this._instrumentationService, this.resourceProvider,
-      this._api, this._command);
-
-  /// Gets the last set of package results from the Pub API or an empty List if
-  /// no results.
-  ///
-  /// This data is used for completion of package names in pubspec.yaml
-  /// and for clients that support lazy resolution of completion items may also
-  /// include their descriptions and/or version numbers.
+  /// Gets the last set of package results or an empty List if no results.
   List<PubPackage> get cachedPackages =>
       packageCache?.packages.values.toList() ?? [];
 
-  @visibleForTesting
-  bool get isPackageNamesTimerRunning =>
-      _nextPackageNameListRequestTimer != null;
+  bool get isRunning => _nextPackageNameListRequestTimer != null;
 
   @visibleForTesting
   File get packageCacheFile {
-    final cacheFolder = resourceProvider
+    final cacheFolder = cacheResourceProvider
         .getStateLocation('.pub-package-details-cache')!
       ..create();
     return cacheFolder.getChildAssumingFile('packages.json');
   }
 
-  /// Begins preloading caches for package names and pub versions.
-  void beginCachePreloads(List<String> pubspecs) {
-    beginPackageNamePreload();
-    for (final pubspec in pubspecs) {
-      fetchPackageVersionsViaPubOutdated(pubspec, pubspecWasModified: false);
-    }
-  }
-
-  /// Begin a timer to pre-load and update the package name list if one has not
-  /// already been started.
+  /// Begin a request to pre-load the package name list.
   void beginPackageNamePreload() {
-    if (isPackageNamesTimerRunning) {
-      return;
-    }
-
     // If first time, try to read from disk.
     var cache = packageCache;
     if (cache == null) {
@@ -216,69 +179,11 @@
         Timer(cache.cacheTimeRemaining, _fetchFromServer);
   }
 
-  /// Gets the latest cached package version fetched from the Pub API for the
-  /// package [packageName].
-  String? cachedPubApiLatestVersion(String packageName) =>
-      packageCache?.packages[packageName]?.latestVersion;
-
-  /// Gets the package versions cached using "pub outdated" for the package
-  /// [packageName] for the project using [pubspecPath].
+  /// Gets the cached package details for package [packageName].
   ///
-  /// Versions in here might only be available for packages that are in the
-  /// pubspec on disk. Newly-added packages in the overlay might not be
-  /// available.
-  PubOutdatedPackageDetails? cachedPubOutdatedVersions(
-      String pubspecPath, String packageName) {
-    final pubspecCache = _pubspecPackageVersions[pubspecPath];
-    return pubspecCache != null ? pubspecCache[packageName] : null;
-  }
-
-  /// Begin a request to pre-load package versions using the "pub outdated"
-  /// command.
-  ///
-  /// If [pubspecWasModified] is true, the command will always be run. Otherwise it
-  /// will only be run if data is not already cached.
-  Future<void> fetchPackageVersionsViaPubOutdated(String pubspecPath,
-      {required bool pubspecWasModified}) async {
-    final pubCommand = _command;
-    if (pubCommand == null) {
-      return;
-    }
-
-    // If we already have a cache for the file and it was not modified (only
-    // opened) we do not need to re-run the command.
-    if (!pubspecWasModified &&
-        _pubspecPackageVersions.containsKey(pubspecPath)) {
-      return;
-    }
-
-    // Check if this pubspec is inside a DEPS-managed folder, and if so
-    // just cache an empty set of results since Pub is not managing
-    // dependencies.
-    if (_hasAncestorDEPSFile(pubspecPath)) {
-      _pubspecPackageVersions.putIfAbsent(pubspecPath, () => {});
-      return;
-    }
-
-    final results = await pubCommand.outdatedVersions(pubspecPath);
-    final cache = _pubspecPackageVersions.putIfAbsent(pubspecPath, () => {});
-    for (final package in results) {
-      // We use the versions from the "pub outdated" results but only cache them
-      // in-memory for this specific pubspec, as the resolved version may be
-      // restricted by constraints/dependencies in the pubspec. The "pub"
-      // command does caching of the JSON versions to make "pub outdated" fast.
-      cache[package.packageName] = package;
-    }
-  }
-
-  /// Clears package caches for [pubspecPath].
-  ///
-  /// Does not remove other caches that are not pubspec-specific (for example
-  /// the latest version pulled directly from the Pub API independant of
-  /// pubspec).
-  Future<void> flushPackageCaches(String pubspecPath) async {
-    _pubspecPackageVersions.remove(pubspecPath);
-  }
+  /// Returns null if no package details are cached.
+  PubPackage? cachedPackageDetails(String packageName) =>
+      packageCache?.packages[packageName];
 
   /// Gets package details for package [packageName].
   ///
@@ -362,19 +267,6 @@
     }
   }
 
-  /// Checks whether there is a DEPS file in any folder walking up from the
-  /// pubspec at [pubspecPath].
-  bool _hasAncestorDEPSFile(String pubspecPath) {
-    var folder = path.dirname(pubspecPath);
-    do {
-      if (resourceProvider.getFile(path.join(folder, 'DEPS')).exists) {
-        return true;
-      }
-      folder = path.dirname(folder);
-    } while (folder != path.dirname(folder));
-    return false;
-  }
-
   /// Writes the package cache to disk after
   /// [PackageDetailsCache._writeCacheDebounceDuration] has elapsed, restarting
   /// the timer each time this method is called.
diff --git a/pkg/analysis_server/pubspec.yaml b/pkg/analysis_server/pubspec.yaml
index 1c8f241..5629eb1 100644
--- a/pkg/analysis_server/pubspec.yaml
+++ b/pkg/analysis_server/pubspec.yaml
@@ -24,8 +24,6 @@
   linter: any
   meta:
     path: ../meta
-  process:
-    path: ../../third_party/pkg/process
   stream_channel: any
   telemetry:
     path: ../telemetry
diff --git a/pkg/analysis_server/test/lsp/completion.dart b/pkg/analysis_server/test/lsp/completion.dart
index 6d70a26..75c85b1 100644
--- a/pkg/analysis_server/test/lsp/completion.dart
+++ b/pkg/analysis_server/test/lsp/completion.dart
@@ -8,9 +8,6 @@
 import 'server_abstract.dart';
 
 mixin CompletionTestMixin on AbstractLspAnalysisServerTest {
-  /// The last set of completion results fetched.
-  List<CompletionItem> completionResults = [];
-
   int sortTextSorter(CompletionItem item1, CompletionItem item2) =>
       (item1.sortText ?? item1.label).compareTo(item2.sortText ?? item2.label);
 
@@ -43,24 +40,23 @@
     if (openCloseFile) {
       await openFile(fileUri, withoutMarkers(content));
     }
-    completionResults =
-        await getCompletion(fileUri, positionFromMarker(content));
+    final res = await getCompletion(fileUri, positionFromMarker(content));
     if (openCloseFile) {
       await closeFile(fileUri);
     }
 
     // Sort the completions by sortText and filter to those we expect, so the ordering
     // can be compared.
-    final sortedResults = completionResults
+    final sortedResults = res
         .where((r) => expectCompletions.contains(r.label))
         .toList()
-      ..sort(sortTextSorter);
+          ..sort(sortTextSorter);
 
     expect(sortedResults.map((item) => item.label), equals(expectCompletions));
 
     // Check the edits apply correctly.
     if (applyEditsFor != null) {
-      var item = completionResults.singleWhere((c) => c.label == applyEditsFor);
+      var item = res.singleWhere((c) => c.label == applyEditsFor);
       final insertFormat = item.insertTextFormat;
 
       if (resolve) {
diff --git a/pkg/analysis_server/test/lsp/completion_yaml_test.dart b/pkg/analysis_server/test/lsp/completion_yaml_test.dart
index b8a9c9a..9d26755 100644
--- a/pkg/analysis_server/test/lsp/completion_yaml_test.dart
+++ b/pkg/analysis_server/test/lsp/completion_yaml_test.dart
@@ -2,8 +2,6 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-import 'dart:io';
-
 import 'package:analysis_server/src/services/pub/pub_api.dart';
 import 'package:http/http.dart';
 import 'package:linter/src/rules.dart';
@@ -369,7 +367,7 @@
     );
   }
 
-  Future<void> test_package_versions_fromApi() async {
+  Future<void> test_package_version() async {
     httpClient.sendHandler = (BaseRequest request) async {
       if (request.url.path.startsWith(PubApi.packageNameListPath)) {
         return Response(samplePackageList, 200);
@@ -420,163 +418,6 @@
     );
   }
 
-  Future<void> test_package_versions_fromPubOutdated() async {
-    final json = r'''
-    {
-      "packages": [
-        {
-          "package":    "one",
-          "latest":     { "version": "3.2.1" },
-          "resolvable": { "version": "1.2.4" }
-        }
-      ]
-    }
-    ''';
-    processManager.runHandler =
-        (command, {dir, env}) => ProcessResult(1, 0, json, '');
-
-    final content = '''
-name: foo
-version: 1.0.0
-
-dependencies:
-  one: ^''';
-
-    final expected = '''
-name: foo
-version: 1.0.0
-
-dependencies:
-  one: ^1.2.4''';
-
-    await initialize();
-    await openFile(pubspecFileUri, withoutMarkers(content));
-    await pumpEventQueue(times: 500);
-
-    await verifyCompletions(
-      pubspecFileUri,
-      content,
-      expectCompletions: ['^1.2.4', '^3.2.1'],
-      applyEditsFor: '^1.2.4',
-      expectedContent: expected,
-      openCloseFile: false,
-    );
-  }
-
-  Future<void> test_package_versions_fromPubOutdated_afterChange() async {
-    final initialJson = r'''
-    {
-      "packages": [
-        {
-          "package":    "one",
-          "latest":     { "version": "3.2.1" },
-          "resolvable": { "version": "1.2.3" }
-        }
-      ]
-    }
-    ''';
-    final updatedJson = r'''
-    {
-      "packages": [
-        {
-          "package":    "one",
-          "latest":     { "version": "2.1.0" },
-          "resolvable": { "version": "2.3.4" }
-        }
-      ]
-    }
-    ''';
-    processManager.runHandler =
-        (command, {dir, env}) => ProcessResult(1, 0, initialJson, '');
-
-    final content = '''
-name: foo
-version: 1.0.0
-
-dependencies:
-  one: ^''';
-
-    final expected = '''
-name: foo
-version: 1.0.0
-
-dependencies:
-  one: ^2.3.4''';
-
-    newFile(pubspecFilePath, content: content);
-    await initialize();
-    await openFile(pubspecFileUri, withoutMarkers(content));
-    await pumpEventQueue(times: 500);
-
-    // Modify the underlying file which should trigger an update of the
-    // cached data.
-    processManager.runHandler =
-        (command, {dir, env}) => ProcessResult(1, 0, updatedJson, '');
-    modifyFile(pubspecFilePath, '$content# trailing comment');
-    await pumpEventQueue(times: 500);
-
-    await verifyCompletions(
-      pubspecFileUri,
-      content,
-      expectCompletions: ['^2.3.4', '^2.1.0'],
-      applyEditsFor: '^2.3.4',
-      expectedContent: expected,
-      openCloseFile: false,
-    );
-
-    // Also veryify the detail fields were populated as expected.
-    expect(
-      completionResults.singleWhere((c) => c.label == '^2.3.4').detail,
-      equals('latest compatible'),
-    );
-    expect(
-      completionResults.singleWhere((c) => c.label == '^2.1.0').detail,
-      equals('latest'),
-    );
-  }
-
-  Future<void> test_package_versions_fromPubOutdated_afterDelete() async {
-    final initialJson = r'''
-    {
-      "packages": [
-        {
-          "package":    "one",
-          "latest":     { "version": "3.2.1" },
-          "resolvable": { "version": "1.2.3" }
-        }
-      ]
-    }
-    ''';
-    processManager.runHandler =
-        (command, {dir, env}) => ProcessResult(1, 0, initialJson, '');
-
-    final content = '''
-name: foo
-version: 1.0.0
-
-dependencies:
-  one: ^''';
-
-    newFile(pubspecFilePath, content: content);
-    await initialize();
-    await openFile(pubspecFileUri, withoutMarkers(content));
-    await pumpEventQueue(times: 500);
-
-    // Delete the underlying file which should trigger eviction of the cache.
-    deleteFile(pubspecFilePath);
-    await pumpEventQueue(times: 500);
-
-    await verifyCompletions(
-      pubspecFileUri,
-      content,
-      expectCompletions: [],
-      openCloseFile: false,
-    );
-
-    // There should have been no version numbers.
-    expect(completionResults, isEmpty);
-  }
-
   Future<void> test_topLevel() async {
     final content = '''
 version: 1.0.0
diff --git a/pkg/analysis_server/test/lsp/pub_package_service_test.dart b/pkg/analysis_server/test/lsp/pub_package_service_test.dart
index 7b4095e..b00f285 100644
--- a/pkg/analysis_server/test/lsp/pub_package_service_test.dart
+++ b/pkg/analysis_server/test/lsp/pub_package_service_test.dart
@@ -2,16 +2,10 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-import 'dart:io';
-
 import 'package:analysis_server/src/services/pub/pub_api.dart';
-import 'package:analysis_server/src/services/pub/pub_command.dart';
 import 'package:analysis_server/src/services/pub/pub_package_service.dart';
 import 'package:analyzer/instrumentation/service.dart';
-import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
-import 'package:collection/collection.dart';
 import 'package:http/http.dart';
-import 'package:path/path.dart' as path;
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
 
@@ -21,7 +15,6 @@
 void main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(PubApiTest);
-    defineReflectiveTests(PubCommandTest);
     defineReflectiveTests(PubPackageServiceTest);
   });
 }
@@ -85,168 +78,6 @@
 }
 
 @reflectiveTest
-class PubCommandTest with ResourceProviderMixin {
-  late MockProcessManager processManager;
-  late PubCommand pubCommand;
-  late String pubspecPath, pubspec2Path;
-
-  void setUp() {
-    pubspecPath = convertPath('/home/project/pubspec.yaml');
-    pubspec2Path = convertPath('/home/project2/pubspec.yaml');
-    processManager = MockProcessManager();
-    pubCommand =
-        PubCommand(InstrumentationService.NULL_SERVICE, processManager);
-  }
-
-  Future<void> test_doesNotRunConcurrently() async {
-    var isRunning = false;
-    processManager.runHandler = (command, {dir, env}) async {
-      expect(isRunning, isFalse,
-          reason: 'pub commands should not run concurrently');
-      isRunning = true;
-      await pumpEventQueue(times: 500);
-      isRunning = false;
-      return ProcessResult(0, 0, '', '');
-    };
-    await Future.wait([
-      pubCommand.outdatedVersions(pubspecPath),
-      pubCommand.outdatedVersions(pubspecPath),
-    ]);
-  }
-
-  Future<void> test_outdated_args() async {
-    processManager.runHandler = (command, {dir, env}) {
-      var expectedPubPath = path.join(
-        path.dirname(Platform.resolvedExecutable),
-        Platform.isWindows ? 'pub.bat' : 'pub',
-      );
-      expect(
-          command,
-          equals([
-            expectedPubPath,
-            'outdated',
-            '--show-all',
-            '--json',
-          ]));
-      expect(dir, equals(convertPath('/home/project')));
-      expect(
-          env!['PUB_ENVIRONMENT'],
-          anyOf(equals('analysis_server.pub_api'),
-              endsWith(':analysis_server.pub_api')));
-      return ProcessResult(0, 0, '', '');
-    };
-    await pubCommand.outdatedVersions(pubspecPath);
-  }
-
-  Future<void> test_outdated_invalidJson() async {
-    processManager.runHandler = (List<String> command, {dir, env}) =>
-        ProcessResult(1, 0, 'NOT VALID JSON', '');
-    final result = await pubCommand.outdatedVersions(pubspecPath);
-    expect(result, isEmpty);
-  }
-
-  Future<void> test_outdated_missingFields() async {
-    final validJson = r'''
-    {
-      "packages": [
-        {
-          "package":    "foo",
-          "current":    { "version": "1.0.0" },
-          "upgradable": { "version": "2.0.0" },
-          "resolvable": { }
-        }
-      ]
-    }
-    ''';
-    processManager.runHandler =
-        (command, {dir, env}) => ProcessResult(1, 0, validJson, '');
-    final result = await pubCommand.outdatedVersions(pubspecPath);
-    expect(result, hasLength(1));
-    final package = result.first;
-    expect(package.packageName, equals('foo'));
-    expect(package.currentVersion, equals('1.0.0'));
-    expect(package.upgradableVersion, equals('2.0.0'));
-    expect(package.resolvableVersion, isNull);
-    expect(package.latestVersion, isNull);
-  }
-
-  Future<void> test_outdated_multiplePubspecs() async {
-    final pubspecJson1 = r'''
-    {
-      "packages": [
-        {
-          "package":    "foo",
-          "resolvable": { "version": "1.1.1" }
-        }
-      ]
-    }
-    ''';
-    final pubspecJson2 = r'''
-    {
-      "packages": [
-        {
-          "package":    "foo",
-          "resolvable": { "version": "2.2.2" }
-        }
-      ]
-    }
-    ''';
-
-    processManager.runHandler = (command, {dir, env}) {
-      // Return different json based on the directory we were invoked in.
-      final json =
-          dir == path.dirname(pubspecPath) ? pubspecJson1 : pubspecJson2;
-      return ProcessResult(1, 0, json, '');
-    };
-    final result1 = await pubCommand.outdatedVersions(pubspecPath);
-    final result2 = await pubCommand.outdatedVersions(pubspec2Path);
-    expect(result1.first.resolvableVersion, equals('1.1.1'));
-    expect(result2.first.resolvableVersion, equals('2.2.2'));
-  }
-
-  Future<void> test_outdated_nonZeroExitCode() async {
-    processManager.runHandler =
-        (command, {dir, env}) => ProcessResult(1, 123, '{}', '');
-    final result = await pubCommand.outdatedVersions(pubspecPath);
-    expect(result, isEmpty);
-  }
-
-  Future<void> test_validJson() async {
-    final validJson = r'''
-    {
-      "packages": [
-        {
-          "package":    "foo",
-          "current":    { "version": "1.0.0" },
-          "upgradable": { "version": "2.0.0" },
-          "resolvable": { "version": "3.0.0" },
-          "latest":     { "version": "4.0.0" }
-        },
-        {
-          "package":    "bar",
-          "current":    { "version": "1.0.0" },
-          "upgradable": { "version": "2.0.0" },
-          "resolvable": { "version": "3.0.0" },
-          "latest":     { "version": "4.0.0" }
-        }
-      ]
-    }
-    ''';
-    processManager.runHandler =
-        (command, {dir, env}) => ProcessResult(1, 0, validJson, '');
-    final result = await pubCommand.outdatedVersions(pubspecPath);
-    expect(result, hasLength(2));
-    result.forEachIndexed((index, package) {
-      expect(package.packageName, equals(index == 0 ? 'foo' : 'bar'));
-      expect(package.currentVersion, equals('1.0.0'));
-      expect(package.upgradableVersion, equals('2.0.0'));
-      expect(package.resolvableVersion, equals('3.0.0'));
-      expect(package.latestVersion, equals('4.0.0'));
-    });
-  }
-}
-
-@reflectiveTest
 class PubPackageServiceTest extends AbstractLspAnalysisServerTest {
   /// A sample API response for package names. This should match the JSON served
   /// at https://pub.dev/api/package-name-completion-data.
@@ -363,13 +194,13 @@
   Future<void> test_packageCache_initializesOnPubspecOpen() async {
     await initialize();
 
-    expect(server.pubPackageService.isPackageNamesTimerRunning, isFalse);
+    expect(server.pubPackageService.isRunning, isFalse);
     expect(server.pubPackageService.packageCache, isNull);
     expectPackages([]);
     await openFile(pubspecFileUri, '');
     await pumpEventQueue();
 
-    expect(server.pubPackageService.isPackageNamesTimerRunning, isTrue);
+    expect(server.pubPackageService.isRunning, isTrue);
     expect(server.pubPackageService.packageCache, isNotNull);
     expectPackages([]);
   }
diff --git a/pkg/analysis_server/test/lsp/server_abstract.dart b/pkg/analysis_server/test/lsp/server_abstract.dart
index dc23575..a7a8ea0 100644
--- a/pkg/analysis_server/test/lsp/server_abstract.dart
+++ b/pkg/analysis_server/test/lsp/server_abstract.dart
@@ -48,7 +48,6 @@
   late MockLspServerChannel channel;
   late TestPluginManager pluginManager;
   late LspAnalysisServer server;
-  late MockProcessManager processManager;
   late MockHttpClient httpClient;
 
   /// The number of context builds that had already occurred the last time
@@ -152,7 +151,6 @@
 
   void setUp() {
     httpClient = MockHttpClient();
-    processManager = MockProcessManager();
     channel = MockLspServerChannel(debugPrintCommunication);
     // Create an SDK in the mock file system.
     MockSdk(resourceProvider: resourceProvider);
@@ -164,8 +162,7 @@
         DartSdkManager(convertPath('/sdk')),
         CrashReportingAttachmentsBuilder.empty,
         InstrumentationService.NULL_SERVICE,
-        httpClient: httpClient,
-        processManager: processManager);
+        httpClient: httpClient);
     server.pluginManager = pluginManager;
 
     projectFolderPath = convertPath('/home/test');
diff --git a/pkg/analysis_server/test/mocks.dart b/pkg/analysis_server/test/mocks.dart
index 2bc45fd..d6cfa2c 100644
--- a/pkg/analysis_server/test/mocks.dart
+++ b/pkg/analysis_server/test/mocks.dart
@@ -3,14 +3,11 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:convert';
-import 'dart:io';
 
 import 'package:analysis_server/protocol/protocol.dart';
 import 'package:analysis_server/protocol/protocol_generated.dart';
 import 'package:analyzer/src/generated/source.dart';
 import 'package:http/http.dart' as http;
-import 'package:process/process.dart';
 import 'package:test/test.dart';
 
 /// A [Matcher] that check that the given [Response] has an expected identifier
@@ -50,31 +47,6 @@
   }
 }
 
-class MockProcessManager implements ProcessManager {
-  FutureOr<ProcessResult> Function(List<String> command,
-          {String? dir, Map<String, String>? env})? runHandler =
-      (command, {dir, env}) => throw UnimplementedError();
-
-  @override
-  dynamic noSuchMethod(Invocation invocation) {
-    return super.noSuchMethod(invocation);
-  }
-
-  @override
-  Future<ProcessResult> run(
-    List<dynamic> command, {
-    String? workingDirectory,
-    Map<String, String>? environment,
-    bool includeParentEnvironment = true,
-    bool runInShell = false,
-    Encoding stdoutEncoding = systemEncoding,
-    Encoding stderrEncoding = systemEncoding,
-  }) async {
-    return runHandler!(command.cast<String>(),
-        dir: workingDirectory, env: environment);
-  }
-}
-
 class MockSource implements Source {
   @override
   final String fullName;
diff --git a/pkg/analysis_server/test/src/services/completion/yaml/pubspec_generator_test.dart b/pkg/analysis_server/test/src/services/completion/yaml/pubspec_generator_test.dart
index e6ad1db..4f4923f 100644
--- a/pkg/analysis_server/test/src/services/completion/yaml/pubspec_generator_test.dart
+++ b/pkg/analysis_server/test/src/services/completion/yaml/pubspec_generator_test.dart
@@ -2,11 +2,8 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-import 'dart:io';
-
 import 'package:analysis_server/src/services/completion/yaml/pubspec_generator.dart';
 import 'package:analysis_server/src/services/pub/pub_api.dart';
-import 'package:analysis_server/src/services/pub/pub_command.dart';
 import 'package:analysis_server/src/services/pub/pub_package_service.dart';
 import 'package:analyzer/instrumentation/service.dart';
 import 'package:http/http.dart';
@@ -25,7 +22,6 @@
 @reflectiveTest
 class PubspecGeneratorTest extends YamlGeneratorTest {
   late MockHttpClient httpClient;
-  late MockProcessManager processManager;
 
   late PubPackageService pubPackageService;
 
@@ -38,12 +34,10 @@
 
   void setUp() {
     httpClient = MockHttpClient();
-    processManager = MockProcessManager();
     pubPackageService = PubPackageService(
         InstrumentationService.NULL_SERVICE,
         resourceProvider,
-        PubApi(InstrumentationService.NULL_SERVICE, httpClient, null),
-        PubCommand(InstrumentationService.NULL_SERVICE, processManager));
+        PubApi(InstrumentationService.NULL_SERVICE, httpClient, null));
   }
 
   void tearDown() {
@@ -345,46 +339,4 @@
 ''');
     assertSuggestion('two: ');
   }
-
-  void test_packageVersion() async {
-    final json = r'''
-    {
-      "packages": [
-        {
-          "package":    "one",
-          "latest":     { "version": "3.2.1" },
-          "resolvable": { "version": "1.2.4" }
-        }
-      ]
-    }
-    ''';
-    processManager.runHandler =
-        (command, {dir, env}) => ProcessResult(1, 0, json, '');
-
-    pubPackageService.beginCachePreloads([convertPath('/home/test/$fileName')]);
-    await pumpEventQueue(times: 500);
-
-    getCompletions('''
-dependencies:
-  one: ^
-''');
-    assertSuggestion('^1.2.4');
-    assertSuggestion('^3.2.1');
-  }
-
-  /// Ensure in a repo with a DEPS file like the SDK, we do not run pub
-  /// processes to cache the version numbers.
-  void test_packageVersion_withDEPSfile() async {
-    var didRun = false;
-    processManager.runHandler = (command, {dir, env}) {
-      didRun = true;
-      return ProcessResult(1, 0, '', '');
-    };
-
-    newFile('/home/DEPS');
-    pubPackageService.beginCachePreloads([convertPath('/home/test/$fileName')]);
-    await pumpEventQueue(times: 500);
-
-    expect(didRun, isFalse);
-  }
 }
diff --git a/pkg/compiler/lib/src/deferred_load.dart b/pkg/compiler/lib/src/deferred_load.dart
index f3f6bac..892e6b6 100644
--- a/pkg/compiler/lib/src/deferred_load.dart
+++ b/pkg/compiler/lib/src/deferred_load.dart
@@ -114,7 +114,7 @@
   /// Will be `true` if the program contains deferred libraries.
   bool isProgramSplit = false;
 
-  static const ImpactUseCase IMPACT_USE = const ImpactUseCase('Deferred load');
+  static const ImpactUseCase IMPACT_USE = ImpactUseCase('Deferred load');
 
   /// A cache of the result of calling `computeImportDeferName` on the keys of
   /// this map.
@@ -257,7 +257,7 @@
     // Fetch the internal node in order to skip annotations on the member.
     // TODO(sigmund): replace this pattern when the kernel-ast provides a better
     // way to skip annotations (issue 31565).
-    var visitor = new ConstantCollector(
+    var visitor = ConstantCollector(
         _elementMap, _elementMap.getStaticTypeContext(element), dependencies);
     if (node is ir.Field) {
       node.initializer?.accept(visitor);
@@ -1540,7 +1540,7 @@
   /// Returns the [OutputUnit] where [cls] belongs.
   // TODO(johnniwinther): Remove the need for [allowNull]. Dump-info currently
   // needs it.
-  OutputUnit outputUnitForClass(ClassEntity cls, {bool allowNull: false}) {
+  OutputUnit outputUnitForClass(ClassEntity cls, {bool allowNull = false}) {
     if (!isProgramSplit) return mainOutputUnit;
     OutputUnit unit = _classToUnit[cls];
     assert(allowNull || unit != null, 'No output unit for class $cls');
@@ -1551,7 +1551,7 @@
 
   /// Returns the [OutputUnit] where [cls]'s type belongs.
   // TODO(joshualitt): see above TODO regarding allowNull.
-  OutputUnit outputUnitForClassType(ClassEntity cls, {bool allowNull: false}) {
+  OutputUnit outputUnitForClassType(ClassEntity cls, {bool allowNull = false}) {
     if (!isProgramSplit) return mainOutputUnit;
     OutputUnit unit = _classTypeToUnit[cls];
     assert(allowNull || unit != null, 'No output unit for type $cls');
@@ -1665,7 +1665,7 @@
 /// The filename is of the form "<main output file>_<name>.part.js".
 /// If [addExtension] is false, the ".part.js" suffix is left out.
 String deferredPartFileName(CompilerOptions options, String name,
-    {bool addExtension: true}) {
+    {bool addExtension = true}) {
   assert(name != "");
   String outPath = options.outputUri != null ? options.outputUri.path : "out";
   String outName = outPath.substring(outPath.lastIndexOf('/') + 1);
@@ -1811,7 +1811,7 @@
 
   CommonElements get commonElements => elementMap.commonElements;
 
-  void add(ir.Expression node, {bool required: true}) {
+  void add(ir.Expression node, {bool required = true}) {
     ConstantValue constant = elementMap
         .getConstantValue(staticTypeContext, node, requireConstant: required);
     if (constant != null) {
diff --git a/pkg/dds/dds_protocol.md b/pkg/dds/dds_protocol.md
index 9224302..b690c1a 100644
--- a/pkg/dds/dds_protocol.md
+++ b/pkg/dds/dds_protocol.md
@@ -1,6 +1,6 @@
-# Dart Development Service Protocol 1.3
+# Dart Development Service Protocol 1.2
 
-This document describes _version 1.3_ of the Dart Development Service Protocol.
+This document describes _version 1.2_ of the Dart Development Service Protocol.
 This protocol is an extension of the Dart VM Service Protocol and implements it
 in it's entirety. For details on the VM Service Protocol, see the [Dart VM Service Protocol Specification][service-protocol].
 
@@ -67,29 +67,6 @@
 
 The DDS Protocol supports all [public RPCs defined in the VM Service protocol][service-protocol-public-rpcs].
 
-### getAvailableCachedCpuSamples
-
-```
-AvailableCachedCpuSamples getAvailableCachedCpuSamples();
-```
-
-The _getAvailableCachedCpuSamples_ RPC is used to determine which caches of CPU samples
-are available. Caches are associated with individual _UserTag_ names and are specified
-when DDS is started via the _cachedUserTags_ parameter.
-
-See [AvailableCachedCpuSamples](#availablecachedcpusamples).
-
-### getCachedCpuSamples
-
-```
-CachedCpuSamples getCachedCpuSamples(string isolateId, string userTag);
-```
-
-The _getCachedCpuSamples_ RPC is used to retrieve a cache of CPU samples collected
-under a _UserTag_ with name _userTag_.
-
-See [CachedCpuSamples](#cachedcpusamples).
-
 ### getClientName
 
 ```
@@ -204,37 +181,6 @@
 
 The DDS Protocol supports all [public types defined in the VM Service protocol][service-protocol-public-types].
 
-### AvailableCachedCpuSamples
-
-```
-class AvailableCachedCpuSamples extends Response {
-  // A list of UserTag names associated with CPU sample caches.
-  string[] cacheNames;
-}
-```
-
-A collection of [UserTag] names associated with caches of CPU samples.
-
-See [getAvailableCachedCpuSamples](#getavailablecachedcpusamples).
-
-### CachedCpuSamples
-
-```
-class CachedCpuSamples extends CpuSamples {
-  // The name of the UserTag associated with this cache of samples.
-  string userTag;
-
-  // Provided if the CPU sample cache has filled and older samples have been
-  // dropped.
-  bool truncated [optional];
-}
-```
-
-An extension of [CpuSamples](#cpu-samples) which represents a set of cached
-samples, associated with a particular [UserTag] name.
-
-See [getCachedCpuSamples](#getcachedcpusamples).
-
 ### ClientName
 
 ```
@@ -274,12 +220,10 @@
 1.0 | Initial revision
 1.1 | Added `getDartDevelopmentServiceVersion` RPC.
 1.2 | Added `getStreamHistory` RPC.
-1.3 | Added `getAvailableCachedCpuSamples` and `getCachedCpuSamples` RPCs.
 
 [resume]: https://github.com/dart-lang/sdk/blob/master/runtime/vm/service/service.md#resume
 [success]: https://github.com/dart-lang/sdk/blob/master/runtime/vm/service/service.md#success
 [version]: https://github.com/dart-lang/sdk/blob/master/runtime/vm/service/service.md#version
-[cpu-samples]: https://github.com/dart-lang/sdk/blob/master/runtime/vm/service/service.md#cpusamples
 
 [service-protocol]: https://github.com/dart-lang/sdk/blob/master/runtime/vm/service/service.md
 [service-protocol-rpcs-requests-and-responses]: https://github.com/dart-lang/sdk/blob/master/runtime/vm/service/service.md#rpcs-requests-and-responses
diff --git a/pkg/dds/lib/dds.dart b/pkg/dds/lib/dds.dart
index f31e447..e8f05bb 100644
--- a/pkg/dds/lib/dds.dart
+++ b/pkg/dds/lib/dds.dart
@@ -42,7 +42,6 @@
     Uri? serviceUri,
     bool enableAuthCodes = true,
     bool ipv6 = false,
-    List<String> cachedUserTags = const [],
     DevToolsConfiguration? devToolsConfiguration,
     bool logRequests = false,
   }) async {
@@ -80,7 +79,6 @@
       remoteVmServiceUri,
       serviceUri,
       enableAuthCodes,
-      cachedUserTags,
       ipv6,
       devToolsConfiguration,
       logRequests,
@@ -138,13 +136,9 @@
   /// requests.
   bool get isRunning;
 
-  /// The list of [UserTag]s used to determine which CPU samples are cached by
-  /// DDS.
-  List<String> get cachedUserTags;
-
   /// The version of the DDS protocol supported by this [DartDevelopmentService]
   /// instance.
-  static const String protocolVersion = '1.3';
+  static const String protocolVersion = '1.2';
 }
 
 class DartDevelopmentServiceException implements Exception {
diff --git a/pkg/dds/lib/src/client.dart b/pkg/dds/lib/src/client.dart
index 771ccee..1df3a3a 100644
--- a/pkg/dds/lib/src/client.dart
+++ b/pkg/dds/lib/src/client.dart
@@ -206,19 +206,6 @@
       return supportedProtocols;
     });
 
-    _clientPeer.registerMethod(
-      'getAvailableCachedCpuSamples',
-      (_) => {
-        'type': 'AvailableCachedCpuSamples',
-        'cacheNames': dds.cachedUserTags,
-      },
-    );
-
-    _clientPeer.registerMethod(
-      'getCachedCpuSamples',
-      dds.isolateManager.getCachedCpuSamples,
-    );
-
     // `evaluate` and `evaluateInFrame` actually consist of multiple RPC
     // invocations, including a call to `compileExpression` which can be
     // overridden by clients which provide their own implementation (e.g.,
diff --git a/pkg/dds/lib/src/common/ring_buffer.dart b/pkg/dds/lib/src/common/ring_buffer.dart
deleted file mode 100644
index 9ae802d..0000000
--- a/pkg/dds/lib/src/common/ring_buffer.dart
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright (c) 2021, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:math';
-
-class RingBuffer<T> {
-  RingBuffer(this._bufferSize) {
-    _buffer = List<T?>.filled(
-      _bufferSize,
-      null,
-    );
-  }
-
-  Iterable<T> call() sync* {
-    for (int i = _size - 1; i >= 0; --i) {
-      yield _buffer[(_count - i - 1) % _bufferSize]!;
-    }
-  }
-
-  /// Inserts a new element into the [RingBuffer].
-  /// 
-  /// Returns the element evicted as a result of adding the new element if the
-  /// buffer is as max capacity, null otherwise.
-  T? add(T e) {
-    if (_buffer.isEmpty) {
-      return null;
-    }
-    T? evicted;
-    final index = _count % _bufferSize;
-    if (isTruncated) {
-      evicted = _buffer[index];
-    }
-    _buffer[index] = e;
-    _count++;
-    return evicted;
-  }
-
-  void resize(int size) {
-    assert(size >= 0);
-    if (size == _bufferSize) {
-      return;
-    }
-    final resized = List<T?>.filled(
-      size,
-      null,
-    );
-    int count = 0;
-    if (size > 0) {
-      for (final e in this()) {
-        resized[count++ % size] = e;
-      }
-    }
-    _count = count;
-    _bufferSize = size;
-    _buffer = resized;
-  }
-
-  bool get isTruncated => _count % bufferSize < _count;
-
-  int get bufferSize => _bufferSize;
-
-  int get _size => min(_count, _bufferSize);
-
-  int _bufferSize;
-  int _count = 0;
-  late List<T?> _buffer;
-}
diff --git a/pkg/dds/lib/src/cpu_samples_manager.dart b/pkg/dds/lib/src/cpu_samples_manager.dart
deleted file mode 100644
index 1fe5084..0000000
--- a/pkg/dds/lib/src/cpu_samples_manager.dart
+++ /dev/null
@@ -1,201 +0,0 @@
-// Copyright (c) 2021, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:dds/src/common/ring_buffer.dart';
-import 'package:vm_service/vm_service.dart';
-
-import 'dds_impl.dart';
-
-/// Manages CPU sample caches for an individual [Isolate].
-class CpuSamplesManager {
-  CpuSamplesManager(this.dds, this.isolateId) {
-    for (final userTag in dds.cachedUserTags) {
-      cpuSamplesCaches[userTag] = CpuSamplesRepository(userTag);
-    }
-  }
-
-  void handleUserTagEvent(Event event) {
-    assert(event.kind! == EventKind.kUserTagChanged);
-    _currentTag = event.updatedTag!;
-    final previousTag = event.previousTag!;
-    if (cpuSamplesCaches.containsKey(previousTag)) {
-      _lastCachedTag = previousTag;
-    }
-  }
-
-  void handleCpuSamplesEvent(Event event) {
-    assert(event.kind! == EventKind.kCpuSamples);
-    // There might be some samples left in the buffer for the previously set
-    // user tag. We'll check for them here and then close out the cache.
-    if (_lastCachedTag != null) {
-      cpuSamplesCaches[_lastCachedTag]!.cacheSamples(
-        event.cpuSamples!,
-      );
-      _lastCachedTag = null;
-    }
-    cpuSamplesCaches[_currentTag]?.cacheSamples(event.cpuSamples!);
-  }
-
-  final DartDevelopmentServiceImpl dds;
-  final String isolateId;
-  final cpuSamplesCaches = <String, CpuSamplesRepository>{};
-
-  String _currentTag = '';
-  String? _lastCachedTag;
-}
-
-class CpuSamplesRepository extends RingBuffer<CpuSample> {
-  // TODO: math to figure out proper buffer sizes.
-  CpuSamplesRepository(
-    this.tag, [
-    int bufferSize = 1000000,
-  ]) : super(bufferSize);
-
-  void cacheSamples(CpuSamples samples) {
-    String getFunctionId(ProfileFunction function) {
-      final functionObject = function.function;
-      if (functionObject is NativeFunction) {
-        return 'native/${functionObject.name}';
-      }
-      return functionObject.id!;
-    }
-
-    // Initialize upon seeing our first samples.
-    if (functions.isEmpty) {
-      samplePeriod = samples.samplePeriod!;
-      maxStackDepth = samples.maxStackDepth!;
-      pid = samples.pid!;
-      functions.addAll(samples.functions!);
-
-      // Build the initial id to function index mapping. This allows for us to
-      // lookup a ProfileFunction in the global function list stored in this
-      // cache. This works since most ProfileFunction objects will have an
-      // associated function with a *typically* stable service ID that we can
-      // use as a key.
-      //
-      // TODO(bkonyi): investigate creating some form of stable ID for
-      // Functions tied to closures.
-      for (int i = 0; i < functions.length; ++i) {
-        idToFunctionIndex[getFunctionId(functions[i])] = i;
-      }
-
-      // Clear tick information as we'll need to recalculate these values later
-      // when a request for samples from this repository is received.
-      for (final f in functions) {
-        f.inclusiveTicks = 0;
-        f.exclusiveTicks = 0;
-      }
-
-      _firstSampleTimestamp = samples.timeOriginMicros!;
-    } else {
-      final newFunctions = samples.functions!;
-      final indexMapping = <int, int>{};
-
-      // Check to see if we've got a function object we've never seen before.
-      for (int i = 0; i < newFunctions.length; ++i) {
-        final key = getFunctionId(newFunctions[i]);
-        if (!idToFunctionIndex.containsKey(key)) {
-          idToFunctionIndex[key] = functions.length;
-          // Keep track of the original index and the location of the function
-          // in the master function list so we can update the function indicies
-          // for each sample in this batch.
-          indexMapping[i] = functions.length;
-          functions.add(newFunctions[i]);
-
-          // Reset tick state as we'll recalculate later.
-          functions.last.inclusiveTicks = 0;
-          functions.last.exclusiveTicks = 0;
-        }
-      }
-
-      // Update the indicies into the function table for functions that were
-      // newly processed in the most recent event.
-      for (final sample in samples.samples!) {
-        final stack = sample.stack!;
-        for (int i = 0; i < stack.length; ++i) {
-          if (indexMapping.containsKey(stack[i])) {
-            stack[i] = indexMapping[stack[i]]!;
-          }
-        }
-      }
-    }
-
-    final relevantSamples = samples.samples!.where((s) => s.userTag == tag);
-    for (final sample in relevantSamples) {
-      add(sample);
-    }
-  }
-
-  @override
-  CpuSample? add(CpuSample sample) {
-    final evicted = super.add(sample);
-
-    void updateTicksForSample(CpuSample sample, int increment) {
-      final stack = sample.stack!;
-      for (int i = 0; i < stack.length; ++i) {
-        final function = functions[stack[i]];
-        function.inclusiveTicks = function.inclusiveTicks! + increment;
-        if (i + 1 == stack.length) {
-          function.exclusiveTicks = function.exclusiveTicks! + increment;
-        }
-      }
-    }
-
-    if (evicted != null) {
-      // If a sample is evicted from the cache, we need to decrement the tick
-      // counters for each function in the sample's stack.
-      updateTicksForSample(sample, -1);
-
-      // We also need to change the first timestamp to that of the next oldest
-      // sample.
-      _firstSampleTimestamp = call().first.timestamp!;
-    }
-    _lastSampleTimestamp = sample.timestamp!;
-
-    // Update function ticks to include the new sample.
-    updateTicksForSample(sample, 1);
-
-    return evicted;
-  }
-
-  Map<String, dynamic> toJson() {
-    return {
-      'type': 'CachedCpuSamples',
-      'userTag': tag,
-      'truncated': isTruncated,
-      if (functions.isNotEmpty) ...{
-        'samplePeriod': samplePeriod,
-        'maxStackDepth': maxStackDepth,
-      },
-      'timeOriginMicros': _firstSampleTimestamp,
-      'timeExtentMicros': _lastSampleTimestamp - _firstSampleTimestamp,
-      'functions': [
-        // TODO(bkonyi): remove functions with no ticks and update sample stacks.
-        for (final f in functions) f.toJson(),
-      ],
-      'sampleCount': call().length,
-      'samples': [
-        for (final s in call()) s.toJson(),
-      ]
-    };
-  }
-
-  /// The UserTag associated with all samples stored in this repository.
-  final String tag;
-
-  /// The list of function references with corresponding profiler tick data.
-  /// ** NOTE **: The tick values here need to be updated as new CpuSamples
-  /// events are delivered.
-  final functions = <ProfileFunction>[];
-  final idToFunctionIndex = <String, int>{};
-
-  /// Assume sample period and max stack depth won't change.
-  late final int samplePeriod;
-  late final int maxStackDepth;
-
-  late final int pid;
-
-  int _firstSampleTimestamp = 0;
-  int _lastSampleTimestamp = 0;
-}
diff --git a/pkg/dds/lib/src/dds_impl.dart b/pkg/dds/lib/src/dds_impl.dart
index 87ed83d..4360bcc 100644
--- a/pkg/dds/lib/src/dds_impl.dart
+++ b/pkg/dds/lib/src/dds_impl.dart
@@ -3,7 +3,6 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:collection';
 import 'dart:convert';
 import 'dart:io';
 import 'dart:math';
@@ -55,7 +54,6 @@
     this._remoteVmServiceUri,
     this._uri,
     this._authCodesEnabled,
-    this._cachedUserTags,
     this._ipv6,
     this._devToolsConfiguration,
     this.shouldLogRequests,
@@ -383,9 +381,6 @@
 
   final DevToolsConfiguration? _devToolsConfiguration;
 
-  List<String> get cachedUserTags => UnmodifiableListView(_cachedUserTags);
-  final List<String> _cachedUserTags;
-
   Future<void> get done => _done.future;
   Completer _done = Completer<void>();
   bool _shuttingDown = false;
diff --git a/pkg/dds/lib/src/isolate_manager.dart b/pkg/dds/lib/src/isolate_manager.dart
index 3a7a067..e9e14df 100644
--- a/pkg/dds/lib/src/isolate_manager.dart
+++ b/pkg/dds/lib/src/isolate_manager.dart
@@ -2,9 +2,7 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-import 'package:dds/src/cpu_samples_manager.dart';
 import 'package:json_rpc_2/json_rpc_2.dart' as json_rpc;
-import 'package:vm_service/vm_service.dart';
 
 import 'client.dart';
 import 'constants.dart';
@@ -37,11 +35,7 @@
 }
 
 class _RunningIsolate {
-  _RunningIsolate(this.isolateManager, this.id, this.name)
-      : cpuSamplesManager = CpuSamplesManager(
-          isolateManager.dds,
-          id,
-        );
+  _RunningIsolate(this.isolateManager, this.id, this.name);
 
   // State setters.
   void pausedOnExit() => _state = _IsolateState.pauseExit;
@@ -109,29 +103,6 @@
   /// Should always be called after an isolate is resumed.
   void clearResumeApprovals() => _resumeApprovalsByName.clear();
 
-  Map<String, dynamic> getCachedCpuSamples(String userTag) {
-    final repo = cpuSamplesManager.cpuSamplesCaches[userTag];
-    if (repo == null) {
-      throw json_rpc.RpcException.invalidParams(
-        'CPU sample caching is not enabled for tag: "$userTag"',
-      );
-    }
-    return repo.toJson();
-  }
-
-  void handleEvent(Event event) {
-    switch (event.kind) {
-      case EventKind.kUserTagChanged:
-        cpuSamplesManager.handleUserTagEvent(event);
-        return;
-      case EventKind.kCpuSamples:
-        cpuSamplesManager.handleCpuSamplesEvent(event);
-        return;
-      default:
-        return;
-    }
-  }
-
   int get _isolateStateMask => isolateStateToMaskMapping[_state] ?? 0;
 
   static const isolateStateToMaskMapping = {
@@ -141,7 +112,6 @@
   };
 
   final IsolateManager isolateManager;
-  final CpuSamplesManager cpuSamplesManager;
   final String name;
   final String id;
   final Set<String?> _resumeApprovalsByName = {};
@@ -152,25 +122,20 @@
   IsolateManager(this.dds);
 
   /// Handles state changes for isolates.
-  void handleIsolateEvent(Event event) {
+  void handleIsolateEvent(json_rpc.Parameters parameters) {
+    final event = parameters['event'];
+    final eventKind = event['kind'].asString;
+
     // There's no interesting information about isolate state associated with
     // and IsolateSpawn event.
-    // TODO(bkonyi): why isn't IsolateSpawn in package:vm_service
-    if (event.kind! == ServiceEvents.isolateSpawn) {
+    if (eventKind == ServiceEvents.isolateSpawn) {
       return;
     }
 
-    final isolateData = event.isolate!;
-    final id = isolateData.id!;
-    final name = isolateData.name!;
-    _updateIsolateState(id, name, event.kind!);
-  }
-
-  void routeEventToIsolate(Event event) {
-    final isolateId = event.isolate!.id!;
-    if (isolates.containsKey(isolateId)) {
-      isolates[isolateId]!.handleEvent(event);
-    }
+    final isolateData = event['isolate'];
+    final id = isolateData['id'].asString;
+    final name = isolateData['name'].asString;
+    _updateIsolateState(id, name, eventKind);
   }
 
   void _updateIsolateState(String id, String name, String eventKind) {
@@ -265,16 +230,6 @@
     return RPCResponses.success;
   }
 
-  Map<String, dynamic> getCachedCpuSamples(json_rpc.Parameters parameters) {
-    final isolateId = parameters['isolateId'].asString;
-    if (!isolates.containsKey(isolateId)) {
-      return RPCResponses.collectedSentinel;
-    }
-    final isolate = isolates[isolateId]!;
-    final userTag = parameters['userTag'].asString;
-    return isolate.getCachedCpuSamples(userTag);
-  }
-
   /// Forwards a `resume` request to the VM service.
   Future<Map<String, dynamic>> _sendResumeRequest(
     String isolateId,
diff --git a/pkg/dds/lib/src/logging_repository.dart b/pkg/dds/lib/src/logging_repository.dart
index 062529a..4537d7e 100644
--- a/pkg/dds/lib/src/logging_repository.dart
+++ b/pkg/dds/lib/src/logging_repository.dart
@@ -2,16 +2,17 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
+import 'dart:math';
+
 import 'package:json_rpc_2/json_rpc_2.dart' as json_rpc;
 
 import 'client.dart';
-import 'common/ring_buffer.dart';
 
 /// [LoggingRepository] is used to store historical log messages from the
 /// target VM service. Clients which connect to DDS and subscribe to the
 /// `Logging` stream will be sent all messages contained within this repository
 /// upon initial subscription.
-class LoggingRepository extends RingBuffer<Map<String, dynamic>> {
+class LoggingRepository extends _RingBuffer<Map<String, dynamic>> {
   LoggingRepository([int logHistoryLength = 10000]) : super(logHistoryLength) {
     // TODO(bkonyi): enforce log history limit when DartDevelopmentService
     // allows for this to be set via Dart code.
@@ -45,3 +46,53 @@
   static const int _kMaxLogBufferSize = 100000;
 }
 
+// TODO(bkonyi): move to standalone file if we decide to use this elsewhere.
+class _RingBuffer<T> {
+  _RingBuffer(this._bufferSize) {
+    _buffer = List<T?>.filled(
+      _bufferSize,
+      null,
+    );
+  }
+
+  Iterable<T> call() sync* {
+    for (int i = _size - 1; i >= 0; --i) {
+      yield _buffer[(_count - i - 1) % _bufferSize]!;
+    }
+  }
+
+  void add(T e) {
+    if (_buffer.isEmpty) {
+      return;
+    }
+    _buffer[_count++ % _bufferSize] = e;
+  }
+
+  void resize(int size) {
+    assert(size >= 0);
+    if (size == _bufferSize) {
+      return;
+    }
+    final resized = List<T?>.filled(
+      size,
+      null,
+    );
+    int count = 0;
+    if (size > 0) {
+      for (final e in this()) {
+        resized[count++ % size] = e;
+      }
+    }
+    _count = count;
+    _bufferSize = size;
+    _buffer = resized;
+  }
+
+  int get bufferSize => _bufferSize;
+
+  int get _size => min(_count, _bufferSize);
+
+  int _bufferSize;
+  int _count = 0;
+  late List<T?> _buffer;
+}
diff --git a/pkg/dds/lib/src/stream_manager.dart b/pkg/dds/lib/src/stream_manager.dart
index f396c04..94f791a 100644
--- a/pkg/dds/lib/src/stream_manager.dart
+++ b/pkg/dds/lib/src/stream_manager.dart
@@ -5,7 +5,6 @@
 import 'dart:typed_data';
 
 import 'package:json_rpc_2/json_rpc_2.dart' as json_rpc;
-import 'package:vm_service/vm_service.dart';
 
 import 'client.dart';
 import 'dds_impl.dart';
@@ -108,31 +107,18 @@
         // Stdout and Stderr streams may not exist.
       }
     }
-    if (dds.cachedUserTags.isNotEmpty) {
-      await streamListen(null, EventStreams.kProfiler);
-    }
     dds.vmServiceClient.registerMethod(
       'streamNotify',
-      (json_rpc.Parameters parameters) {
+      (parameters) {
         final streamId = parameters['streamId'].asString;
-        final event =
-            Event.parse(parameters['event'].asMap.cast<String, dynamic>())!;
-
         // Forward events from the streams IsolateManager subscribes to.
         if (isolateManagerStreams.contains(streamId)) {
-          dds.isolateManager.handleIsolateEvent(event);
+          dds.isolateManager.handleIsolateEvent(parameters);
         }
         // Keep a history of messages to send to clients when they first
         // subscribe to a stream with an event history.
         if (loggingRepositories.containsKey(streamId)) {
-          loggingRepositories[streamId]!.add(
-            parameters.asMap.cast<String, dynamic>(),
-          );
-        }
-        // If the event contains an isolate, forward the event to the
-        // corresponding isolate to be handled.
-        if (event.isolate != null) {
-          dds.isolateManager.routeEventToIsolate(event);
+          loggingRepositories[streamId]!.add(parameters.asMap);
         }
         streamNotify(streamId, parameters.value);
       },
@@ -265,7 +251,6 @@
   static const kExtensionStream = 'Extension';
   static const kIsolateStream = 'Isolate';
   static const kLoggingStream = 'Logging';
-  static const kProfilerStream = 'Profiler';
   static const kStderrStream = 'Stderr';
   static const kStdoutStream = 'Stdout';
 
@@ -287,17 +272,10 @@
     kStdoutStream,
   };
 
-  // Never cancel the profiler stream as `CpuSampleRepository` requires
-  // `UserTagChanged` events to enable/disable sample caching.
-  static const cpuSampleRepositoryStreams = <String>{
-    kProfilerStream,
-  };
-
   // The set of streams that DDS requires to function.
   static final ddsCoreStreams = <String>{
     ...isolateManagerStreams,
     ...loggingRepositoryStreams,
-    ...cpuSampleRepositoryStreams,
   };
 
   final DartDevelopmentServiceImpl dds;
diff --git a/pkg/dds/lib/vm_service_extensions.dart b/pkg/dds/lib/vm_service_extensions.dart
index 09bda25..903c14a 100644
--- a/pkg/dds/lib/vm_service_extensions.dart
+++ b/pkg/dds/lib/vm_service_extensions.dart
@@ -13,46 +13,18 @@
   static bool _factoriesRegistered = false;
   static Version? _ddsVersion;
 
-  /// The [getDartDevelopmentServiceVersion] RPC is used to determine what version of
+  /// The _getDartDevelopmentServiceVersion_ RPC is used to determine what version of
   /// the Dart Development Service Protocol is served by a DDS instance.
   ///
   /// The result of this call is cached for subsequent invocations.
   Future<Version> getDartDevelopmentServiceVersion() async {
     if (_ddsVersion == null) {
-      _ddsVersion = await _callHelper<Version>(
-        'getDartDevelopmentServiceVersion',
-      );
+      _ddsVersion =
+          await _callHelper<Version>('getDartDevelopmentServiceVersion');
     }
     return _ddsVersion!;
   }
 
-  /// The [getCachedCpuSamples] RPC is used to retrieve a cache of CPU samples
-  /// collected under a [UserTag] with name `userTag`.
-  Future<CachedCpuSamples> getCachedCpuSamples(
-      String isolateId, String userTag) async {
-    if (!(await _versionCheck(1, 3))) {
-      throw UnimplementedError('getCachedCpuSamples requires DDS version 1.3');
-    }
-    return _callHelper<CachedCpuSamples>('getCachedCpuSamples', args: {
-      'isolateId': isolateId,
-      'userTag': userTag,
-    });
-  }
-
-  /// The [getAvailableCachedCpuSamples] RPC is used to determine which caches of CPU samples
-  /// are available. Caches are associated with individual [UserTag] names and are specified
-  /// when DDS is started via the `cachedUserTags` parameter.
-  Future<AvailableCachedCpuSamples> getAvailableCachedCpuSamples() async {
-    if (!(await _versionCheck(1, 3))) {
-      throw UnimplementedError(
-        'getAvailableCachedCpuSamples requires DDS version 1.3',
-      );
-    }
-    return _callHelper<AvailableCachedCpuSamples>(
-      'getAvailableCachedCpuSamples',
-    );
-  }
-
   /// Retrieve the event history for `stream`.
   ///
   /// If `stream` does not have event history collected, a parameter error is
@@ -154,11 +126,6 @@
 
   static void _registerFactories() {
     addTypeFactory('StreamHistory', StreamHistory.parse);
-    addTypeFactory(
-      'AvailableCachedCpuSamples',
-      AvailableCachedCpuSamples.parse,
-    );
-    addTypeFactory('CachedCpuSamples', CachedCpuSamples.parse);
     _factoriesRegistered = true;
   }
 }
@@ -187,86 +154,3 @@
   List<Event> get history => UnmodifiableListView(_history);
   final List<Event> _history;
 }
-
-/// An extension of [CpuSamples] which represents a set of cached samples,
-/// associated with a particular [UserTag] name.
-class CachedCpuSamples extends CpuSamples {
-  static CachedCpuSamples? parse(Map<String, dynamic>? json) =>
-      json == null ? null : CachedCpuSamples._fromJson(json);
-
-  CachedCpuSamples({
-    required this.userTag,
-    this.truncated,
-    required int? samplePeriod,
-    required int? maxStackDepth,
-    required int? sampleCount,
-    required int? timeSpan,
-    required int? timeOriginMicros,
-    required int? timeExtentMicros,
-    required int? pid,
-    required List<ProfileFunction>? functions,
-    required List<CpuSample>? samples,
-  }) : super(
-          samplePeriod: samplePeriod,
-          maxStackDepth: maxStackDepth,
-          sampleCount: sampleCount,
-          timeSpan: timeSpan,
-          timeOriginMicros: timeOriginMicros,
-          timeExtentMicros: timeExtentMicros,
-          pid: pid,
-          functions: functions,
-          samples: samples,
-        );
-
-  CachedCpuSamples._fromJson(Map<String, dynamic> json)
-      : userTag = json['userTag']!,
-        truncated = json['truncated'],
-        super(
-          samplePeriod: json['samplePeriod'] ?? -1,
-          maxStackDepth: json['maxStackDepth'] ?? -1,
-          sampleCount: json['sampleCount'] ?? -1,
-          timeSpan: json['timeSpan'] ?? -1,
-          timeOriginMicros: json['timeOriginMicros'] ?? -1,
-          timeExtentMicros: json['timeExtentMicros'] ?? -1,
-          pid: json['pid'] ?? -1,
-          functions: List<ProfileFunction>.from(
-            createServiceObject(json['functions'], const ['ProfileFunction'])
-                    as List? ??
-                [],
-          ),
-          samples: List<CpuSample>.from(
-            createServiceObject(json['samples'], const ['CpuSample'])
-                    as List? ??
-                [],
-          ),
-        );
-
-  @override
-  String get type => 'CachedCpuSamples';
-
-  /// The name of the [UserTag] associated with this cache of [CpuSamples].
-  final String userTag;
-
-  /// Provided if the CPU sample cache has filled and older samples have been
-  /// dropped.
-  final bool? truncated;
-}
-
-/// A collection of [UserTag] names associated with caches of CPU samples.
-class AvailableCachedCpuSamples extends Response {
-  static AvailableCachedCpuSamples? parse(Map<String, dynamic>? json) =>
-      json == null ? null : AvailableCachedCpuSamples._fromJson(json);
-
-  AvailableCachedCpuSamples({
-    required this.cacheNames,
-  });
-
-  AvailableCachedCpuSamples._fromJson(Map<String, dynamic> json)
-      : cacheNames = List<String>.from(json['cacheNames']);
-
-  @override
-  String get type => 'AvailableCachedUserTagCpuSamples';
-
-  /// A [List] of [UserTag] names associated with CPU sample caches.
-  final List<String> cacheNames;
-}
diff --git a/pkg/dds/pubspec.yaml b/pkg/dds/pubspec.yaml
index b21b4c5..012f3e3 100644
--- a/pkg/dds/pubspec.yaml
+++ b/pkg/dds/pubspec.yaml
@@ -3,12 +3,12 @@
   A library used to spawn the Dart Developer Service, used to communicate with
   a Dart VM Service instance.
 
-version: 2.1.0
+version: 2.0.2
 
 homepage: https://github.com/dart-lang/sdk/tree/master/pkg/dds
 
 environment:
-  sdk: '>=2.14.0-0 <3.0.0'
+  sdk: '>=2.12.0 <3.0.0'
 
 dependencies:
   async: ^2.4.1
@@ -25,7 +25,7 @@
   sse: ^4.0.0
   stream_channel: ^2.0.0
   usage: ^4.0.0
-  vm_service: ^7.2.0
+  vm_service: ^7.0.0
   web_socket_channel: ^2.0.0
 
 dev_dependencies:
diff --git a/pkg/dds/test/common/test_helper.dart b/pkg/dds/test/common/test_helper.dart
index 077e75a..9fc441b 100644
--- a/pkg/dds/test/common/test_helper.dart
+++ b/pkg/dds/test/common/test_helper.dart
@@ -24,7 +24,6 @@
     '--observe=0',
     if (pauseOnStart) '--pause-isolates-on-start',
     '--write-service-info=$serviceInfoUri',
-    '--sample-buffer-duration=1',
     ...Platform.executableArguments,
     Platform.script.resolve(script).toString(),
   ];
diff --git a/pkg/dds/test/get_cached_cpu_samples_script.dart b/pkg/dds/test/get_cached_cpu_samples_script.dart
deleted file mode 100644
index 5949574..0000000
--- a/pkg/dds/test/get_cached_cpu_samples_script.dart
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright (c) 2021, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:developer';
-
-fib(int n) {
-  if (n <= 1) {
-    return n;
-  }
-  return fib(n - 1) + fib(n - 2);
-}
-
-void main() {
-  UserTag('Testing').makeCurrent();
-  int i = 5;
-  while (true) {
-    ++i;
-    fib(i);
-  }
-}
diff --git a/pkg/dds/test/get_cached_cpu_samples_test.dart b/pkg/dds/test/get_cached_cpu_samples_test.dart
deleted file mode 100644
index fe8a223..0000000
--- a/pkg/dds/test/get_cached_cpu_samples_test.dart
+++ /dev/null
@@ -1,112 +0,0 @@
-// Copyright (c) 2021, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:async';
-import 'dart:io';
-
-import 'package:dds/dds.dart';
-import 'package:dds/vm_service_extensions.dart';
-import 'package:test/test.dart';
-import 'package:vm_service/vm_service.dart';
-import 'package:vm_service/vm_service_io.dart';
-import 'common/test_helper.dart';
-
-void main() {
-  late Process process;
-  late DartDevelopmentService dds;
-
-  setUp(() async {
-    process = await spawnDartProcess(
-      'get_cached_cpu_samples_script.dart',
-    );
-  });
-
-  tearDown(() async {
-    await dds.shutdown();
-    process.kill();
-  });
-
-  test(
-    'No UserTags to cache',
-    () async {
-      dds = await DartDevelopmentService.startDartDevelopmentService(
-        remoteVmServiceUri,
-      );
-      expect(dds.isRunning, true);
-      final service = await vmServiceConnectUri(dds.wsUri.toString());
-
-      // We didn't provide `cachedUserTags` when starting DDS, so we shouldn't
-      // be caching anything.
-      final availableCaches = await service.getAvailableCachedCpuSamples();
-      expect(availableCaches.cacheNames.length, 0);
-
-      final isolate = (await service.getVM()).isolates!.first;
-
-      try {
-        await service.getCachedCpuSamples(isolate.id!, 'Fake');
-        fail('Invalid userTag did not cause an exception');
-      } on RPCError catch (e) {
-        expect(
-          e.message,
-          'CPU sample caching is not enabled for tag: "Fake"',
-        );
-      }
-    },
-    timeout: Timeout.none,
-  );
-
-  test(
-    'Cache CPU samples for provided UserTag name',
-    () async {
-      const kUserTag = 'Testing';
-      dds = await DartDevelopmentService.startDartDevelopmentService(
-        remoteVmServiceUri,
-        cachedUserTags: [kUserTag],
-      );
-      expect(dds.isRunning, true);
-      final service = await vmServiceConnectUri(dds.wsUri.toString());
-
-      // Ensure we're caching results for samples under the 'Testing' UserTag.
-      final availableCaches = await service.getAvailableCachedCpuSamples();
-      expect(availableCaches.cacheNames.length, 1);
-      expect(availableCaches.cacheNames.first, kUserTag);
-
-      final isolate = (await service.getVM()).isolates!.first;
-
-      final completer = Completer<void>();
-      int i = 0;
-      int count = 0;
-      service.onProfilerEvent.listen((event) async {
-        if (event.kind == EventKind.kCpuSamples &&
-            event.isolate!.id! == isolate.id!) {
-          // Pause so we don't evict another block of samples before we've
-          // retrieved the cached samples after this event.
-          await service.pause(isolate.id!);
-
-          // Ensure the number of CPU samples in the CpuSample event is
-          // is consistent with the number of samples in the cache.
-          expect(event.cpuSamples, isNotNull);
-          count += event.cpuSamples!.samples!
-              .where((e) => e.userTag == kUserTag)
-              .length;
-          final cache = await service.getCachedCpuSamples(
-            isolate.id!,
-            availableCaches.cacheNames.first,
-          );
-          expect(cache.sampleCount, count);
-
-          await service.resume(isolate.id!);
-          i++;
-          if (i == 3) {
-            completer.complete();
-          }
-        }
-      });
-      await service.streamListen(EventStreams.kProfiler);
-      await service.resume(isolate.id!);
-      await completer.future;
-    },
-    timeout: Timeout.none,
-  );
-}
diff --git a/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart b/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart
index 0015f60..b8bc5ac 100644
--- a/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart
@@ -2823,7 +2823,7 @@
     for (int i = 0; i < node.expressions.length; i++) {
       Constant constant = _evaluateSubexpression(node.expressions[i]);
       if (constant is AbortConstant) return constant;
-      if (constant is PrimitiveConstant<Object>) {
+      if (constant is PrimitiveConstant) {
         String value;
         if (constant is DoubleConstant && intFolder.isInt(constant)) {
           value = new BigInt.from(constant.value).toString();
diff --git a/pkg/front_end/lib/src/fasta/kernel/forest.dart b/pkg/front_end/lib/src/fasta/kernel/forest.dart
index 9dc0296..fa8be39 100644
--- a/pkg/front_end/lib/src/fasta/kernel/forest.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/forest.dart
@@ -726,7 +726,7 @@
       int fileOffset, Expression expression, Name name, Arguments arguments) {
     // ignore: unnecessary_null_comparison
     assert(fileOffset != null);
-    return new InternalMethodInvocation(expression, name, arguments)
+    return new MethodInvocation(expression, name, arguments)
       ..fileOffset = fileOffset;
   }
 
@@ -761,7 +761,7 @@
   Expression createPropertyGet(int fileOffset, Expression receiver, Name name) {
     // ignore: unnecessary_null_comparison
     assert(fileOffset != null);
-    return new InternalPropertyGet(receiver, name)..fileOffset = fileOffset;
+    return new PropertyGet(receiver, name)..fileOffset = fileOffset;
   }
 
   Expression createPropertySet(
@@ -769,7 +769,7 @@
       {required bool forEffect, bool readOnlyReceiver: false}) {
     // ignore: unnecessary_null_comparison
     assert(fileOffset != null);
-    return new InternalPropertySet(receiver, name, value,
+    return new PropertySet(receiver, name, value,
         forEffect: forEffect, readOnlyReceiver: readOnlyReceiver)
       ..fileOffset = fileOffset;
   }
diff --git a/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart b/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart
index 7be2835..e820080 100644
--- a/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart
@@ -1110,8 +1110,8 @@
       Expression? syntheticAssignment, bool hasProblem) {
     if (syntheticAssignment is VariableSet) {
       return new LocalForInVariable(syntheticAssignment);
-    } else if (syntheticAssignment is InternalPropertySet) {
-      return new InternalPropertyForInVariable(syntheticAssignment);
+    } else if (syntheticAssignment is PropertySet) {
+      return new PropertyForInVariable(syntheticAssignment);
     } else if (syntheticAssignment is SuperPropertySet) {
       return new SuperPropertyForInVariable(syntheticAssignment);
     } else if (syntheticAssignment is StaticSet) {
@@ -2806,8 +2806,8 @@
     return new ExpressionInferenceResult(inferredType, node);
   }
 
-  ExpressionInferenceResult visitInternalMethodInvocation(
-      InternalMethodInvocation node, DartType typeContext) {
+  ExpressionInferenceResult visitMethodInvocation(
+      MethodInvocation node, DartType typeContext) {
     assert(node.name != unaryMinusName);
     ExpressionInferenceResult result = inferrer.inferNullAwareExpression(
         node.receiver, const UnknownType(), true);
@@ -5608,8 +5608,8 @@
     return new ExpressionInferenceResult(inferredType, node);
   }
 
-  ExpressionInferenceResult visitInternalPropertySet(
-      InternalPropertySet node, DartType typeContext) {
+  ExpressionInferenceResult visitPropertySet(
+      PropertySet node, DartType typeContext) {
     ExpressionInferenceResult receiverResult = inferrer
         .inferNullAwareExpression(node.receiver, const UnknownType(), true,
             isVoidAllowed: false);
@@ -5750,8 +5750,8 @@
         inferredType, replacement, nullAwareGuards.prepend(nullAwareGuard));
   }
 
-  ExpressionInferenceResult visitInternalPropertyGet(
-      InternalPropertyGet node, DartType typeContext) {
+  ExpressionInferenceResult visitPropertyGet(
+      PropertyGet node, DartType typeContext) {
     ExpressionInferenceResult result = inferrer.inferNullAwareExpression(
         node.receiver, const UnknownType(), true);
 
@@ -6970,14 +6970,14 @@
   }
 }
 
-class InternalPropertyForInVariable implements ForInVariable {
-  final InternalPropertySet propertySet;
+class PropertyForInVariable implements ForInVariable {
+  final PropertySet propertySet;
 
   DartType? _writeType;
 
   Expression? _rhs;
 
-  InternalPropertyForInVariable(this.propertySet);
+  PropertyForInVariable(this.propertySet);
 
   @override
   DartType computeElementType(TypeInferrerImpl inferrer) {
diff --git a/pkg/front_end/lib/src/fasta/kernel/internal_ast.dart b/pkg/front_end/lib/src/fasta/kernel/internal_ast.dart
index d207717..9364065 100644
--- a/pkg/front_end/lib/src/fasta/kernel/internal_ast.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/internal_ast.dart
@@ -1357,7 +1357,7 @@
   @override
   void toTextInternal(AstPrinter printer) {
     Expression propertyGet = read;
-    if (propertyGet is InternalPropertyGet) {
+    if (propertyGet is PropertyGet) {
       Expression receiver = propertyGet.receiver;
       if (receiver is VariableGet && receiver.variable == variable) {
         // Special-case the usual use of this node.
@@ -4533,16 +4533,14 @@
 /// This will be transformed into an [InstanceInvocation], [DynamicInvocation],
 /// [FunctionInvocation] or [StaticInvocation] (for implicit extension method
 /// invocation) after type inference.
-// TODO(johnniwinther): Rename to `MethodInvocation` when [MethodInvocation]
-// has been removed.
-class InternalMethodInvocation extends InternalExpression {
+class MethodInvocation extends InternalExpression {
   Expression receiver;
 
   Name name;
 
   Arguments arguments;
 
-  InternalMethodInvocation(this.receiver, this.name, this.arguments)
+  MethodInvocation(this.receiver, this.name, this.arguments)
       // ignore: unnecessary_null_comparison
       : assert(receiver != null),
         // ignore: unnecessary_null_comparison
@@ -4554,7 +4552,7 @@
   @override
   ExpressionInferenceResult acceptInference(
       InferenceVisitor visitor, DartType typeContext) {
-    return visitor.visitInternalMethodInvocation(this, typeContext);
+    return visitor.visitMethodInvocation(this, typeContext);
   }
 
   @override
@@ -4596,7 +4594,7 @@
 
   @override
   String toString() {
-    return "InternalMethodInvocation(${toStringInternal()})";
+    return "MethodInvocation(${toStringInternal()})";
   }
 
   @override
@@ -4616,14 +4614,12 @@
 /// This will be transformed into an [InstanceGet], [InstanceTearOff],
 /// [DynamicGet], [FunctionTearOff] or [StaticInvocation] (for implicit
 /// extension member access) after type inference.
-// TODO(johnniwinther): Rename to `PropertyGet` when [PropertyGet]
-// has been removed.
-class InternalPropertyGet extends InternalExpression {
+class PropertyGet extends InternalExpression {
   Expression receiver;
 
   Name name;
 
-  InternalPropertyGet(this.receiver, this.name)
+  PropertyGet(this.receiver, this.name)
       // ignore: unnecessary_null_comparison
       : assert(receiver != null) {
     receiver.parent = this;
@@ -4632,7 +4628,7 @@
   @override
   ExpressionInferenceResult acceptInference(
       InferenceVisitor visitor, DartType typeContext) {
-    return visitor.visitInternalPropertyGet(this, typeContext);
+    return visitor.visitPropertyGet(this, typeContext);
   }
 
   @override
@@ -4663,7 +4659,7 @@
 
   @override
   String toString() {
-    return "InternalPropertyGet(${toStringInternal()})";
+    return "PropertyGet(${toStringInternal()})";
   }
 
   @override
@@ -4682,9 +4678,7 @@
 /// This will be transformed into an [InstanceSet], [DynamicSet], or
 /// [StaticInvocation] (for implicit extension member access) after type
 /// inference.
-// TODO(johnniwinther): Rename to `PropertySet` when [PropertySet]
-// has been removed.
-class InternalPropertySet extends InternalExpression {
+class PropertySet extends InternalExpression {
   Expression receiver;
   Name name;
   Expression value;
@@ -4696,7 +4690,7 @@
   /// for multiple reads.
   final bool readOnlyReceiver;
 
-  InternalPropertySet(this.receiver, this.name, this.value,
+  PropertySet(this.receiver, this.name, this.value,
       {required this.forEffect, required this.readOnlyReceiver})
       // ignore: unnecessary_null_comparison
       : assert(receiver != null),
@@ -4713,7 +4707,7 @@
   @override
   ExpressionInferenceResult acceptInference(
       InferenceVisitor visitor, DartType typeContext) {
-    return visitor.visitInternalPropertySet(this, typeContext);
+    return visitor.visitPropertySet(this, typeContext);
   }
 
   @override
@@ -4756,7 +4750,7 @@
 
   @override
   String toString() {
-    return "InternalPropertySet(${toStringInternal()})";
+    return "PropertySet(${toStringInternal()})";
   }
 
   @override
diff --git a/pkg/front_end/test/text_representation/internal_ast_text_representation_test.dart b/pkg/front_end/test/text_representation/internal_ast_text_representation_test.dart
index 4f17a6e..e483c41 100644
--- a/pkg/front_end/test/text_representation/internal_ast_text_representation_test.dart
+++ b/pkg/front_end/test/text_representation/internal_ast_text_representation_test.dart
@@ -377,12 +377,12 @@
 
 void _testInternalMethodInvocation() {
   testExpression(
-      new InternalMethodInvocation(
+      new MethodInvocation(
           new IntLiteral(0), new Name('boz'), new ArgumentsImpl([])),
       '''
 0.boz()''');
   testExpression(
-      new InternalMethodInvocation(
+      new MethodInvocation(
           new IntLiteral(0),
           new Name('boz'),
           new ArgumentsImpl([
@@ -400,13 +400,13 @@
 
 void _testInternalPropertyGet() {
   testExpression(
-      new InternalPropertyGet(new IntLiteral(0), new Name('boz')), '''
+      new PropertyGet(new IntLiteral(0), new Name('boz')), '''
 0.boz''');
 }
 
 void _testInternalPropertySet() {
   testExpression(
-      new InternalPropertySet(
+      new PropertySet(
           new IntLiteral(0), new Name('boz'), new IntLiteral(1),
           forEffect: false, readOnlyReceiver: false),
       '''
@@ -464,7 +464,7 @@
   // An unusual use of this node.
   testExpression(
       new NullAwareMethodInvocation(variable,
-          new InternalPropertyGet(new VariableGet(variable), new Name('foo'))),
+          new PropertyGet(new VariableGet(variable), new Name('foo'))),
       '''
 let final dynamic #0 = 0 in null-aware #0.foo''');
 }
@@ -476,7 +476,7 @@
   // The usual use of this node.
   testExpression(
       new NullAwarePropertyGet(variable,
-          new InternalPropertyGet(new VariableGet(variable), new Name('foo'))),
+          new PropertyGet(new VariableGet(variable), new Name('foo'))),
       '''
 0?.foo''');
 
diff --git a/pkg/vm/bin/gen_kernel.dart b/pkg/vm/bin/gen_kernel.dart
index 5545e18..ed2ab26 100644
--- a/pkg/vm/bin/gen_kernel.dart
+++ b/pkg/vm/bin/gen_kernel.dart
@@ -2,8 +2,6 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-// @dart=2.9
-
 import 'dart:async';
 import 'dart:io' as io;
 
diff --git a/pkg/vm/bin/kernel_service.dart b/pkg/vm/bin/kernel_service.dart
index eb69ce4..e3a221e 100644
--- a/pkg/vm/bin/kernel_service.dart
+++ b/pkg/vm/bin/kernel_service.dart
@@ -2,8 +2,6 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-// @dart=2.9
-
 /// This is an interface to the Dart Kernel parser and Kernel binary generator.
 ///
 /// It is used by the kernel-isolate to load Dart source code and generate
@@ -20,7 +18,6 @@
 ///         dart pkg/vm/bin/kernel_service.dart --train <source-file>
 ///
 ///
-library runtime.tools.kernel_service;
 
 import 'dart:async' show Future, ZoneSpecification, runZoned;
 import 'dart:collection' show UnmodifiableMapBase;
@@ -90,11 +87,11 @@
 
 CompilerOptions setupCompilerOptions(
     FileSystem fileSystem,
-    Uri platformKernelPath,
+    Uri? platformKernelPath,
     bool enableAsserts,
     int nullSafety,
-    List<String> experimentalFlags,
-    Uri packagesUri,
+    List<String>? experimentalFlags,
+    Uri? packagesUri,
     List<String> errorsPlain,
     List<String> errorsColorized,
     String invocationModes,
@@ -161,11 +158,11 @@
 abstract class Compiler {
   final int isolateGroupId;
   final FileSystem fileSystem;
-  final Uri platformKernelPath;
+  final Uri? platformKernelPath;
   final bool enableAsserts;
   final int nullSafety;
-  final List<String> experimentalFlags;
-  final String packageConfig;
+  final List<String>? experimentalFlags;
+  final String? packageConfig;
   final String invocationModes;
   final String verbosityLevel;
 
@@ -177,7 +174,7 @@
   final List<String> errorsPlain = <String>[];
   final List<String> errorsColorized = <String>[];
 
-  CompilerOptions options;
+  late final CompilerOptions options;
 
   Compiler(this.isolateGroupId, this.fileSystem, this.platformKernelPath,
       {this.enableAsserts: false,
@@ -188,11 +185,10 @@
       this.packageConfig: null,
       this.invocationModes: '',
       this.verbosityLevel: Verbosity.defaultValue}) {
-    Uri packagesUri = null;
+    Uri? packagesUri = null;
+    final packageConfig = this.packageConfig ?? Platform.packageConfig;
     if (packageConfig != null) {
       packagesUri = Uri.parse(packageConfig);
-    } else if (Platform.packageConfig != null) {
-      packagesUri = Uri.parse(Platform.packageConfig);
     }
 
     if (verbose) {
@@ -218,7 +214,7 @@
   Future<CompilerResult> compile(Uri script) {
     return runWithPrintToStderr(() async {
       final CompilerResult compilerResult = await compileInternal(script);
-      final Component component = compilerResult.component;
+      final Component? component = compilerResult.component;
 
       if (errorsPlain.isEmpty) {
         // Record dependencies only if compilation was error free.
@@ -233,20 +229,16 @@
 }
 
 class CompilerResult {
-  final Component component;
+  final Component? component;
 
   /// Set of libraries loaded from .dill, with or without the SDK depending on
   /// the compilation settings.
   final Set<Library> loadedLibraries;
-  final ClassHierarchy classHierarchy;
-  final CoreTypes coreTypes;
+  final ClassHierarchy? classHierarchy;
+  final CoreTypes? coreTypes;
 
-  CompilerResult(
-      this.component, this.loadedLibraries, this.classHierarchy, this.coreTypes)
-      : assert(component != null),
-        assert(loadedLibraries != null),
-        assert(classHierarchy != null),
-        assert(coreTypes != null);
+  CompilerResult(this.component, this.loadedLibraries, this.classHierarchy,
+      this.coreTypes);
 }
 
 // Environment map which looks up environment defines in the VM environment
@@ -257,17 +249,17 @@
 // the full (isolate specific) environment as a finite, static map.
 class EnvironmentMap extends UnmodifiableMapBase<String, String> {
   @override
-  bool containsKey(Object key) {
-    return new bool.hasEnvironment(key);
+  bool containsKey(Object? key) {
+    return key is String && new bool.hasEnvironment(key);
   }
 
   @override
-  String operator [](Object key) {
+  String? operator [](Object? key) {
     // The fromEnvironment constructor is specified to throw when called using
     // new. However, the VM implementation actually looks up the given name in
     // the environment.
     if (containsKey(key)) {
-      return new String.fromEnvironment(key);
+      return new String.fromEnvironment(key as String);
     }
     return null;
   }
@@ -294,14 +286,14 @@
 }
 
 class IncrementalCompilerWrapper extends Compiler {
-  IncrementalCompiler generator;
+  IncrementalCompiler? generator;
 
   IncrementalCompilerWrapper(
-      int isolateGroupId, FileSystem fileSystem, Uri platformKernelPath,
+      int isolateGroupId, FileSystem fileSystem, Uri? platformKernelPath,
       {bool enableAsserts: false,
       int nullSafety: kNullSafetyOptionUnspecified,
-      List<String> experimentalFlags: null,
-      String packageConfig: null,
+      List<String>? experimentalFlags,
+      String? packageConfig,
       String invocationModes: '',
       String verbosityLevel: Verbosity.defaultValue})
       : super(isolateGroupId, fileSystem, platformKernelPath,
@@ -318,10 +310,10 @@
       Component component,
       int isolateGroupId,
       FileSystem fileSystem,
-      Uri platformKernelPath,
+      Uri? platformKernelPath,
       {bool enableAsserts: false,
-      List<String> experimentalFlags: null,
-      String packageConfig: null,
+      List<String>? experimentalFlags,
+      String? packageConfig,
       String invocationModes: ''}) {
     IncrementalCompilerWrapper result = IncrementalCompilerWrapper(
         isolateGroupId, fileSystem, platformKernelPath,
@@ -332,15 +324,13 @@
     result.generator = new IncrementalCompiler.forExpressionCompilationOnly(
         component,
         result.options,
-        component.mainMethod?.enclosingLibrary?.fileUri);
+        component.mainMethod!.enclosingLibrary.fileUri);
     return result;
   }
 
   @override
   Future<CompilerResult> compileInternal(Uri script) async {
-    if (generator == null) {
-      generator = new IncrementalCompiler(options, script);
-    }
+    final generator = this.generator ??= IncrementalCompiler(options, script);
     errorsPlain.clear();
     errorsColorized.clear();
     final component = await generator.compile(entryPoint: script);
@@ -348,8 +338,8 @@
         generator.getClassHierarchy(), generator.getCoreTypes());
   }
 
-  void accept() => generator.accept();
-  void invalidate(Uri uri) => generator.invalidate(uri);
+  void accept() => generator!.accept();
+  void invalidate(Uri uri) => generator!.invalidate(uri);
 
   Future<IncrementalCompilerWrapper> clone(int isolateGroupId) async {
     IncrementalCompilerWrapper clone = IncrementalCompilerWrapper(
@@ -359,6 +349,7 @@
         experimentalFlags: experimentalFlags,
         packageConfig: packageConfig,
         invocationModes: invocationModes);
+    final generator = this.generator!;
     // TODO(VM TEAM): This does not seem safe. What if cloning while having
     // pending deltas for instance?
     generator.resetDeltaState();
@@ -369,9 +360,10 @@
     MemoryFileSystem memoryFileSystem = (fileSystem as HybridFileSystem).memory;
 
     String filename = 'full-component-$isolateGroupId.dill';
-    Sink sink = FileSink(memoryFileSystem.entityForUri(Uri.file(filename)));
+    Sink<List<int>> sink =
+        FileSink(memoryFileSystem.entityForUri(Uri.file(filename)));
     new BinaryPrinter(sink).writeComponentFile(fullComponent);
-    await sink.close();
+    sink.close();
 
     clone.generator = new IncrementalCompiler(options, generator.entryPoint,
         initializeFromDillUri: Uri.file(filename));
@@ -387,8 +379,8 @@
       {this.requireMain: false,
       bool enableAsserts: false,
       int nullSafety: kNullSafetyOptionUnspecified,
-      List<String> experimentalFlags: null,
-      String packageConfig: null,
+      List<String>? experimentalFlags,
+      String? packageConfig,
       String invocationModes: '',
       String verbosityLevel: Verbosity.defaultValue})
       : super(isolateGroupId, fileSystem, platformKernelPath,
@@ -401,12 +393,15 @@
 
   @override
   Future<CompilerResult> compileInternal(Uri script) async {
-    fe.CompilerResult compilerResult = requireMain
+    final fe.CompilerResult? compilerResult = requireMain
         ? await kernelForProgram(script, options)
         : await kernelForModule([script], options);
+    if (compilerResult == null) {
+      return CompilerResult(null, const {}, null, null);
+    }
 
     Set<Library> loadedLibraries = createLoadedLibrariesSet(
-        compilerResult?.loadedComponents, compilerResult?.sdkComponent,
+        compilerResult.loadedComponents, compilerResult.sdkComponent,
         includePlatform: !options.omitPlatform);
 
     return new CompilerResult(compilerResult.component, loadedLibraries,
@@ -418,21 +413,21 @@
 final Map<int, List<Uri>> isolateDependencies = {};
 final Map<int, _ExpressionCompilationFromDillSettings> isolateLoadNotifies = {};
 
-IncrementalCompilerWrapper lookupIncrementalCompiler(int isolateGroupId) {
+IncrementalCompilerWrapper? lookupIncrementalCompiler(int isolateGroupId) {
   return isolateCompilers[isolateGroupId];
 }
 
 Future<Compiler> lookupOrBuildNewIncrementalCompiler(int isolateGroupId,
-    List sourceFiles, Uri platformKernelPath, List<int> platformKernel,
+    List sourceFiles, Uri platformKernelPath, List<int>? platformKernel,
     {bool enableAsserts: false,
     int nullSafety: kNullSafetyOptionUnspecified,
-    List<String> experimentalFlags: null,
-    String packageConfig: null,
-    String multirootFilepaths,
-    String multirootScheme,
+    List<String>? experimentalFlags,
+    String? packageConfig,
+    String? multirootFilepaths,
+    String? multirootScheme,
     String invocationModes: '',
     String verbosityLevel: Verbosity.defaultValue}) async {
-  IncrementalCompilerWrapper compiler =
+  IncrementalCompilerWrapper? compiler =
       lookupIncrementalCompiler(isolateGroupId);
   if (compiler != null) {
     updateSources(compiler, sourceFiles);
@@ -441,9 +436,7 @@
     // This is how identify scenario where child isolate hot reload requests
     // requires setting up actual compiler first: non-empty sourceFiles list has
     // no actual content specified for the source file.
-    if (sourceFiles != null &&
-        sourceFiles.length > 0 &&
-        sourceFiles[1] == null) {
+    if (sourceFiles.isNotEmpty && sourceFiles[1] == null) {
       // Just use first compiler that should represent main isolate as a source for cloning.
       var source = isolateCompilers.entries.first;
       compiler = await source.value.clone(isolateGroupId);
@@ -475,7 +468,7 @@
     final FileSystem fs = compiler.fileSystem;
     for (int i = 0; i < sourceFiles.length ~/ 2; i++) {
       Uri uri = Uri.parse(sourceFiles[i * 2]);
-      List<int> source = sourceFiles[i * 2 + 1];
+      List<int>? source = sourceFiles[i * 2 + 1];
       // The source is only provided by unit tests and is normally empty.
       // Don't add an entry for the uri so the compiler will fallback to the
       // real file system for the updated source.
@@ -507,23 +500,24 @@
   final List<String> definitions = request[5].cast<String>();
   final List<String> typeDefinitions = request[6].cast<String>();
   final String libraryUri = request[7];
-  final String klass = request[8]; // might be null
+  final String? klass = request[8];
   final bool isStatic = request[9];
-  final List dillData = request[10];
+  final List<List<int>> dillData = request[10].cast<List<int>>();
   final int blobLoadCount = request[11];
   final bool enableAsserts = request[12];
-  final List<String> experimentalFlags =
+  final List<String>? experimentalFlags =
       request[13] != null ? request[13].cast<String>() : null;
 
-  IncrementalCompilerWrapper compiler = isolateCompilers[isolateGroupId];
+  IncrementalCompilerWrapper? compiler = isolateCompilers[isolateGroupId];
 
-  _ExpressionCompilationFromDillSettings isolateLoadDillData =
+  _ExpressionCompilationFromDillSettings? isolateLoadDillData =
       isolateLoadNotifies[isolateGroupId];
   if (isolateLoadDillData != null) {
     // Check if we can reuse the compiler.
     if (isolateLoadDillData.blobLoadCount != blobLoadCount ||
         isolateLoadDillData.prevDillCount != dillData.length) {
-      compiler = isolateCompilers[isolateGroupId] = null;
+      isolateCompilers.remove(isolateGroupId);
+      compiler = null;
     }
   }
 
@@ -560,7 +554,7 @@
         }
       }
       if (!foundDartCore) {
-        List<int> platformKernel = null;
+        List<int> platformKernel;
         if (dart_platform_kernel is List<int>) {
           platformKernel = dart_platform_kernel;
         } else {
@@ -598,7 +592,7 @@
             packageConfig: dotPackagesFile);
         isolateCompilers[isolateGroupId] = compiler;
         await compiler.compile(
-            component.mainMethod?.enclosingLibrary?.importUri ??
+            component.mainMethod?.enclosingLibrary.importUri ??
                 component.libraries.last.importUri);
       } catch (e) {
         port.send(new CompilationResult.errors([
@@ -623,7 +617,7 @@
 
   CompilationResult result;
   try {
-    Procedure procedure = await compiler.generator.compileExpression(
+    Procedure? procedure = await compiler.generator!.compileExpression(
         expression, definitions, typeDefinitions, libraryUri, klass, isStatic);
 
     if (procedure == null) {
@@ -651,7 +645,7 @@
 }
 
 void _recordDependencies(
-    int isolateGroupId, Component component, Uri packageConfig) {
+    int isolateGroupId, Component? component, Uri? packageConfig) {
   final dependencies = isolateDependencies[isolateGroupId] ??= <Uri>[];
 
   if (component != null) {
@@ -680,8 +674,8 @@
   return uri.toFilePath().replaceAll("\\", "\\\\").replaceAll(" ", "\\ ");
 }
 
-List<int> _serializeDependencies(List<Uri> uris) {
-  return utf8.encode(uris.map(_escapeDependency).join(" "));
+Uint8List _serializeDependencies(List<Uri> uris) {
+  return utf8.encode(uris.map(_escapeDependency).join(" ")) as Uint8List;
 }
 
 Future _processListDependenciesRequest(
@@ -752,23 +746,23 @@
     return;
   }
 
-  final String inputFileUri = request[2];
-  final Uri script =
+  final String? inputFileUri = request[2];
+  final Uri? script =
       inputFileUri != null ? Uri.base.resolve(inputFileUri) : null;
   final bool incremental = request[4];
   final bool snapshot = request[5];
   final int nullSafety = request[6];
   final List sourceFiles = request[8];
   final bool enableAsserts = request[9];
-  final List<String> experimentalFlags =
+  final List<String>? experimentalFlags =
       request[10] != null ? request[10].cast<String>() : null;
-  final String packageConfig = request[11];
-  final String multirootFilepaths = request[12];
-  final String multirootScheme = request[13];
-  final String workingDirectory = request[14];
+  final String? packageConfig = request[11];
+  final String? multirootFilepaths = request[12];
+  final String? multirootScheme = request[13];
+  final String? workingDirectory = request[14];
   final String verbosityLevel = request[15];
-  Uri platformKernelPath = null;
-  List<int> platformKernel = null;
+  Uri platformKernelPath;
+  List<int>? platformKernel = null;
   if (request[3] is String) {
     platformKernelPath = Uri.base.resolveUri(new Uri.file(request[3]));
   } else if (request[3] is List<int>) {
@@ -781,7 +775,7 @@
 
   final String invocationModes = snapshot ? 'compile' : '';
 
-  Compiler compiler;
+  Compiler? compiler;
 
   // Update the in-memory file system with the provided sources. Currently, only
   // unit tests compile sources that are not on the file system, so this can only
@@ -796,7 +790,7 @@
           .toResponse());
       return;
     }
-    updateSources(compiler, sourceFiles);
+    updateSources(compiler as IncrementalCompilerWrapper, sourceFiles);
     port.send(new CompilationResult.ok(null).toResponse());
     return;
   } else if (tag == kAcceptTag) {
@@ -813,16 +807,15 @@
   } else if (tag == kDetectNullabilityTag) {
     FileSystem fileSystem = _buildFileSystem(
         sourceFiles, platformKernel, multirootFilepaths, multirootScheme);
-    Uri packagesUri = null;
-    if (packageConfig != null) {
-      packagesUri = Uri.parse(packageConfig);
-    } else if (Platform.packageConfig != null) {
-      packagesUri = Uri.parse(Platform.packageConfig);
+    Uri? packagesUri = null;
+    final packageConfigWithDefault = packageConfig ?? Platform.packageConfig;
+    if (packageConfigWithDefault != null) {
+      packagesUri = Uri.parse(packageConfigWithDefault);
     }
     if (packagesUri != null && packagesUri.scheme == '') {
       // Script does not have a scheme, assume that it is a path,
       // resolve it against the working directory.
-      packagesUri = Uri.directory(workingDirectory).resolveUri(packagesUri);
+      packagesUri = Uri.directory(workingDirectory!).resolveUri(packagesUri);
     }
     final List<String> errorsPlain = <String>[];
     final List<String> errorsColorized = <String>[];
@@ -839,8 +832,7 @@
         verbosityLevel);
 
     // script should only be null for kUpdateSourcesTag.
-    assert(script != null);
-    await autoDetectNullSafetyMode(script, options);
+    await autoDetectNullSafetyMode(script!, options);
     bool value = options.nnbdMode == NnbdMode.Strong;
     port.send(new CompilationResult.nullSafety(value).toResponse());
     return;
@@ -884,7 +876,7 @@
       print("DFE: scriptUri: ${script}");
     }
 
-    CompilerResult compilerResult = await compiler.compile(script);
+    CompilerResult compilerResult = await compiler.compile(script!);
     Set<Library> loadedLibraries = compilerResult.loadedLibraries;
 
     assert(compiler.errorsPlain.length == compiler.errorsColorized.length);
@@ -896,10 +888,11 @@
     if (compiler.errorsColorized.isNotEmpty) {
       final List<String> errors =
           (enableColors) ? compiler.errorsColorized : compiler.errorsPlain;
-      if (compilerResult.component != null) {
+      final component = compilerResult.component;
+      if (component != null) {
         result = new CompilationResult.errors(
             errors,
-            serializeComponent(compilerResult.component,
+            serializeComponent(component,
                 filter: (lib) => !loadedLibraries.contains(lib)));
       } else {
         result = new CompilationResult.errors(errors, null);
@@ -910,7 +903,7 @@
       // [kernelForProgram] is marked `external`, so we can use that bit to
       // decide what to exclude.
       result = new CompilationResult.ok(serializeComponent(
-          compilerResult.component,
+          compilerResult.component!,
           filter: (lib) => !loadedLibraries.contains(lib)));
     }
   } catch (error, stack) {
@@ -922,7 +915,7 @@
   if (tag == kTrainTag) {
     // In training mode make sure to read the sdk a few more times...
     ProcessedOptions p = new ProcessedOptions(options: compiler.options);
-    var bytes = await p.loadSdkSummaryBytes();
+    final bytes = (await p.loadSdkSummaryBytes())!;
     for (int i = 0; i < 5; i++) {
       p.loadComponent(bytes, null);
     }
@@ -951,19 +944,17 @@
 ///
 /// The result can be used instead of StandardFileSystem.instance by the
 /// frontend.
-FileSystem _buildFileSystem(List sourceFiles, List<int> platformKernel,
-    String multirootFilepaths, String multirootScheme) {
+FileSystem _buildFileSystem(List sourceFiles, List<int>? platformKernel,
+    String? multirootFilepaths, String? multirootScheme) {
   FileSystem fileSystem = new HttpAwareFileSystem(StandardFileSystem.instance);
 
   if (!sourceFiles.isEmpty || platformKernel != null) {
     MemoryFileSystem memoryFileSystem =
         new MemoryFileSystem(Uri.parse('file:///'));
-    if (sourceFiles != null) {
-      for (int i = 0; i < sourceFiles.length ~/ 2; i++) {
-        memoryFileSystem
-            .entityForUri(Uri.parse(sourceFiles[i * 2]))
-            .writeAsBytesSync(sourceFiles[i * 2 + 1]);
-      }
+    for (int i = 0; i < sourceFiles.length ~/ 2; i++) {
+      memoryFileSystem
+          .entityForUri(Uri.parse(sourceFiles[i * 2]))
+          .writeAsBytesSync(sourceFiles[i * 2 + 1]);
     }
     if (platformKernel != null) {
       memoryFileSystem
@@ -984,7 +975,7 @@
   return fileSystem;
 }
 
-train(String scriptUri, String platformKernelPath) async {
+train(String scriptUri, String? platformKernelPath) async {
   // Train on program asked to train on.
   await trainInternal(scriptUri, platformKernelPath);
 
@@ -1007,7 +998,7 @@
   }
 }
 
-Future trainInternal(String scriptUri, String platformKernelPath) async {
+Future trainInternal(String scriptUri, String? platformKernelPath) async {
   var tag = kTrainTag;
   var responsePort = new RawReceivePort();
   responsePort.handler = (response) {
@@ -1050,7 +1041,7 @@
     // 2) Optional platform kernel path.
     int argIndex = 1;
     final String script = args[argIndex++];
-    final String platform = (argIndex < args.length) ? args[argIndex] : null;
+    final String? platform = (argIndex < args.length) ? args[argIndex] : null;
     train(script, platform);
   } else {
     // Entry point for the Kernel isolate.
@@ -1077,11 +1068,11 @@
 abstract class CompilationResult {
   CompilationResult._();
 
-  factory CompilationResult.ok(Uint8List bytes) = _CompilationOk;
+  factory CompilationResult.ok(Uint8List? bytes) = _CompilationOk;
 
   factory CompilationResult.nullSafety(bool val) = _CompilationNullSafety;
 
-  factory CompilationResult.errors(List<String> errors, Uint8List bytes) =
+  factory CompilationResult.errors(List<String> errors, Uint8List? bytes) =
       _CompilationError;
 
   factory CompilationResult.crash(Object exception, StackTrace stack) =
@@ -1095,11 +1086,14 @@
 }
 
 class _CompilationOk extends CompilationResult {
-  final Uint8List bytes;
+  final Uint8List? bytes;
 
   _CompilationOk(this.bytes) : super._() {
-    if (dumpKernel && bytes != null) {
-      _debugDumpKernel(bytes);
+    if (dumpKernel) {
+      final bytes = this.bytes;
+      if (bytes != null) {
+        _debugDumpKernel(bytes);
+      }
     }
   }
 
@@ -1109,7 +1103,7 @@
   @override
   get payload => bytes;
 
-  String toString() => "_CompilationOk(${bytes.length} bytes)";
+  String toString() => "_CompilationOk(${bytes?.length ?? 0} bytes)";
 }
 
 class _CompilationNullSafety extends CompilationResult {
@@ -1136,7 +1130,7 @@
 }
 
 class _CompilationError extends _CompilationFail {
-  final Uint8List bytes;
+  final Uint8List? bytes;
   final List<String> errors;
 
   _CompilationError(this.errors, this.bytes);
diff --git a/pkg/vm/bin/protobuf_aware_treeshaker.dart b/pkg/vm/bin/protobuf_aware_treeshaker.dart
index 8ee0887..3af79b6 100644
--- a/pkg/vm/bin/protobuf_aware_treeshaker.dart
+++ b/pkg/vm/bin/protobuf_aware_treeshaker.dart
@@ -3,8 +3,6 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-// @dart=2.9
-
 /// This program will take a .dill file and do a protobuf aware tree-shaking.
 ///
 /// All fields of GeneratedMessage subclasses that are not accessed with their
@@ -36,7 +34,6 @@
 import 'package:vm/kernel_front_end.dart'
     show runGlobalTransformations, ErrorDetector;
 import 'package:kernel/target/targets.dart' show TargetFlags, getTarget;
-import 'package:meta/meta.dart';
 import 'package:vm/target/install.dart' show installAdditionalTargets;
 import 'package:vm/transformations/type_flow/transformer.dart' as globalTypeFlow
     show transformComponent;
@@ -71,7 +68,7 @@
         help: 'Write to stdout about what classes and fields where remeoved')
     ..addFlag('help', help: 'Prints this help', negatable: false);
 
-  ArgResults argResults;
+  ArgResults? argResults;
   try {
     argResults = argParser.parse(args);
   } on FormatException catch (e) {
@@ -111,7 +108,7 @@
 
   installAdditionalTargets();
 
-  final target = getTarget(argResults['target'], TargetFlags());
+  final target = getTarget(argResults['target'], TargetFlags())!;
 
   // The [component] is treeshaken and has TFA annotations. Write output.
   if (argResults['aot']) {
@@ -158,7 +155,7 @@
 }
 
 Future writeComponent(Component component, String filename,
-    {@required bool removeCoreLibs, @required bool removeSource}) async {
+    {required bool removeCoreLibs, required bool removeSource}) async {
   if (removeSource) {
     component.uriToSource.clear();
   }
diff --git a/pkg/vm/pubspec.yaml b/pkg/vm/pubspec.yaml
index 0e78a09..20b2cd7 100644
--- a/pkg/vm/pubspec.yaml
+++ b/pkg/vm/pubspec.yaml
@@ -15,8 +15,6 @@
     path: ../front_end
   kernel:
     path: ../kernel
-  meta:
-    path: ../meta
   package_config: any
   collection: ^1.15.0
 
diff --git a/pkg/vm/test/incremental_compiler_test.dart b/pkg/vm/test/incremental_compiler_test.dart
index cdde7fc..5b175e4 100644
--- a/pkg/vm/test/incremental_compiler_test.dart
+++ b/pkg/vm/test/incremental_compiler_test.dart
@@ -2,12 +2,11 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-// @dart=2.9
-
 import 'dart:async';
 import 'dart:convert';
 import 'dart:io';
 
+import 'package:collection/collection.dart' show IterableExtension;
 import 'package:front_end/src/api_unstable/vm.dart'
     show
         CompilerOptions,
@@ -47,8 +46,8 @@
   final options = getFreshOptions();
 
   group('basic', () {
-    Directory mytest;
-    File main;
+    late Directory mytest;
+    late File main;
 
     setUpAll(() {
       mytest = Directory.systemTemp.createTempSync('incremental');
@@ -70,7 +69,7 @@
 
       final StringBuffer buffer = new StringBuffer();
       new Printer(buffer, showMetadata: true)
-          .writeLibraryFile(component.mainMethod.enclosingLibrary);
+          .writeLibraryFile(component.mainMethod!.enclosingLibrary);
       expect(
           buffer.toString(),
           equals('library /*isNonNullableByDefault*/;\n'
@@ -92,7 +91,7 @@
 
       final StringBuffer buffer = new StringBuffer();
       new Printer(buffer, showMetadata: true)
-          .writeLibraryFile(component.mainMethod.enclosingLibrary);
+          .writeLibraryFile(component.mainMethod!.enclosingLibrary);
       expect(
           buffer.toString(),
           equals('library /*isNonNullableByDefault*/;\n'
@@ -113,13 +112,13 @@
       await compiler.compile();
       compiler.accept();
       {
-        Procedure procedure = await compiler.compileExpression(
+        Procedure? procedure = await compiler.compileExpression(
             'main', <String>[], <String>[], main.uri.toString(), null, true);
         expect(procedure, isNotNull);
         expect(errorsReported, equals(0));
       }
       {
-        Procedure procedure = await compiler.compileExpression(
+        Procedure? procedure = await compiler.compileExpression(
             'main1', <String>[], <String>[], main.uri.toString(), null, true);
         expect(procedure, isNotNull);
         expect(errorsReported, equals(1));
@@ -138,7 +137,7 @@
   Future<Set<int>> collectAndCheckCoverageData(int port, bool getAllSources,
       {bool resume: true,
       bool onGetAllVerifyCount: true,
-      Set<int> coverageForLines}) async {
+      Set<int>? coverageForLines}) async {
     RemoteVm remoteVm = new RemoteVm(port);
 
     // Wait for the script to have finished.
@@ -177,7 +176,7 @@
     // Ensure that we can get a line and column number for all reported
     // positions in the scripts we care about.
     for (Map sourceReport in sourceReports) {
-      List scripts = sourceReport["scripts"];
+      List<Map> scripts = sourceReport["scripts"].cast<Map>();
       Map<String, int> scriptIdToIndex = new Map<String, int>();
       Set<int> lib1scriptIndices = new Set<int>();
       int i = 0;
@@ -201,9 +200,9 @@
       Map<int, Map> scriptIndexToScript = new Map<int, Map>();
       for (String scriptId in scriptIdToIndex.keys) {
         Map script = await remoteVm.getObject(scriptId);
-        int scriptIdx = scriptIdToIndex[scriptId];
+        int scriptIdx = scriptIdToIndex[scriptId]!;
         scriptIndexToScript[scriptIdx] = script;
-        List tokenPosTable = script["tokenPosTable"];
+        List? tokenPosTable = script["tokenPosTable"];
         if (tokenPosTable == null) {
           errorMessages.add("Script with uri ${script['uri']} "
               "and id ${script['id']} "
@@ -215,7 +214,7 @@
         }
       }
 
-      List ranges = sourceReport["ranges"];
+      List<Map> ranges = sourceReport["ranges"].cast<Map>();
       Set<int> scriptIndexesSet = new Set<int>.from(scriptIndexToScript.keys);
       for (Map range in ranges) {
         if (scriptIndexesSet.contains(range["scriptIndex"])) {
@@ -233,7 +232,7 @@
           if (range["possibleBreakpoints"] != null) {
             for (int pos in range["possibleBreakpoints"]) positions.add(pos);
           }
-          Map script = scriptIndexToScript[range["scriptIndex"]];
+          Map script = scriptIndexToScript[range["scriptIndex"]]!;
           Set<int> knownPositions = new Set<int>();
           Map<int, int> tokenPosToLine = {};
           if (script["tokenPosTable"] != null) {
@@ -256,7 +255,7 @@
           if (coverageForLines != null) {
             for (int pos in coverage["hits"]) {
               if (lib1scriptIndices.contains(range["scriptIndex"])) {
-                coverageForLines.add(tokenPosToLine[pos]);
+                coverageForLines.add(tokenPosToLine[pos]!);
               }
             }
           }
@@ -271,10 +270,10 @@
   }
 
   group('multiple kernels', () {
-    Directory mytest;
-    File main;
-    File lib;
-    Process vm;
+    late Directory mytest;
+    late File main;
+    late File lib;
+    late Process vm;
     setUpAll(() {
       mytest = Directory.systemTemp.createTempSync('incremental');
       main = new File('${mytest.path}/main.dart')..createSync();
@@ -485,8 +484,8 @@
           .listen((String s) async {
         if (s.startsWith(kObservatoryListening)) {
           expect(observatoryPortRegExp.hasMatch(s), isTrue);
-          final match = observatoryPortRegExp.firstMatch(s);
-          port = int.parse(match.group(1));
+          final match = observatoryPortRegExp.firstMatch(s)!;
+          port = int.parse(match.group(1)!);
           await collectAndCheckCoverageData(port, true);
           if (!portLineCompleter.isCompleted) {
             portLineCompleter.complete("done");
@@ -503,12 +502,12 @@
   });
 
   group('multiple kernels constant coverage', () {
-    Directory mytest;
-    File main;
-    File lib1;
-    int lineForUnnamedConstructor;
-    int lineForNamedConstructor;
-    Process vm;
+    late Directory mytest;
+    late File main;
+    late File lib1;
+    late int lineForUnnamedConstructor;
+    late int lineForNamedConstructor;
+    late Process vm;
     setUpAll(() {
       mytest = Directory.systemTemp.createTempSync('incremental');
       main = new File('${mytest.path}/main.dart')..createSync();
@@ -594,8 +593,8 @@
         }
         if (s.startsWith(kObservatoryListening)) {
           expect(observatoryPortRegExp.hasMatch(s), isTrue);
-          final match = observatoryPortRegExp.firstMatch(s);
-          port = int.parse(match.group(1));
+          final match = observatoryPortRegExp.firstMatch(s)!;
+          port = int.parse(match.group(1)!);
           await collectAndCheckCoverageData(port, true,
               onGetAllVerifyCount: false, coverageForLines: coverageLines);
           if (!portLineCompleter.isCompleted) {
@@ -740,11 +739,11 @@
   });
 
   group('multiple kernels 2', () {
-    Directory mytest;
-    File main;
-    File lib1;
-    File lib2;
-    Process vm;
+    late Directory mytest;
+    late File main;
+    late File lib1;
+    late File lib2;
+    late Process vm;
     setUpAll(() {
       mytest = Directory.systemTemp.createTempSync('incremental');
       main = new File('${mytest.path}/main.dart')..createSync();
@@ -849,8 +848,8 @@
           .listen((String s) async {
         if (s.startsWith(kObservatoryListening)) {
           expect(observatoryPortRegExp.hasMatch(s), isTrue);
-          final match = observatoryPortRegExp.firstMatch(s);
-          port = int.parse(match.group(1));
+          final match = observatoryPortRegExp.firstMatch(s)!;
+          port = int.parse(match.group(1)!);
           Set<int> hits1 =
               await collectAndCheckCoverageData(port, true, resume: false);
           Set<int> hits2 =
@@ -871,7 +870,7 @@
   });
 
   group('reload', () {
-    Directory mytest;
+    late Directory mytest;
 
     setUpAll(() {
       mytest = Directory.systemTemp.createTempSync('incremental');
@@ -941,8 +940,8 @@
       final RegExp observatoryPortRegExp =
           new RegExp("Observatory listening on http://127.0.0.1:\([0-9]*\)");
       expect(observatoryPortRegExp.hasMatch(portLine), isTrue);
-      final match = observatoryPortRegExp.firstMatch(portLine);
-      final port = int.parse(match.group(1));
+      final match = observatoryPortRegExp.firstMatch(portLine)!;
+      final port = int.parse(match.group(1)!);
 
       var remoteVm = new RemoteVm(port);
       await remoteVm.resume();
@@ -978,7 +977,7 @@
   });
 
   group('reject', () {
-    Directory mytest;
+    late Directory mytest;
     setUpAll(() {
       mytest = Directory.systemTemp.createTempSync('incremental_reject');
     });
@@ -1025,7 +1024,7 @@
       }
       compiler.accept();
       {
-        Procedure procedure = await compiler.compileExpression(
+        Procedure? procedure = await compiler.compileExpression(
             'a', <String>[], <String>[], 'package:foo/bar.dart', 'A', true);
         expect(procedure, isNotNull);
       }
@@ -1040,7 +1039,7 @@
       }
       await compiler.reject();
       {
-        Procedure procedure = await compiler.compileExpression(
+        Procedure? procedure = await compiler.compileExpression(
             'a', <String>[], <String>[], 'package:foo/bar.dart', 'A', true);
         expect(procedure, isNotNull);
       }
@@ -1088,9 +1087,8 @@
       }
       compiler.accept();
       {
-        final Procedure procedure = await compiler.compileExpression(
-            'a', <String>[], <String>[], barUri.toString(), 'A', true);
-        expect(procedure, isNotNull);
+        final Procedure procedure = (await compiler.compileExpression(
+            'a', <String>[], <String>[], barUri.toString(), 'A', true))!;
         // Verify that the expression only has links to the only bar we know
         // about.
         final LibraryReferenceCollector lrc = new LibraryReferenceCollector();
@@ -1107,8 +1105,8 @@
       compiler.invalidate(barUri);
       {
         final Component component = await compiler.compile(entryPoint: fooUri);
-        final Library fooLib2 = component.libraries
-            .firstWhere((lib) => lib.fileUri == fooUri, orElse: () => null);
+        final Library? fooLib2 = component.libraries
+            .firstWhereOrNull((lib) => lib.fileUri == fooUri);
         expect(fooLib2, isNull);
         final Library barLib2 =
             component.libraries.firstWhere((lib) => lib.fileUri == barUri);
@@ -1130,13 +1128,12 @@
         // Verify that the saved "last known good" compnent only contains links
         // to the original 'foo' and 'bar' libraries.
         final LibraryReferenceCollector lrc = new LibraryReferenceCollector();
-        compiler.lastKnownGoodComponent.accept(lrc);
+        compiler.lastKnownGoodComponent!.accept(lrc);
         expect(lrc.librariesReferenced, equals(<Library>{fooLib, barLib}));
       }
       {
-        final Procedure procedure = await compiler.compileExpression(
-            'a', <String>[], <String>[], barUri.toString(), 'A', true);
-        expect(procedure, isNotNull);
+        final Procedure procedure = (await compiler.compileExpression(
+            'a', <String>[], <String>[], barUri.toString(), 'A', true))!;
         // Verify that the expression only has links to the original bar.
         final LibraryReferenceCollector lrc = new LibraryReferenceCollector();
         procedure.accept(lrc);
@@ -1146,8 +1143,8 @@
   });
 
   group('expression evaluation', () {
-    Directory mytest;
-    Process vm;
+    late Directory mytest;
+    late Process vm;
 
     setUpAll(() {
       mytest = Directory.systemTemp.createTempSync('expression_evaluation');
@@ -1168,7 +1165,7 @@
 
     launchBreakAndEvaluate(File scriptOrDill, String scriptUriToBreakIn,
         int lineToBreakAt, List<String> expressionsAndExpectedResults,
-        {Future Function(RemoteVm remoteVm) callback}) async {
+        {Future Function(RemoteVm remoteVm)? callback}) async {
       vm = await Process.start(Platform.resolvedExecutable, <String>[
         "--pause-isolates-on-start",
         "--enable-vm-service:0",
@@ -1190,8 +1187,8 @@
         print("vm stdout: $s");
         if (s.startsWith(kObservatoryListening)) {
           expect(observatoryPortRegExp.hasMatch(s), isTrue);
-          final match = observatoryPortRegExp.firstMatch(s);
-          port = int.parse(match.group(1));
+          final match = observatoryPortRegExp.firstMatch(s)!;
+          port = int.parse(match.group(1)!);
           RemoteVm remoteVm = new RemoteVm(port);
 
           // Wait for the script to have loaded.
@@ -1591,7 +1588,7 @@
     RemoteVm remoteVm, String scriptUriToBreakIn, int lineToBreakAt) async {
   Map scriptsMap = await remoteVm.getScripts();
   List scripts = scriptsMap["scripts"];
-  String scriptId;
+  String? scriptId;
   for (int i = 0; i < scripts.length; i++) {
     Map script = scripts[i];
     String scriptUri = script["uri"];
@@ -1602,7 +1599,7 @@
   }
   expect(scriptId, isNotNull);
 
-  return await remoteVm.addBreakpoint(scriptId, lineToBreakAt);
+  return await remoteVm.addBreakpoint(scriptId!, lineToBreakAt);
 }
 
 Future deletePossibleBreakpoint(
@@ -1643,12 +1640,12 @@
   /// An peer point used to send service protocol messages. The service
   /// protocol uses JSON rpc on top of web-sockets.
   json_rpc.Peer get rpc => _rpc ??= _createPeer();
-  json_rpc.Peer _rpc;
+  json_rpc.Peer? _rpc;
 
   /// The main isolate ID of the running VM. Needed to indicate to the VM which
   /// isolate to reload.
   FutureOr<String> get mainId async => _mainId ??= await _computeMainId();
-  String _mainId;
+  String? _mainId;
 
   RemoteVm([this.port = 8181]);
 
@@ -1701,41 +1698,34 @@
     await rpc.sendRequest('resume', {'isolateId': id});
   }
 
-  Future getIsolate() async {
+  Future<Map> getIsolate() async {
     var id = await mainId;
-    return await rpc.sendRequest('getIsolate', {'isolateId': id});
+    return (await rpc.sendRequest('getIsolate', {'isolateId': id})) as Map;
   }
 
-  Future getScripts() async {
+  Future<Map> getScripts() async {
     var id = await mainId;
-    return await rpc.sendRequest('getScripts', {
+    return (await rpc.sendRequest('getScripts', {
       'isolateId': id,
-    });
+    })) as Map;
   }
 
-  Future getSourceReport([String scriptId]) async {
+  Future<Map> getSourceReport([String? scriptId]) async {
     var id = await mainId;
-    if (scriptId != null) {
-      return await rpc.sendRequest('getSourceReport', {
-        'isolateId': id,
-        'scriptId': scriptId,
-        'reports': ['Coverage', 'PossibleBreakpoints'],
-        'forceCompile': true
-      });
-    }
-    return await rpc.sendRequest('getSourceReport', {
+    return (await rpc.sendRequest('getSourceReport', {
       'isolateId': id,
+      if (scriptId != null) 'scriptId': scriptId,
       'reports': ['Coverage', 'PossibleBreakpoints'],
-      'forceCompile': true
-    });
+      'forceCompile': true,
+    })) as Map;
   }
 
-  Future getObject(String objectId) async {
+  Future<Map> getObject(String objectId) async {
     var id = await mainId;
-    return await rpc.sendRequest('getObject', {
+    return (await rpc.sendRequest('getObject', {
       'isolateId': id,
       'objectId': objectId,
-    });
+    })) as Map;
   }
 
   Future addBreakpoint(String scriptId, int line) async {
@@ -1769,21 +1759,22 @@
     int expectGcAfter = new DateTime.now().millisecondsSinceEpoch;
     while (true) {
       var id = await mainId;
-      Map result = await rpc.sendRequest('getAllocationProfile', {
+      Map result = (await rpc.sendRequest('getAllocationProfile', {
         'isolateId': id,
         "gc": true,
-      });
-      String lastGc = result["dateLastServiceGC"];
+      })) as Map;
+      String? lastGc = result["dateLastServiceGC"];
       if (lastGc != null && int.parse(lastGc) >= expectGcAfter) return;
     }
   }
 
   /// Close any connections used to communicate with the VM.
   Future disconnect() async {
-    if (_rpc == null) return null;
+    final rpc = this._rpc;
+    if (rpc == null) return null;
     this._mainId = null;
-    if (!_rpc.isClosed) {
-      var future = _rpc.close();
+    if (!rpc.isClosed) {
+      var future = rpc.close();
       _rpc = null;
       return future;
     }
diff --git a/pkg/vm/test/kernel_front_end_test.dart b/pkg/vm/test/kernel_front_end_test.dart
index 182ba38..effa84d 100644
--- a/pkg/vm/test/kernel_front_end_test.dart
+++ b/pkg/vm/test/kernel_front_end_test.dart
@@ -2,8 +2,6 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-// @dart=2.9
-
 import 'dart:io';
 
 import 'package:front_end/src/api_unstable/vm.dart'
@@ -22,14 +20,14 @@
 const String packagesFile = '.packages';
 const String packageConfigFile = '.dart_tool/package_config.json';
 
-void testCompile(List<String> args) async {
+Future<void> testCompile(List<String> args) async {
   final compilerExitCode =
       await runCompiler(createCompilerArgParser().parse(args), '');
   expect(compilerExitCode, successExitCode);
 }
 
 main() {
-  Directory tempDir;
+  late Directory tempDir;
   setUp(() {
     var systemTempDir = Directory.systemTemp;
     tempDir = systemTempDir.createTempSync('kernel_front_end_test');
diff --git a/pkg/vm/test/modular_kernel_plus_aot_test.dart b/pkg/vm/test/modular_kernel_plus_aot_test.dart
index 95354c9..c853b01 100644
--- a/pkg/vm/test/modular_kernel_plus_aot_test.dart
+++ b/pkg/vm/test/modular_kernel_plus_aot_test.dart
@@ -2,8 +2,6 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-// @dart=2.9
-
 import 'dart:async';
 import 'dart:io';
 import 'dart:typed_data';
@@ -35,14 +33,14 @@
   await withTempDirectory((Uri uri) async {
     final mixinFilename = uri.resolve('mixin.dart');
     final mixinDillFilename = uri.resolve('mixin.dart.dill');
-    await File.fromUri(mixinFilename).writeAsStringSync(mixinFile);
+    File.fromUri(mixinFilename).writeAsStringSync(mixinFile);
 
     await compileToKernel(vmTarget, librariesFile, sdkSummary, packagesFile,
         mixinDillFilename, <Uri>[mixinFilename], <Uri>[]);
 
     final mainFilename = uri.resolve('main.dart');
     final mainDillFilename = uri.resolve('main.dart.dill');
-    await File.fromUri(mainFilename).writeAsStringSync(mainFile);
+    File.fromUri(mainFilename).writeAsStringSync(mainFile);
 
     await compileToKernel(vmTarget, librariesFile, sdkSummary, packagesFile,
         mainDillFilename, <Uri>[mainFilename], <Uri>[mixinDillFilename]);
@@ -98,9 +96,9 @@
     message.plainTextFormatted.forEach(print);
   }
 
-  final Component component =
+  final Component? component =
       await fe.compileComponent(state, sources, onDiagnostic);
-  final Uint8List kernel = fe.serializeComponent(component,
+  final Uint8List kernel = fe.serializeComponent(component!,
       filter: (library) => sources.contains(library.importUri));
   await File(outputFile.toFilePath()).writeAsBytes(kernel);
 }
diff --git a/pkg/vm/test/transformations/deferred_loading_test.dart b/pkg/vm/test/transformations/deferred_loading_test.dart
index 88e8ee2..f36b610 100644
--- a/pkg/vm/test/transformations/deferred_loading_test.dart
+++ b/pkg/vm/test/transformations/deferred_loading_test.dart
@@ -2,8 +2,6 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-// @dart=2.9
-
 import 'dart:io';
 
 import 'package:kernel/target/targets.dart';
diff --git a/pkg/vm/test/transformations/protobuf_aware_treeshaker/treeshaker_test.dart b/pkg/vm/test/transformations/protobuf_aware_treeshaker/treeshaker_test.dart
index cf39848..741c2b9 100644
--- a/pkg/vm/test/transformations/protobuf_aware_treeshaker/treeshaker_test.dart
+++ b/pkg/vm/test/transformations/protobuf_aware_treeshaker/treeshaker_test.dart
@@ -2,8 +2,6 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-// @dart=2.9
-
 import 'dart:io';
 
 import 'package:kernel/target/targets.dart';
@@ -38,7 +36,7 @@
       .expand(
         (lib) => lib.classes.where((klass) =>
             klass.superclass != null &&
-            klass.superclass.name == "GeneratedMessage"),
+            klass.superclass!.name == "GeneratedMessage"),
       )
       .toList();
 
diff --git a/pkg/vm/test/transformations/to_string_transformer_test.dart b/pkg/vm/test/transformations/to_string_transformer_test.dart
index 936f13f..34f775f 100644
--- a/pkg/vm/test/transformations/to_string_transformer_test.dart
+++ b/pkg/vm/test/transformations/to_string_transformer_test.dart
@@ -2,8 +2,6 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-// @dart=2.9
-
 import 'dart:io';
 
 import 'package:kernel/ast.dart';
@@ -29,7 +27,7 @@
   transformComponent(component, packageUris);
   verifyComponent(component);
 
-  final actual = kernelLibraryToString(component.mainMethod.enclosingLibrary);
+  final actual = kernelLibraryToString(component.mainMethod!.enclosingLibrary);
 
   compareResultWithExpectationsFile(
       testCasesUri.resolve(expectationName), actual);
diff --git a/pkg/vm/test/transformations/type_flow/summary_collector_test.dart b/pkg/vm/test/transformations/type_flow/summary_collector_test.dart
index 2e25344..09831bd8 100644
--- a/pkg/vm/test/transformations/type_flow/summary_collector_test.dart
+++ b/pkg/vm/test/transformations/type_flow/summary_collector_test.dart
@@ -2,8 +2,6 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-// @dart=2.9
-
 import 'dart:io';
 
 import 'package:kernel/ast.dart';
@@ -64,7 +62,7 @@
 }
 
 class PrintSummaries extends RecursiveVisitor {
-  SummaryCollector _summaryCollector;
+  late SummaryCollector _summaryCollector;
   final StringBuffer _buf = new StringBuffer();
 
   PrintSummaries(Target target, TypeEnvironment environment,
@@ -77,12 +75,12 @@
         new FakeEntryPointsListener(typesBuilder),
         typesBuilder,
         new NativeCodeOracle(
-            null, new ConstantPragmaAnnotationParser(coreTypes)),
+            coreTypes.index, new ConstantPragmaAnnotationParser(coreTypes)),
         new GenericInterfacesInfoImpl(coreTypes, hierarchy),
         /*_protobufHandler=*/ null);
   }
 
-  String print(TreeNode node) {
+  String print(Library node) {
     visitLibrary(node);
     return _buf.toString();
   }
@@ -101,10 +99,11 @@
 runTestCase(Uri source) async {
   final Target target = new TestingVmTarget(new TargetFlags());
   final Component component = await compileTestCaseToKernelProgram(source);
-  final Library library = component.mainMethod.enclosingLibrary;
+  final Library library = component.mainMethod!.enclosingLibrary;
   final CoreTypes coreTypes = new CoreTypes(component);
 
-  final ClassHierarchy hierarchy = new ClassHierarchy(component, coreTypes);
+  final ClosedWorldClassHierarchy hierarchy =
+      new ClassHierarchy(component, coreTypes) as ClosedWorldClassHierarchy;
   final typeEnvironment = new TypeEnvironment(coreTypes, hierarchy);
 
   final actual =
diff --git a/pkg/vm/test/transformations/type_flow/transformer_test.dart b/pkg/vm/test/transformations/type_flow/transformer_test.dart
index 9735223..507cb4b 100644
--- a/pkg/vm/test/transformations/type_flow/transformer_test.dart
+++ b/pkg/vm/test/transformations/type_flow/transformer_test.dart
@@ -2,8 +2,6 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-// @dart=2.9
-
 import 'dart:io';
 
 import 'package:kernel/target/targets.dart';
@@ -33,7 +31,7 @@
       matcher: new ConstantPragmaAnnotationParser(coreTypes),
       treeShakeProtobufs: true);
 
-  String actual = kernelLibraryToString(component.mainMethod.enclosingLibrary);
+  String actual = kernelLibraryToString(component.mainMethod!.enclosingLibrary);
 
   // Tests in /protobuf_handler consist of multiple libraries.
   // Include libraries with protobuf generated messages into the result.
@@ -55,7 +53,7 @@
   ensureKernelCanBeSerializedToBinary(component);
 }
 
-String argsTestName(List<String> args) {
+String? argsTestName(List<String> args) {
   if (args.length > 0) {
     return args.last;
   }
diff --git a/pkg/vm/test/transformations/type_flow/types_test.dart b/pkg/vm/test/transformations/type_flow/types_test.dart
index 3a9987c..203700be 100644
--- a/pkg/vm/test/transformations/type_flow/types_test.dart
+++ b/pkg/vm/test/transformations/type_flow/types_test.dart
@@ -2,8 +2,6 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-// @dart=2.9
-
 import 'dart:core' hide Type;
 
 import 'package:kernel/ast.dart';
@@ -23,15 +21,12 @@
 
   @override
   bool isSubtype(Class sub, Class sup) {
-    return subtypes[sup].contains(sub);
+    return subtypes[sup]!.contains(sub);
   }
 
   @override
   Type specializeTypeCone(TFClass base, {bool allowWideCone = false}) {
-    Type result = specializations[base.classNode];
-    expect(result, isNotNull,
-        reason: "specializeTypeCone($base) is not defined");
-    return result;
+    return specializations[base.classNode]!;
   }
 
   @override
@@ -104,10 +99,10 @@
   test('union-intersection', () {
     // T1 <: T3, T2 <: T3
 
-    final c1 = new Class(name: 'T1', fileUri: dummyUri);
-    final c2 = new Class(name: 'T2', fileUri: dummyUri);
-    final c3 = new Class(name: 'T3', fileUri: dummyUri);
-    final c4 = new Class(name: 'T4', fileUri: dummyUri);
+    final c1 = new Class(name: 'T1', fileUri: dummyUri)..parent = dummyLibrary;
+    final c2 = new Class(name: 'T2', fileUri: dummyUri)..parent = dummyLibrary;
+    final c3 = new Class(name: 'T3', fileUri: dummyUri)..parent = dummyLibrary;
+    final c4 = new Class(name: 'T4', fileUri: dummyUri)..parent = dummyLibrary;
 
     final tfc1 = new TFClass(1, c1);
     final tfc2 = new TFClass(2, c2);
@@ -295,9 +290,9 @@
   });
 
   test('hashcode-equals', () {
-    final c1 = new Class(name: 'C1', fileUri: dummyUri);
-    final c2 = new Class(name: 'C2', fileUri: dummyUri);
-    final c3 = new Class(name: 'C3', fileUri: dummyUri);
+    final c1 = new Class(name: 'C1', fileUri: dummyUri)..parent = dummyLibrary;
+    final c2 = new Class(name: 'C2', fileUri: dummyUri)..parent = dummyLibrary;
+    final c3 = new Class(name: 'C3', fileUri: dummyUri)..parent = dummyLibrary;
 
     final tfc1 = new TFClass(1, c1);
     final tfc2 = new TFClass(2, c2);
diff --git a/pkg/vm/test/transformations/unreachable_code_elimination_test.dart b/pkg/vm/test/transformations/unreachable_code_elimination_test.dart
index 7330168..c433611 100644
--- a/pkg/vm/test/transformations/unreachable_code_elimination_test.dart
+++ b/pkg/vm/test/transformations/unreachable_code_elimination_test.dart
@@ -2,8 +2,6 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-// @dart=2.9
-
 import 'dart:io';
 
 import 'package:kernel/target/targets.dart';
@@ -30,7 +28,7 @@
   component = transformComponent(component, /* enableAsserts = */ false);
   verifyComponent(component);
 
-  final actual = kernelLibraryToString(component.mainMethod.enclosingLibrary);
+  final actual = kernelLibraryToString(component.mainMethod!.enclosingLibrary);
 
   compareResultWithExpectationsFile(source, actual);
 }
diff --git a/pkg/vm/test/unlinked_ast_to_text_test.dart b/pkg/vm/test/unlinked_ast_to_text_test.dart
index 49f8529..8b03a2c 100644
--- a/pkg/vm/test/unlinked_ast_to_text_test.dart
+++ b/pkg/vm/test/unlinked_ast_to_text_test.dart
@@ -2,8 +2,6 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-// @dart=2.9
-
 import 'dart:io';
 
 import 'package:args/args.dart';
diff --git a/pkg/vm/testcases/transformations/type_flow/transformer/protobuf_handler/lib/create_test.dart.expect b/pkg/vm/testcases/transformations/type_flow/transformer/protobuf_handler/lib/create_test.dart.expect
index 61123f8..55a1b78 100644
--- a/pkg/vm/testcases/transformations/type_flow/transformer/protobuf_handler/lib/create_test.dart.expect
+++ b/pkg/vm/testcases/transformations/type_flow/transformer/protobuf_handler/lib/create_test.dart.expect
@@ -38,7 +38,7 @@
 [@vm.inferred-type.metadata=protobuf::BuilderInfo?]  static final field pro::BuilderInfo _i = let final pro::BuilderInfo #t1 = new pro::BuilderInfo::•((#C1) ?{core::String} "" : "FooKeep") in block {
     [@vm.direct-call.metadata=protobuf::BuilderInfo.aOM] [@vm.inferred-type.metadata=!? (skip check)] #t1.{pro::BuilderInfo::aOM}<self::BarKeep>(1, (#C1) ?{core::String} "" : "barKeep", "barKeep", #C2){(core::int, core::String, {protoName: core::String?, subBuilder: () →? self::BarKeep}) → void};
     [@vm.direct-call.metadata=protobuf::BuilderInfo.add] [@vm.inferred-type.metadata=!? (skip check)] #t1.{pro::BuilderInfo::add}<Null>(0, null, null, null, null, null, null){(core::int, core::String, core::int?, dynamic, () →? pro::GeneratedMessage, (core::int) →? pro::ProtobufEnum?, core::List<pro::ProtobufEnum>?, {protoName: core::String?}) → void};
-    [@vm.direct-call.metadata=protobuf::BuilderInfo.m] [@vm.inferred-type.metadata=!? (skip check)] #t1.{pro::BuilderInfo::m}<core::String, self::BarKeep>((#C1) ?{core::String} "" : "mapKeep", #C2){(core::int, core::String, {entryClassName: core::String?, enumValues: core::List<pro::ProtobufEnum>?, keyFieldType: core::int?, packageName: pro::PackageName, protoName: core::String?, valueCreator: () →? pro::GeneratedMessage, valueFieldType: core::int?, valueOf: (core::int) →? pro::ProtobufEnum?}) → void};
+    [@vm.direct-call.metadata=protobuf::BuilderInfo.m] [@vm.inferred-type.metadata=!? (skip check)] #t1.{pro::BuilderInfo::m}<core::String, self::BarKeep>((#C1) ?{core::String} "" : "mapKeep", #C2){(core::int, core::String, {defaultEnumValue: pro::ProtobufEnum?, entryClassName: core::String?, enumValues: core::List<pro::ProtobufEnum>?, keyFieldType: core::int?, packageName: pro::PackageName, protoName: core::String?, valueCreator: () →? pro::GeneratedMessage, valueFieldType: core::int?, valueOf: (core::int) →? pro::ProtobufEnum?}) → void};
     [@vm.direct-call.metadata=protobuf::BuilderInfo.add] [@vm.inferred-type.metadata=!? (skip check)] #t1.{pro::BuilderInfo::add}<Null>(0, null, null, null, null, null, null){(core::int, core::String, core::int?, dynamic, () →? pro::GeneratedMessage, (core::int) →? pro::ProtobufEnum?, core::List<pro::ProtobufEnum>?, {protoName: core::String?}) → void};
     [@vm.direct-call.metadata=protobuf::BuilderInfo.a] [@vm.inferred-type.metadata=!? (skip check)] #t1.{pro::BuilderInfo::a}<core::int>(5, (#C1) ?{core::String} "" : "aKeep"){(core::int, core::String, core::int, {defaultOrMaker: dynamic, enumValues: core::List<pro::ProtobufEnum>?, protoName: core::String?, subBuilder: () →? pro::GeneratedMessage, valueOf: (core::int) →? pro::ProtobufEnum?}) → void};
     [@vm.direct-call.metadata=protobuf::BuilderInfo.aOM] [@vm.inferred-type.metadata=!? (skip check)] #t1.{pro::BuilderInfo::aOM}<self::HasKeep>(6, (#C1) ?{core::String} "" : "hasKeep", "hasKeep", #C3){(core::int, core::String, {protoName: core::String?, subBuilder: () →? self::HasKeep}) → void};
diff --git a/pkg/vm/testcases/transformations/type_flow/transformer/protobuf_handler/lib/decode_test.dart.expect b/pkg/vm/testcases/transformations/type_flow/transformer/protobuf_handler/lib/decode_test.dart.expect
index 7bbb164..9dd85ff 100644
--- a/pkg/vm/testcases/transformations/type_flow/transformer/protobuf_handler/lib/decode_test.dart.expect
+++ b/pkg/vm/testcases/transformations/type_flow/transformer/protobuf_handler/lib/decode_test.dart.expect
@@ -31,7 +31,7 @@
 [@vm.inferred-type.metadata=protobuf::BuilderInfo?]  static final field pro::BuilderInfo _i = let final pro::BuilderInfo #t1 = new pro::BuilderInfo::•((#C1) ?{core::String} "" : "FooKeep", createEmptyInstance: #C2) in block {
     [@vm.direct-call.metadata=protobuf::BuilderInfo.aOM] [@vm.inferred-type.metadata=!? (skip check)] #t1.{pro::BuilderInfo::aOM}<self::BarKeep>(1, (#C1) ?{core::String} "" : "barKeep", "barKeep", #C3){(core::int, core::String, {protoName: core::String?, subBuilder: () →? self::BarKeep}) → void};
     [@vm.direct-call.metadata=protobuf::BuilderInfo.add] [@vm.inferred-type.metadata=!? (skip check)] #t1.{pro::BuilderInfo::add}<Null>(0, null, null, null, null, null, null){(core::int, core::String, core::int?, dynamic, () →? pro::GeneratedMessage, (core::int) →? pro::ProtobufEnum?, core::List<pro::ProtobufEnum>?, {protoName: core::String?}) → void};
-    [@vm.direct-call.metadata=protobuf::BuilderInfo.m] [@vm.inferred-type.metadata=!? (skip check)] #t1.{pro::BuilderInfo::m}<core::String, self::BarKeep>((#C1) ?{core::String} "" : "mapKeep", #C3){(core::int, core::String, {entryClassName: core::String?, enumValues: core::List<pro::ProtobufEnum>?, keyFieldType: core::int?, packageName: pro::PackageName, protoName: core::String?, valueCreator: () →? pro::GeneratedMessage, valueFieldType: core::int?, valueOf: (core::int) →? pro::ProtobufEnum?}) → void};
+    [@vm.direct-call.metadata=protobuf::BuilderInfo.m] [@vm.inferred-type.metadata=!? (skip check)] #t1.{pro::BuilderInfo::m}<core::String, self::BarKeep>((#C1) ?{core::String} "" : "mapKeep", #C3){(core::int, core::String, {defaultEnumValue: pro::ProtobufEnum?, entryClassName: core::String?, enumValues: core::List<pro::ProtobufEnum>?, keyFieldType: core::int?, packageName: pro::PackageName, protoName: core::String?, valueCreator: () →? pro::GeneratedMessage, valueFieldType: core::int?, valueOf: (core::int) →? pro::ProtobufEnum?}) → void};
     [@vm.direct-call.metadata=protobuf::BuilderInfo.add] [@vm.inferred-type.metadata=!? (skip check)] #t1.{pro::BuilderInfo::add}<Null>(0, null, null, null, null, null, null){(core::int, core::String, core::int?, dynamic, () →? pro::GeneratedMessage, (core::int) →? pro::ProtobufEnum?, core::List<pro::ProtobufEnum>?, {protoName: core::String?}) → void};
     [@vm.direct-call.metadata=protobuf::BuilderInfo.a] [@vm.inferred-type.metadata=!? (skip check)] #t1.{pro::BuilderInfo::a}<core::int>(5, (#C1) ?{core::String} "" : "aKeep"){(core::int, core::String, core::int, {defaultOrMaker: dynamic, enumValues: core::List<pro::ProtobufEnum>?, protoName: core::String?, subBuilder: () →? pro::GeneratedMessage, valueOf: (core::int) →? pro::ProtobufEnum?}) → void};
     [@vm.direct-call.metadata=protobuf::BuilderInfo.aOM] [@vm.inferred-type.metadata=!? (skip check)] #t1.{pro::BuilderInfo::aOM}<self::HasKeep>(6, (#C1) ?{core::String} "" : "hasKeep", "hasKeep", #C4){(core::int, core::String, {protoName: core::String?, subBuilder: () →? self::HasKeep}) → void};
diff --git a/pkg/vm/testcases/transformations/type_flow/transformer/protobuf_handler/lib/encode_all_fields.dart.expect b/pkg/vm/testcases/transformations/type_flow/transformer/protobuf_handler/lib/encode_all_fields.dart.expect
index 659128b..f925ae6 100644
--- a/pkg/vm/testcases/transformations/type_flow/transformer/protobuf_handler/lib/encode_all_fields.dart.expect
+++ b/pkg/vm/testcases/transformations/type_flow/transformer/protobuf_handler/lib/encode_all_fields.dart.expect
@@ -45,8 +45,8 @@
 [@vm.inferred-type.metadata=protobuf::BuilderInfo?]  static final field pro::BuilderInfo _i = let final pro::BuilderInfo #t1 = new pro::BuilderInfo::•((#C1) ?{core::String} "" : "FooKeep") in block {
     [@vm.direct-call.metadata=protobuf::BuilderInfo.aOM] [@vm.inferred-type.metadata=!? (skip check)] #t1.{pro::BuilderInfo::aOM}<self::BarKeep>(1, (#C1) ?{core::String} "" : "barKeep", "barKeep", #C2){(core::int, core::String, {protoName: core::String?, subBuilder: () →? self::BarKeep}) → void};
     [@vm.direct-call.metadata=protobuf::BuilderInfo.add] [@vm.inferred-type.metadata=!? (skip check)] #t1.{pro::BuilderInfo::add}<Null>(0, null, null, null, null, null, null){(core::int, core::String, core::int?, dynamic, () →? pro::GeneratedMessage, (core::int) →? pro::ProtobufEnum?, core::List<pro::ProtobufEnum>?, {protoName: core::String?}) → void};
-    [@vm.direct-call.metadata=protobuf::BuilderInfo.m] [@vm.inferred-type.metadata=!? (skip check)] #t1.{pro::BuilderInfo::m}<core::String, self::BarKeep>(3, (#C1) ?{core::String} "" : "mapKeep", "FooKeep.MapKeepEntry", "mapKeep", #C2){(core::int, core::String, {entryClassName: core::String?, enumValues: core::List<pro::ProtobufEnum>?, keyFieldType: core::int?, packageName: pro::PackageName, protoName: core::String?, valueCreator: () →? pro::GeneratedMessage, valueFieldType: core::int?, valueOf: (core::int) →? pro::ProtobufEnum?}) → void};
-    [@vm.direct-call.metadata=protobuf::BuilderInfo.m] [@vm.inferred-type.metadata=!? (skip check)] #t1.{pro::BuilderInfo::m}<core::String, self::ZopDrop>(4, (#C1) ?{core::String} "" : "mapDrop", "FooKeep.MapDropEntry", "mapDrop", #C3){(core::int, core::String, {entryClassName: core::String?, enumValues: core::List<pro::ProtobufEnum>?, keyFieldType: core::int?, packageName: pro::PackageName, protoName: core::String?, valueCreator: () →? pro::GeneratedMessage, valueFieldType: core::int?, valueOf: (core::int) →? pro::ProtobufEnum?}) → void};
+    [@vm.direct-call.metadata=protobuf::BuilderInfo.m] [@vm.inferred-type.metadata=!? (skip check)] #t1.{pro::BuilderInfo::m}<core::String, self::BarKeep>(3, (#C1) ?{core::String} "" : "mapKeep", "FooKeep.MapKeepEntry", "mapKeep", #C2){(core::int, core::String, {defaultEnumValue: pro::ProtobufEnum?, entryClassName: core::String?, enumValues: core::List<pro::ProtobufEnum>?, keyFieldType: core::int?, packageName: pro::PackageName, protoName: core::String?, valueCreator: () →? pro::GeneratedMessage, valueFieldType: core::int?, valueOf: (core::int) →? pro::ProtobufEnum?}) → void};
+    [@vm.direct-call.metadata=protobuf::BuilderInfo.m] [@vm.inferred-type.metadata=!? (skip check)] #t1.{pro::BuilderInfo::m}<core::String, self::ZopDrop>(4, (#C1) ?{core::String} "" : "mapDrop", "FooKeep.MapDropEntry", "mapDrop", #C3){(core::int, core::String, {defaultEnumValue: pro::ProtobufEnum?, entryClassName: core::String?, enumValues: core::List<pro::ProtobufEnum>?, keyFieldType: core::int?, packageName: pro::PackageName, protoName: core::String?, valueCreator: () →? pro::GeneratedMessage, valueFieldType: core::int?, valueOf: (core::int) →? pro::ProtobufEnum?}) → void};
     [@vm.direct-call.metadata=protobuf::BuilderInfo.a] [@vm.inferred-type.metadata=!? (skip check)] #t1.{pro::BuilderInfo::a}<core::int>(5, (#C1) ?{core::String} "" : "aKeep", "aKeep"){(core::int, core::String, core::int, {defaultOrMaker: dynamic, enumValues: core::List<pro::ProtobufEnum>?, protoName: core::String?, subBuilder: () →? pro::GeneratedMessage, valueOf: (core::int) →? pro::ProtobufEnum?}) → void};
     [@vm.direct-call.metadata=protobuf::BuilderInfo.aOM] [@vm.inferred-type.metadata=!? (skip check)] #t1.{pro::BuilderInfo::aOM}<self::HasKeep>(6, (#C1) ?{core::String} "" : "hasKeep", "hasKeep", #C4){(core::int, core::String, {protoName: core::String?, subBuilder: () →? self::HasKeep}) → void};
     [@vm.direct-call.metadata=protobuf::BuilderInfo.aOM] [@vm.inferred-type.metadata=!? (skip check)] #t1.{pro::BuilderInfo::aOM}<self::ClearKeep>(7, (#C1) ?{core::String} "" : "clearKeep", "clearKeep", #C5){(core::int, core::String, {protoName: core::String?, subBuilder: () →? self::ClearKeep}) → void};
diff --git a/pkg/vm/testcases/transformations/type_flow/transformer/protobuf_handler/lib/freeze_test.dart.expect b/pkg/vm/testcases/transformations/type_flow/transformer/protobuf_handler/lib/freeze_test.dart.expect
index 05303d3..0071356 100644
--- a/pkg/vm/testcases/transformations/type_flow/transformer/protobuf_handler/lib/freeze_test.dart.expect
+++ b/pkg/vm/testcases/transformations/type_flow/transformer/protobuf_handler/lib/freeze_test.dart.expect
@@ -41,7 +41,7 @@
 [@vm.inferred-type.metadata=protobuf::BuilderInfo?]  static final field pro::BuilderInfo _i = let final pro::BuilderInfo #t1 = new pro::BuilderInfo::•((#C1) ?{core::String} "" : "FooKeep") in block {
     [@vm.direct-call.metadata=protobuf::BuilderInfo.aOM] [@vm.inferred-type.metadata=!? (skip check)] #t1.{pro::BuilderInfo::aOM}<self::BarKeep>(1, (#C1) ?{core::String} "" : "barKeep", "barKeep", #C2){(core::int, core::String, {protoName: core::String?, subBuilder: () →? self::BarKeep}) → void};
     [@vm.direct-call.metadata=protobuf::BuilderInfo.add] [@vm.inferred-type.metadata=!? (skip check)] #t1.{pro::BuilderInfo::add}<Null>(0, null, null, null, null, null, null){(core::int, core::String, core::int?, dynamic, () →? pro::GeneratedMessage, (core::int) →? pro::ProtobufEnum?, core::List<pro::ProtobufEnum>?, {protoName: core::String?}) → void};
-    [@vm.direct-call.metadata=protobuf::BuilderInfo.m] [@vm.inferred-type.metadata=!? (skip check)] #t1.{pro::BuilderInfo::m}<core::String, self::BarKeep>((#C1) ?{core::String} "" : "mapKeep", #C2){(core::int, core::String, {entryClassName: core::String?, enumValues: core::List<pro::ProtobufEnum>?, keyFieldType: core::int?, packageName: pro::PackageName, protoName: core::String?, valueCreator: () →? pro::GeneratedMessage, valueFieldType: core::int?, valueOf: (core::int) →? pro::ProtobufEnum?}) → void};
+    [@vm.direct-call.metadata=protobuf::BuilderInfo.m] [@vm.inferred-type.metadata=!? (skip check)] #t1.{pro::BuilderInfo::m}<core::String, self::BarKeep>((#C1) ?{core::String} "" : "mapKeep", #C2){(core::int, core::String, {defaultEnumValue: pro::ProtobufEnum?, entryClassName: core::String?, enumValues: core::List<pro::ProtobufEnum>?, keyFieldType: core::int?, packageName: pro::PackageName, protoName: core::String?, valueCreator: () →? pro::GeneratedMessage, valueFieldType: core::int?, valueOf: (core::int) →? pro::ProtobufEnum?}) → void};
     [@vm.direct-call.metadata=protobuf::BuilderInfo.add] [@vm.inferred-type.metadata=!? (skip check)] #t1.{pro::BuilderInfo::add}<Null>(0, null, null, null, null, null, null){(core::int, core::String, core::int?, dynamic, () →? pro::GeneratedMessage, (core::int) →? pro::ProtobufEnum?, core::List<pro::ProtobufEnum>?, {protoName: core::String?}) → void};
     [@vm.direct-call.metadata=protobuf::BuilderInfo.a] [@vm.inferred-type.metadata=!? (skip check)] #t1.{pro::BuilderInfo::a}<core::int>(5, (#C1) ?{core::String} "" : "aKeep"){(core::int, core::String, core::int, {defaultOrMaker: dynamic, enumValues: core::List<pro::ProtobufEnum>?, protoName: core::String?, subBuilder: () →? pro::GeneratedMessage, valueOf: (core::int) →? pro::ProtobufEnum?}) → void};
     [@vm.direct-call.metadata=protobuf::BuilderInfo.aOM] [@vm.inferred-type.metadata=!? (skip check)] #t1.{pro::BuilderInfo::aOM}<self::HasKeep>(6, (#C1) ?{core::String} "" : "hasKeep", "hasKeep", #C3){(core::int, core::String, {protoName: core::String?, subBuilder: () →? self::HasKeep}) → void};
diff --git a/pkg/vm_service/CHANGELOG.md b/pkg/vm_service/CHANGELOG.md
index d2a4144..3c1a964 100644
--- a/pkg/vm_service/CHANGELOG.md
+++ b/pkg/vm_service/CHANGELOG.md
@@ -1,12 +1,5 @@
 # Changelog
 
-## 7.2.0
-- Update to version `3.50` of the spec.
-- Added `CpuSamples` event kind, and `cpuSamples` property to `Event`.
-- Added `returnType`, `parameters`, and `typeParameters` to `InstanceRef`,
-  and `implicit` to `FunctionRef`.
-- Added `Parameter` type.
-
 ## 7.1.1
 - Update to version `3.48` of the spec.
 - Added `shows` and `hides` properties to `LibraryDependency`.
diff --git a/pkg/vm_service/pubspec.yaml b/pkg/vm_service/pubspec.yaml
index 5677862..5aad6b6 100644
--- a/pkg/vm_service/pubspec.yaml
+++ b/pkg/vm_service/pubspec.yaml
@@ -3,7 +3,7 @@
   A library to communicate with a service implementing the Dart VM
   service protocol.
 
-version: 7.2.0
+version: 7.1.1
 
 homepage: https://github.com/dart-lang/sdk/tree/master/pkg/vm_service
 
diff --git a/runtime/vm/benchmark_test.cc b/runtime/vm/benchmark_test.cc
index ee64cc5..e2a6869 100644
--- a/runtime/vm/benchmark_test.cc
+++ b/runtime/vm/benchmark_test.cc
@@ -256,8 +256,8 @@
 // Measure compile of all kernel Service(CFE) functions.
 //
 BENCHMARK(KernelServiceCompileAll) {
-  if (FLAG_sound_null_safety == kNullSafetyOptionStrong) {
-    // TODO(bkonyi): remove this check when we build the CFE in strong mode.
+  // kernel_service.dill is built with sound null safety.
+  if (FLAG_sound_null_safety != kNullSafetyOptionStrong) {
     return;
   }
   bin::Builtin::SetNativeResolver(bin::Builtin::kBuiltinLibrary);
diff --git a/runtime/vm/elf.cc b/runtime/vm/elf.cc
index 12210a4..a4f550f 100644
--- a/runtime/vm/elf.cc
+++ b/runtime/vm/elf.cc
@@ -228,7 +228,7 @@
  private:
   static intptr_t EncodeFlags(bool allocate, bool executable, bool writable) {
     // Executable and writable only make sense if this is an allocated section.
-    ASSERT(allocate || !executable && !writable);
+    ASSERT(allocate || (!executable && !writable));
     if (!allocate) return 0;
     intptr_t flags = elf::SHF_ALLOC;
     // We currently don't allow sections that are both executable and writable.
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index 9a718d1..2f5c24c 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -2500,25 +2500,6 @@
     ServiceIsolate::SendIsolateShutdownMessage();
 #if !defined(PRODUCT)
     debugger()->Shutdown();
-    // Cleanup profiler state.
-    SampleBlock* cpu_block = current_sample_block();
-    if (cpu_block != nullptr) {
-      cpu_block->release_block();
-    }
-    SampleBlock* allocation_block = current_allocation_sample_block();
-    if (allocation_block != nullptr) {
-      allocation_block->release_block();
-    }
-
-    // Process the previously assigned sample blocks if we're using the
-    // profiler's sample buffer. Some tests create their own SampleBlockBuffer
-    // and handle block processing themselves.
-    if ((cpu_block != nullptr || allocation_block != nullptr) &&
-        Profiler::sample_block_buffer() != nullptr) {
-      StackZone zone(thread);
-      HandleScope handle_scope(thread);
-      Profiler::sample_block_buffer()->ProcessCompletedBlocks();
-    }
 #endif
   }
 
@@ -2577,6 +2558,26 @@
   // requests anymore.
   Thread::ExitIsolate();
 
+#if !defined(PRODUCT)
+  // Cleanup profiler state.
+  SampleBlock* cpu_block = isolate->current_sample_block();
+  if (cpu_block != nullptr) {
+    cpu_block->release_block();
+  }
+  SampleBlock* allocation_block = isolate->current_allocation_sample_block();
+  if (allocation_block != nullptr) {
+    allocation_block->release_block();
+  }
+
+  // Process the previously assigned sample blocks if we're using the
+  // profiler's sample buffer. Some tests create their own SampleBlockBuffer
+  // and handle block processing themselves.
+  if ((cpu_block != nullptr || allocation_block != nullptr) &&
+      Profiler::sample_block_buffer() != nullptr) {
+    Profiler::sample_block_buffer()->ProcessCompletedBlocks();
+  }
+#endif  // !defined(PRODUCT)
+
   // Now it's safe to delete the isolate.
   delete isolate;
 
diff --git a/runtime/vm/kernel_isolate.cc b/runtime/vm/kernel_isolate.cc
index 1ba9c22..066c7d4 100644
--- a/runtime/vm/kernel_isolate.cc
+++ b/runtime/vm/kernel_isolate.cc
@@ -88,6 +88,7 @@
     Dart_IsolateFlags api_flags;
     Isolate::FlagsInitialize(&api_flags);
     api_flags.enable_asserts = false;
+    api_flags.null_safety = true;
     api_flags.is_system_isolate = true;
 #if !defined(DART_PRECOMPILER)
     api_flags.use_field_guards = true;
diff --git a/runtime/vm/object_graph_copy.cc b/runtime/vm/object_graph_copy.cc
index e22b3e6..7b9189f 100644
--- a/runtime/vm/object_graph_copy.cc
+++ b/runtime/vm/object_graph_copy.cc
@@ -115,7 +115,7 @@
 };
 
 struct HandleTypes {
-  using Object = const Object&;
+  using Object = const dart::Object&;
   static const dart::UntaggedObject* UntagObject(Object arg) {
     return arg.ptr().untag();
   }
@@ -123,7 +123,7 @@
   static Object HandlifyObject(Object arg) { return arg; }
 
 #define DO(V)                                                                  \
-  using V = const V&;                                                          \
+  using V = const dart::V&;                                                    \
   static Untagged##V* Untag##V(V arg) { return arg.ptr().untag(); }            \
   static V##Ptr Get##V##Ptr(V arg) { return arg.ptr(); }                       \
   static V Cast##V(const dart::Object& arg) { return dart::V::Cast(arg); }
@@ -1451,7 +1451,7 @@
 
   // Result will be [<msg>, <objects-in-msg-to-rehash>]
   ObjectPtr CopyObjectGraph(const Object& root) {
-    const char* exception_msg = nullptr;
+    const char* volatile exception_msg = nullptr;
     auto& result = Object::Handle(zone_);
 
     {
@@ -1491,7 +1491,7 @@
 
  private:
   ObjectPtr CopyObjectGraphInternal(const Object& root,
-                                    const char** exception_msg) {
+                                    const char* volatile* exception_msg) {
     const auto& result_array = Array::Handle(zone_, Array::New(2));
     if (!root.ptr()->IsHeapObject()) {
       result_array.SetAt(0, root);
@@ -1590,7 +1590,8 @@
       const intptr_t size = UntaggedObject::SizeTag::decode(tags);
       // External typed data is already initialized.
       if (!IsExternalTypedDataClassId(cid) && !IsTypedDataViewClassId(cid)) {
-        memset(to.untag(), 0x0, from.untag()->HeapSize());
+        memset(reinterpret_cast<void*>(to.untag()), 0,
+               from.untag()->HeapSize());
         SetNewSpaceTaggingWord(to, cid, size);
         UpdateLengthField(cid, from, to);
       }
diff --git a/runtime/vm/object_store.cc b/runtime/vm/object_store.cc
index dbc59c7..47e7abc 100644
--- a/runtime/vm/object_store.cc
+++ b/runtime/vm/object_store.cc
@@ -91,7 +91,20 @@
   return Error::null();
 }
 
-ObjectStore::ObjectStore() {
+ObjectStore::ObjectStore()
+    :
+#define EMIT_FIELD_INIT(type, name) name##_(nullptr),
+      OBJECT_STORE_FIELD_LIST(EMIT_FIELD_INIT,
+                              EMIT_FIELD_INIT,
+                              EMIT_FIELD_INIT,
+                              EMIT_FIELD_INIT,
+                              EMIT_FIELD_INIT,
+                              EMIT_FIELD_INIT,
+                              EMIT_FIELD_INIT,
+                              EMIT_FIELD_INIT)
+#undef EMIT_FIELD_INIT
+          unused_field_(0)  // Just to prevent a trailing comma.
+{
   for (ObjectPtr* current = from(); current <= to(); current++) {
     *current = Object::null();
   }
diff --git a/runtime/vm/object_store.h b/runtime/vm/object_store.h
index 8148bc2..64dabde 100644
--- a/runtime/vm/object_store.h
+++ b/runtime/vm/object_store.h
@@ -543,6 +543,7 @@
     UNREACHABLE();
     return NULL;
   }
+  uword unused_field_;
 
   friend class ProgramSerializationRoots;
   friend class ProgramDeserializationRoots;
diff --git a/runtime/vm/profiler.cc b/runtime/vm/profiler.cc
index f89ccf7..2436574 100644
--- a/runtime/vm/profiler.cc
+++ b/runtime/vm/profiler.cc
@@ -226,9 +226,7 @@
   int64_t start = Dart_TimelineGetMicros();
   for (intptr_t i = 0; i < capacity_; ++i) {
     SampleBlock* block = &blocks_[i];
-    // Only evict blocks owned by the current thread.
-    if (block->owner() == thread->isolate() && block->is_full() &&
-        !block->evictable()) {
+    if (block->is_full() && !block->evictable()) {
       if (Service::profiler_stream.enabled()) {
         Profile profile(block->owner());
         profile.Build(thread, nullptr, block);
@@ -332,13 +330,8 @@
     isolate->set_current_sample_block(next);
   }
   next->set_is_allocation_block(allocation_sample);
-  bool scheduled = can_process_block_.exchange(true);
-  // We don't process samples on the kernel isolate.
-  if (!isolate->is_kernel_isolate() &&
-      !isolate->is_service_isolate() &&
-      !scheduled) {
-    isolate->mutator_thread()->ScheduleInterrupts(Thread::kVMInterrupt);
-  }
+  can_process_block_.store(true);
+  isolate->mutator_thread()->ScheduleInterrupts(Thread::kVMInterrupt);
   return ReserveSampleImpl(isolate, allocation_sample);
 }
 
diff --git a/runtime/vm/thread.cc b/runtime/vm/thread.cc
index 74217b6..09a3b25 100644
--- a/runtime/vm/thread.cc
+++ b/runtime/vm/thread.cc
@@ -450,15 +450,11 @@
     }
 
 #if !defined(PRODUCT)
-    // Don't block the kernel isolate to process CPU samples as we can
-    // potentially deadlock when trying to compile source for the main isolate.
-    if (!isolate()->is_kernel_isolate() && !isolate()->is_service_isolate()) {
-      // Processes completed SampleBlocks and sends CPU sample events over the
-      // service protocol when applicable.
-      SampleBlockBuffer* sample_buffer = Profiler::sample_block_buffer();
-      if (sample_buffer != nullptr && sample_buffer->process_blocks()) {
-        sample_buffer->ProcessCompletedBlocks();
-      }
+    // Processes completed SampleBlocks and sends CPU sample events over the
+    // service protocol when applicable.
+    SampleBlockBuffer* sample_buffer = Profiler::sample_block_buffer();
+    if (sample_buffer != nullptr && sample_buffer->process_blocks()) {
+      sample_buffer->ProcessCompletedBlocks();
     }
 #endif  // !defined(PRODUCT)
   }
diff --git a/sdk/lib/async/future.dart b/sdk/lib/async/future.dart
index 2952ad3..555bc3d 100644
--- a/sdk/lib/async/future.dart
+++ b/sdk/lib/async/future.dart
@@ -719,7 +719,7 @@
 /// are *expected* to complete with a value.
 /// You can use [FutureExtensions.ignore] if you also don't want to know
 /// about errors from this future.
-@Since("2.15")
+@Since("2.14")
 void unawaited(Future<void> future) {}
 
 /// Convenience methods on futures.
@@ -809,7 +809,7 @@
   /// If you merely want to silence the ["unawaited futures" lint](https://dart-lang.github.io/linter/lints/unawaited_futures.html),
   /// use the [unawaited] function instead.
   /// That will ensure that an unexpected error is still reported.
-  @Since("2.15")
+  @Since("2.14")
   void ignore() {
     var self = this;
     if (self is _Future<T>) {
diff --git a/tests/standalone/io/file_fuzz_test.dart b/tests/standalone/io/file_fuzz_test.dart
index 813a2bf..bfcb7c9 100644
--- a/tests/standalone/io/file_fuzz_test.dart
+++ b/tests/standalone/io/file_fuzz_test.dart
@@ -10,119 +10,122 @@
 import 'dart:io';
 
 import 'fuzz_support.dart';
+import 'file_write_only_test.dart' show withTempDir, withTempDirSync;
 
 import "package:async_helper/async_helper.dart";
 
 fuzzSyncMethods() {
-  var temp = Directory.systemTemp.createTempSync('dart_file_fuzz');
-  typeMapping.forEach((k, v) {
-    File? file;
-    doItSync(() => file = new File('${temp.path}/${v as String}'));
-    if (file == null) return;
-    final f = file!;
-    doItSync(f.existsSync);
-    doItSync(f.createSync);
-    doItSync(f.deleteSync);
-    doItSync(f.lengthSync);
-    doItSync(f.lastModifiedSync);
-    doItSync(() => f.path);
-    doItSync(() => f.openRead().listen((_) {}, onError: (e) {}));
-    doItSync(f.readAsBytesSync);
-    doItSync(f.readAsStringSync);
-    doItSync(f.readAsLinesSync);
-    typeMapping.forEach((k2, v2) {
-      doItSync(() => f.openSync(mode: v2 as FileMode));
-      doItSync(() => f.openWrite(mode: v2 as FileMode));
-      doItSync(() => f.readAsStringSync(encoding: v2 as Encoding));
-      doItSync(() => f.readAsLinesSync(encoding: v2 as Encoding));
+  withTempDirSync('dart_file_fuzz', (temp) {
+    typeMapping.forEach((k, v) {
+      File? file;
+      doItSync(() => file = new File('${temp.path}/${v as String}'));
+      if (file == null) return;
+      final f = file!;
+      doItSync(f.existsSync);
+      doItSync(f.createSync);
+      doItSync(f.deleteSync);
+      doItSync(f.lengthSync);
+      doItSync(f.lastModifiedSync);
+      doItSync(() => f.path);
+      doItSync(() => f.openRead().listen((_) {}, onError: (e) {}));
+      doItSync(f.readAsBytesSync);
+      doItSync(f.readAsStringSync);
+      doItSync(f.readAsLinesSync);
+      typeMapping.forEach((k2, v2) {
+        doItSync(() => f.openSync(mode: v2 as FileMode));
+        doItSync(() => f.openWrite(mode: v2 as FileMode));
+        doItSync(() => f.readAsStringSync(encoding: v2 as Encoding));
+        doItSync(() => f.readAsLinesSync(encoding: v2 as Encoding));
+      });
     });
   });
-  temp.deleteSync(recursive: true);
 }
 
-fuzzAsyncMethods() {
+fuzzAsyncMethods() async {
   asyncStart();
-  var futures = <Future>[];
-  var temp = Directory.systemTemp.createTempSync('dart_file_fuzz');
-  typeMapping.forEach((k, v) {
-    File? file;
-    doItSync(() => file = new File('${temp.path}/${v as String}'));
-    if (file == null) return;
-    final f = file!;
-    futures.add(doItAsync(f.exists));
-    futures.add(doItAsync(f.delete));
-    futures.add(doItAsync(() => f.parent));
-    futures.add(doItAsync(f.length));
-    futures.add(doItAsync(f.lastModified));
-    futures.add(doItAsync(f.open));
-    futures.add(doItAsync(() => f.path));
-    futures.add(doItAsync(f.readAsBytes));
-    futures.add(doItAsync(f.readAsLines));
-    futures.add(doItAsync(f.readAsString));
-    typeMapping.forEach((k2, v2) {
-      futures.add(doItAsync(() => f.open(mode: v2 as FileMode)));
-      futures.add(doItAsync(() => f.readAsString(encoding: v2 as Encoding)));
-      futures.add(doItAsync(() => f.readAsLines(encoding: v2 as Encoding)));
+  withTempDir('dart_file_fuzz', (temp) async {
+    final futures = <Future>[];
+    typeMapping.forEach((k, v) {
+      File? file;
+      doItSync(() => file = new File('${temp.path}/${v as String}'));
+      if (file == null) return;
+      final f = file!;
+      futures.add(doItAsync(f.exists));
+      futures.add(doItAsync(f.delete));
+      futures.add(doItAsync(() => f.parent));
+      futures.add(doItAsync(f.length));
+      futures.add(doItAsync(f.lastModified));
+      futures.add(doItAsync(f.open));
+      futures.add(doItAsync(() => f.path));
+      futures.add(doItAsync(f.readAsBytes));
+      futures.add(doItAsync(f.readAsLines));
+      futures.add(doItAsync(f.readAsString));
+      typeMapping.forEach((k2, v2) {
+        futures.add(doItAsync(() => f.open(mode: v2 as FileMode)));
+        futures.add(doItAsync(() => f.readAsString(encoding: v2 as Encoding)));
+        futures.add(doItAsync(() => f.readAsLines(encoding: v2 as Encoding)));
+      });
     });
-  });
-  Future.wait(futures).then((_) {
-    temp.deleteSync(recursive: true);
-    asyncEnd();
+    await Future.wait(futures).then((_) {
+      asyncEnd();
+    });
   });
 }
 
 fuzzSyncRandomAccessMethods() {
-  var temp = Directory.systemTemp.createTempSync('dart_file_fuzz');
-  var file = new File('${temp.path}/x');
-  file.createSync();
-  var modes = [FileMode.read, FileMode.write, FileMode.append];
-  for (var m in modes) {
-    var opened = file.openSync(mode: m);
-    typeMapping.forEach((k, v) {
-      doItSync(() => opened.setPositionSync(v as int));
-      doItSync(() => opened.truncateSync(v as int));
-      doItSync(() => opened.writeByteSync(v as int));
-    });
-    for (var p in typePermutations(2)) {
-      doItSync(() => opened.writeStringSync(p[0], encoding: p[1]));
-    }
-    for (var p in typePermutations(3)) {
-      doItSync(() => opened.readIntoSync(p[0], p[1], p[2]));
-      doItSync(() => opened.writeFromSync(p[0], p[1], p[2]));
-    }
-    opened.closeSync();
-  }
-  temp.deleteSync(recursive: true);
-}
-
-fuzzAsyncRandomAccessMethods() {
-  var temp = Directory.systemTemp.createTempSync('dart_file_fuzz');
-  var file = new File('${temp.path}/x');
-  file.createSync();
-  var modes = [FileMode.read, FileMode.write, FileMode.append];
-  var futures = <Future>[];
-  var openedFiles = [];
-  for (var m in modes) {
-    var opened = file.openSync(mode: m);
-    openedFiles.add(opened);
-    typeMapping.forEach((k, v) {
-      futures.add(doItAsync(() => opened.setPosition(v as int)));
-      futures.add(doItAsync(() => opened.truncate(v as int)));
-      futures.add(doItAsync(() => opened.writeByte(v as int)));
-    });
-    for (var p in typePermutations(2)) {
-      futures.add(doItAsync(() => opened.writeString(p[0], encoding: p[1])));
-    }
-    for (var p in typePermutations(3)) {
-      futures.add(doItAsync(() => opened.readInto(p[0], p[1], p[2])));
-      futures.add(doItAsync(() => opened.writeFrom(p[0], p[1], p[2])));
-    }
-  }
-  Future.wait(futures).then((ignore) {
-    for (var opened in openedFiles) {
+  withTempDirSync('dart_file_fuzz', (temp) {
+    var file = new File('${temp.path}/x');
+    file.createSync();
+    var modes = [FileMode.read, FileMode.write, FileMode.append];
+    for (var m in modes) {
+      var opened = file.openSync(mode: m);
+      typeMapping.forEach((k, v) {
+        doItSync(() => opened.setPositionSync(v as int));
+        doItSync(() => opened.truncateSync(v as int));
+        doItSync(() => opened.writeByteSync(v as int));
+      });
+      for (var p in typePermutations(2)) {
+        doItSync(() => opened.writeStringSync(p[0], encoding: p[1]));
+      }
+      for (var p in typePermutations(3)) {
+        doItSync(() => opened.readIntoSync(p[0], p[1], p[2]));
+        doItSync(() => opened.writeFromSync(p[0], p[1], p[2]));
+      }
       opened.closeSync();
     }
-    temp.deleteSync(recursive: true);
+  });
+}
+
+fuzzAsyncRandomAccessMethods() async {
+  asyncStart();
+  await withTempDir('dart_file_fuzz', (temp) async {
+    var file = new File('${temp.path}/x');
+    file.createSync();
+    var modes = [FileMode.read, FileMode.write, FileMode.append];
+    var futures = <Future>[];
+    var openedFiles = [];
+    for (var m in modes) {
+      var opened = file.openSync(mode: m);
+      openedFiles.add(opened);
+      typeMapping.forEach((k, v) {
+        futures.add(doItAsync(() => opened.setPosition(v as int)));
+        futures.add(doItAsync(() => opened.truncate(v as int)));
+        futures.add(doItAsync(() => opened.writeByte(v as int)));
+      });
+      for (var p in typePermutations(2)) {
+        futures.add(doItAsync(() => opened.writeString(p[0], encoding: p[1])));
+      }
+      for (var p in typePermutations(3)) {
+        futures.add(doItAsync(() => opened.readInto(p[0], p[1], p[2])));
+        futures.add(doItAsync(() => opened.writeFrom(p[0], p[1], p[2])));
+      }
+    }
+    await Future.wait(futures).then((ignore) {
+      for (var opened in openedFiles) {
+        opened.closeSync();
+      }
+      asyncEnd();
+    });
   });
 }
 
diff --git a/tests/standalone_2/io/file_fuzz_test.dart b/tests/standalone_2/io/file_fuzz_test.dart
index 95a704c..32ce6aa 100644
--- a/tests/standalone_2/io/file_fuzz_test.dart
+++ b/tests/standalone_2/io/file_fuzz_test.dart
@@ -11,117 +11,120 @@
 import 'dart:io';
 
 import 'fuzz_support.dart';
+import 'file_write_only_test.dart' show withTempDir, withTempDirSync;
 
 import "package:async_helper/async_helper.dart";
 
 fuzzSyncMethods() {
-  var temp = Directory.systemTemp.createTempSync('dart_file_fuzz');
-  typeMapping.forEach((k, v) {
-    File f;
-    doItSync(() => f = new File('${temp.path}/$v'));
-    if (f == null) return;
-    doItSync(f.existsSync);
-    doItSync(f.createSync);
-    doItSync(f.deleteSync);
-    doItSync(f.lengthSync);
-    doItSync(f.lastModifiedSync);
-    doItSync(() => f.path);
-    doItSync(() => f.openRead().listen((_) {}, onError: (e) {}));
-    doItSync(f.readAsBytesSync);
-    doItSync(f.readAsStringSync);
-    doItSync(f.readAsLinesSync);
-    typeMapping.forEach((k2, v2) {
-      doItSync(() => f.openSync(mode: v2));
-      doItSync(() => f.openWrite(mode: v2));
-      doItSync(() => f.readAsStringSync(encoding: v2));
-      doItSync(() => f.readAsLinesSync(encoding: v2));
+  withTempDirSync('dart_file_fuzz', (temp) {
+    typeMapping.forEach((k, v) {
+      File f;
+      doItSync(() => f = new File('${temp.path}/$v'));
+      if (f == null) return;
+      doItSync(f.existsSync);
+      doItSync(f.createSync);
+      doItSync(f.deleteSync);
+      doItSync(f.lengthSync);
+      doItSync(f.lastModifiedSync);
+      doItSync(() => f.path);
+      doItSync(() => f.openRead().listen((_) {}, onError: (e) {}));
+      doItSync(f.readAsBytesSync);
+      doItSync(f.readAsStringSync);
+      doItSync(f.readAsLinesSync);
+      typeMapping.forEach((k2, v2) {
+        doItSync(() => f.openSync(mode: v2));
+        doItSync(() => f.openWrite(mode: v2));
+        doItSync(() => f.readAsStringSync(encoding: v2));
+        doItSync(() => f.readAsLinesSync(encoding: v2));
+      });
     });
   });
-  temp.deleteSync(recursive: true);
 }
 
 fuzzAsyncMethods() {
   asyncStart();
-  var futures = <Future>[];
-  var temp = Directory.systemTemp.createTempSync('dart_file_fuzz');
-  typeMapping.forEach((k, v) {
-    File f;
-    doItSync(() => f = new File('${temp.path}/$v'));
-    if (f == null) return;
-    futures.add(doItAsync(f.exists));
-    futures.add(doItAsync(f.delete));
-    futures.add(doItAsync(() => f.parent));
-    futures.add(doItAsync(f.length));
-    futures.add(doItAsync(f.lastModified));
-    futures.add(doItAsync(f.open));
-    futures.add(doItAsync(() => f.path));
-    futures.add(doItAsync(f.readAsBytes));
-    futures.add(doItAsync(f.readAsLines));
-    futures.add(doItAsync(f.readAsString));
-    typeMapping.forEach((k2, v2) {
-      futures.add(doItAsync(() => f.open(mode: v2)));
-      futures.add(doItAsync(() => f.readAsString(encoding: v2)));
-      futures.add(doItAsync(() => f.readAsLines(encoding: v2)));
+  withTempDir('dart_file_fuzz', (temp) async {
+    var futures = <Future>[];
+    typeMapping.forEach((k, v) {
+      File f;
+      doItSync(() => f = new File('${temp.path}/$v'));
+      if (f == null) return;
+      futures.add(doItAsync(f.exists));
+      futures.add(doItAsync(f.delete));
+      futures.add(doItAsync(() => f.parent));
+      futures.add(doItAsync(f.length));
+      futures.add(doItAsync(f.lastModified));
+      futures.add(doItAsync(f.open));
+      futures.add(doItAsync(() => f.path));
+      futures.add(doItAsync(f.readAsBytes));
+      futures.add(doItAsync(f.readAsLines));
+      futures.add(doItAsync(f.readAsString));
+      typeMapping.forEach((k2, v2) {
+        futures.add(doItAsync(() => f.open(mode: v2)));
+        futures.add(doItAsync(() => f.readAsString(encoding: v2)));
+        futures.add(doItAsync(() => f.readAsLines(encoding: v2)));
+      });
     });
-  });
-  Future.wait(futures).then((_) {
-    temp.deleteSync(recursive: true);
-    asyncEnd();
+    await Future.wait(futures).then((_) {
+      asyncEnd();
+    });
   });
 }
 
 fuzzSyncRandomAccessMethods() {
-  var temp = Directory.systemTemp.createTempSync('dart_file_fuzz');
-  var file = new File('${temp.path}/x');
-  file.createSync();
-  var modes = [FileMode.read, FileMode.write, FileMode.append];
-  for (var m in modes) {
-    var opened = file.openSync(mode: m);
-    typeMapping.forEach((k, v) {
-      doItSync(() => opened.setPositionSync(v));
-      doItSync(() => opened.truncateSync(v));
-      doItSync(() => opened.writeByteSync(v));
-    });
-    for (var p in typePermutations(2)) {
-      doItSync(() => opened.writeStringSync(p[0], encoding: p[1]));
-    }
-    for (var p in typePermutations(3)) {
-      doItSync(() => opened.readIntoSync(p[0], p[1], p[2]));
-      doItSync(() => opened.writeFromSync(p[0], p[1], p[2]));
-    }
-    opened.closeSync();
-  }
-  temp.deleteSync(recursive: true);
-}
-
-fuzzAsyncRandomAccessMethods() {
-  var temp = Directory.systemTemp.createTempSync('dart_file_fuzz');
-  var file = new File('${temp.path}/x');
-  file.createSync();
-  var modes = [FileMode.read, FileMode.write, FileMode.append];
-  var futures = <Future>[];
-  var openedFiles = [];
-  for (var m in modes) {
-    var opened = file.openSync(mode: m);
-    openedFiles.add(opened);
-    typeMapping.forEach((k, v) {
-      futures.add(doItAsync(() => opened.setPosition(v)));
-      futures.add(doItAsync(() => opened.truncate(v)));
-      futures.add(doItAsync(() => opened.writeByte(v)));
-    });
-    for (var p in typePermutations(2)) {
-      futures.add(doItAsync(() => opened.writeString(p[0], encoding: p[1])));
-    }
-    for (var p in typePermutations(3)) {
-      futures.add(doItAsync(() => opened.readInto(p[0], p[1], p[2])));
-      futures.add(doItAsync(() => opened.writeFrom(p[0], p[1], p[2])));
-    }
-  }
-  Future.wait(futures).then((ignore) {
-    for (var opened in openedFiles) {
+  withTempDirSync('dart_file_fuzz', (temp) {
+    var file = new File('${temp.path}/x');
+    file.createSync();
+    var modes = [FileMode.read, FileMode.write, FileMode.append];
+    for (var m in modes) {
+      var opened = file.openSync(mode: m);
+      typeMapping.forEach((k, v) {
+        doItSync(() => opened.setPositionSync(v));
+        doItSync(() => opened.truncateSync(v));
+        doItSync(() => opened.writeByteSync(v));
+      });
+      for (var p in typePermutations(2)) {
+        doItSync(() => opened.writeStringSync(p[0], encoding: p[1]));
+      }
+      for (var p in typePermutations(3)) {
+        doItSync(() => opened.readIntoSync(p[0], p[1], p[2]));
+        doItSync(() => opened.writeFromSync(p[0], p[1], p[2]));
+      }
       opened.closeSync();
     }
-    temp.deleteSync(recursive: true);
+  });
+}
+
+fuzzAsyncRandomAccessMethods() async {
+  asyncStart();
+  await withTempDir('dart_file_fuzz', (temp) async {
+    var file = new File('${temp.path}/x');
+    file.createSync();
+    var modes = [FileMode.read, FileMode.write, FileMode.append];
+    var futures = <Future>[];
+    var openedFiles = [];
+    for (var m in modes) {
+      var opened = file.openSync(mode: m);
+      openedFiles.add(opened);
+      typeMapping.forEach((k, v) {
+        futures.add(doItAsync(() => opened.setPosition(v)));
+        futures.add(doItAsync(() => opened.truncate(v)));
+        futures.add(doItAsync(() => opened.writeByte(v)));
+      });
+      for (var p in typePermutations(2)) {
+        futures.add(doItAsync(() => opened.writeString(p[0], encoding: p[1])));
+      }
+      for (var p in typePermutations(3)) {
+        futures.add(doItAsync(() => opened.readInto(p[0], p[1], p[2])));
+        futures.add(doItAsync(() => opened.writeFrom(p[0], p[1], p[2])));
+      }
+    }
+    await Future.wait(futures).then((ignore) {
+      for (var opened in openedFiles) {
+        opened.closeSync();
+      }
+      asyncEnd();
+    });
   });
 }
 
diff --git a/tools/VERSION b/tools/VERSION
index 31673bd..bf290e3 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
 MAJOR 2
 MINOR 14
 PATCH 0
-PRERELEASE 362
+PRERELEASE 363
 PRERELEASE_PATCH 0
\ No newline at end of file