Version 2.13.0-233.0.dev

Merge commit '88a00c37b2cccb04d45d9b92d7d5691b53799db1' into 'dev'
diff --git a/pkg/analysis_server/lib/src/context_manager.dart b/pkg/analysis_server/lib/src/context_manager.dart
index 72a096e..b44ab93 100644
--- a/pkg/analysis_server/lib/src/context_manager.dart
+++ b/pkg/analysis_server/lib/src/context_manager.dart
@@ -495,6 +495,11 @@
   /// to creation/modification of files that were generated by Bazel.
   void _handleBazelSearchInfo(
       Folder folder, String workspace, BazelSearchInfo info) {
+    final bazelWatcherService = this.bazelWatcherService;
+    if (bazelWatcherService == null) {
+      return;
+    }
+
     var watched = bazelWatchedPathsPerFolder.putIfAbsent(
         folder, () => _BazelWatchedFiles(workspace));
     var added = watched.paths.add(info.requestedPath);
diff --git a/pkg/analysis_server/lib/src/domain_analysis.dart b/pkg/analysis_server/lib/src/domain_analysis.dart
index a9b8464..0cec373 100644
--- a/pkg/analysis_server/lib/src/domain_analysis.dart
+++ b/pkg/analysis_server/lib/src/domain_analysis.dart
@@ -61,6 +61,10 @@
 
     // Prepare the resolved units.
     var result = await server.getResolvedUnit(file);
+    if (result.state != ResultState.VALID) {
+      server.sendResponse(Response.fileNotAnalyzed(request, file));
+      return;
+    }
     var unit = result?.unit;
 
     // Prepare the hovers.
diff --git a/pkg/analysis_server/lib/src/edit/edit_domain.dart b/pkg/analysis_server/lib/src/edit/edit_domain.dart
index 93c8e3d..f93c1ad 100644
--- a/pkg/analysis_server/lib/src/edit/edit_domain.dart
+++ b/pkg/analysis_server/lib/src/edit/edit_domain.dart
@@ -106,7 +106,7 @@
 
       var workspace = DartChangeWorkspace(server.currentSessions);
       var processor = BulkFixProcessor(server.instrumentationService, workspace,
-          useConfigFiles: params.inTestMode);
+          useConfigFiles: params.inTestMode ?? false);
 
       var collection = AnalysisContextCollectionImpl(
         includedPaths: params.included,
diff --git a/pkg/analysis_server/lib/src/plugin/notification_manager.dart b/pkg/analysis_server/lib/src/plugin/notification_manager.dart
index 6ebbf40..b8de615 100644
--- a/pkg/analysis_server/lib/src/plugin/notification_manager.dart
+++ b/pkg/analysis_server/lib/src/plugin/notification_manager.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:collection';
 
 import 'package:analysis_server/protocol/protocol_generated.dart' as server;
@@ -39,7 +37,10 @@
       <server.AnalysisService, Set<String>>{};
 
   /// The collector being used to collect the analysis errors from the plugins.
-  ResultCollector<List<AnalysisError>> errors;
+  // TODO(brianwilkerson) Consider the possibility of not passing the predicate
+  //  in to the collector, but instead to the testing in this class.
+  late ResultCollector<List<AnalysisError>> errors =
+      ResultCollector<List<AnalysisError>>(serverId, predicate: _isIncluded);
 
   /// The collector being used to collect the folding regions from the plugins.
   ResultCollector<List<FoldingRegion>> folding;
@@ -65,15 +66,15 @@
   final ResultMerger merger = ResultMerger();
 
   /// Initialize a newly created notification manager.
-  AbstractNotificationManager(this.pathContext) {
-    errors =
-        ResultCollector<List<AnalysisError>>(serverId, predicate: _isIncluded);
-    folding = ResultCollector<List<FoldingRegion>>(serverId);
-    highlights = ResultCollector<List<HighlightRegion>>(serverId);
-    navigation = ResultCollector<server.AnalysisNavigationParams>(serverId);
-    occurrences = ResultCollector<List<Occurrences>>(serverId);
-    outlines = ResultCollector<List<Outline>>(serverId);
-  }
+  AbstractNotificationManager(this.pathContext)
+      :
+        // errors =
+        //     ResultCollector<List<AnalysisError>>(serverId, predicate: _isIncluded),
+        folding = ResultCollector<List<FoldingRegion>>(serverId),
+        highlights = ResultCollector<List<HighlightRegion>>(serverId),
+        navigation = ResultCollector<server.AnalysisNavigationParams>(serverId),
+        occurrences = ResultCollector<List<Occurrences>>(serverId),
+        outlines = ResultCollector<List<Outline>>(serverId);
 
   /// Handle the given [notification] from the plugin with the given [pluginId].
   void handlePluginNotification(
@@ -160,7 +161,9 @@
       navigation.putResults(filePath, pluginId, navigationData);
       var unmergedNavigations = navigation.getResults(filePath);
       var mergedNavigations = merger.mergeNavigation(unmergedNavigations);
-      sendNavigations(mergedNavigations);
+      if (mergedNavigations != null) {
+        sendNavigations(mergedNavigations);
+      }
     }
   }
 
@@ -221,7 +224,7 @@
       Map<server.AnalysisService, Set<String>> newSubscriptions) {
     /// Return the collector associated with the given service, or `null` if the
     /// service is not handled by this manager.
-    ResultCollector collectorFor(server.AnalysisService service) {
+    ResultCollector? collectorFor(server.AnalysisService service) {
       switch (service) {
         case server.AnalysisService.FOLDING:
           return folding;
diff --git a/pkg/analysis_server/lib/src/plugin/plugin_manager.dart b/pkg/analysis_server/lib/src/plugin/plugin_manager.dart
index 02c1294..1820f9e 100644
--- a/pkg/analysis_server/lib/src/plugin/plugin_manager.dart
+++ b/pkg/analysis_server/lib/src/plugin/plugin_manager.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:collection';
 import 'dart:convert';
@@ -81,7 +79,7 @@
       : super(notificationManager, instrumentationService);
 
   @override
-  bool get canBeStarted => executionPath != null;
+  bool get canBeStarted => executionPath.isNotEmpty;
 
   @override
   String get pluginId => path;
@@ -122,9 +120,9 @@
 
   /// The current execution of the plugin, or `null` if the plugin is not
   /// currently being executed.
-  PluginSession currentSession;
+  PluginSession? currentSession;
 
-  CaughtException _exception;
+  CaughtException? _exception;
 
   /// Initialize the newly created information about a plugin.
   PluginInfo(this.notificationManager, this.instrumentationService);
@@ -142,7 +140,7 @@
   /// The exception that occurred that prevented the plugin from being started,
   /// or `null` if there was no exception (possibly because no attempt has yet
   /// been made to start the plugin).
-  CaughtException get exception => _exception;
+  CaughtException? get exception => _exception;
 
   /// Return the id of this plugin, used to identify the plugin to users.
   String get pluginId;
@@ -204,12 +202,12 @@
   /// Start a new isolate that is running the plugin. Return the state object
   /// used to interact with the plugin, or `null` if the plugin could not be
   /// run.
-  Future<PluginSession> start(String byteStorePath, String sdkPath) async {
+  Future<PluginSession?> start(String byteStorePath, String sdkPath) async {
     if (currentSession != null) {
       throw StateError('Cannot start a plugin that is already running.');
     }
     currentSession = PluginSession(this);
-    var isRunning = await currentSession.start(byteStorePath, sdkPath);
+    var isRunning = await currentSession!.start(byteStorePath, sdkPath);
     if (!isRunning) {
       currentSession = null;
     }
@@ -225,7 +223,7 @@
       }
       throw StateError('Cannot stop a plugin that is not running.');
     }
-    var doneFuture = currentSession.stop();
+    var doneFuture = currentSession!.stop();
     currentSession = null;
     return doneFuture;
   }
@@ -235,6 +233,7 @@
 
   /// Update the context roots that the plugin should be analyzing.
   void _updatePluginRoots() {
+    final currentSession = this.currentSession;
     if (currentSession != null) {
       var params = AnalysisSetContextRootsParams(contextRoots
           .map((analyzer.ContextRoot contextRoot) => ContextRoot(
@@ -280,18 +279,18 @@
   /// received from the client. Because plugins are lazily discovered, this
   /// needs to be retained so that it can be sent after a plugin has been
   /// started.
-  AnalysisSetPriorityFilesParams _analysisSetPriorityFilesParams;
+  AnalysisSetPriorityFilesParams? _analysisSetPriorityFilesParams;
 
   /// The parameters for the last 'analysis.setSubscriptions' request that was
   /// received from the client. Because plugins are lazily discovered, this
   /// needs to be retained so that it can be sent after a plugin has been
   /// started.
-  AnalysisSetSubscriptionsParams _analysisSetSubscriptionsParams;
+  AnalysisSetSubscriptionsParams? _analysisSetSubscriptionsParams;
 
   /// The current state of content overlays. Because plugins are lazily
   /// discovered, the state needs to be retained so that it can be sent after a
   /// plugin has been started.
-  final Map<String, dynamic> _overlayState = <String, dynamic>{};
+  final Map<String, AddContentOverlay> _overlayState = {};
 
   final StreamController<void> _pluginsChanged = StreamController.broadcast();
 
@@ -312,14 +311,15 @@
   Future<void> addPluginToContextRoot(
       analyzer.ContextRoot contextRoot, String path) async {
     var plugin = _pluginMap[path];
-    var isNew = plugin == null;
-    if (isNew) {
+    var isNew = false;
+    if (plugin == null) {
+      isNew = true;
       List<String> pluginPaths;
       try {
         pluginPaths = pathsFor(path);
       } catch (exception, stackTrace) {
         plugin = DiscoveredPluginInfo(
-            path, null, null, notificationManager, instrumentationService);
+            path, '', '', notificationManager, instrumentationService);
         plugin.reportException(CaughtException(exception, stackTrace));
         _pluginMap[path] = plugin;
         return;
@@ -327,33 +327,33 @@
       plugin = DiscoveredPluginInfo(path, pluginPaths[0], pluginPaths[1],
           notificationManager, instrumentationService);
       _pluginMap[path] = plugin;
-      if (pluginPaths[0] != null) {
-        try {
-          var session = await plugin.start(byteStorePath, sdkPath);
-          session?.onDone?.then((_) {
-            _pluginMap.remove(path);
-            _notifyPluginsChanged();
-          });
-        } catch (exception, stackTrace) {
-          // Record the exception (for debugging purposes) and record the fact
-          // that we should not try to communicate with the plugin.
-          plugin.reportException(CaughtException(exception, stackTrace));
-          isNew = false;
-        }
+      try {
+        var session = await plugin.start(byteStorePath, sdkPath);
+        session?.onDone.then((_) {
+          _pluginMap.remove(path);
+          _notifyPluginsChanged();
+        });
+      } catch (exception, stackTrace) {
+        // Record the exception (for debugging purposes) and record the fact
+        // that we should not try to communicate with the plugin.
+        plugin.reportException(CaughtException(exception, stackTrace));
+        isNew = false;
       }
 
       _notifyPluginsChanged();
     }
     plugin.addContextRoot(contextRoot);
     if (isNew) {
-      if (_analysisSetSubscriptionsParams != null) {
-        plugin.sendRequest(_analysisSetSubscriptionsParams);
+      var analysisSetSubscriptionsParams = _analysisSetSubscriptionsParams;
+      if (analysisSetSubscriptionsParams != null) {
+        plugin.sendRequest(analysisSetSubscriptionsParams);
       }
       if (_overlayState.isNotEmpty) {
         plugin.sendRequest(AnalysisUpdateContentParams(_overlayState));
       }
-      if (_analysisSetPriorityFilesParams != null) {
-        plugin.sendRequest(_analysisSetPriorityFilesParams);
+      var analysisSetPriorityFilesParams = _analysisSetPriorityFilesParams;
+      if (analysisSetPriorityFilesParams != null) {
+        plugin.sendRequest(analysisSetPriorityFilesParams);
       }
     }
   }
@@ -363,7 +363,7 @@
   /// containing futures that will complete when each of the plugins have sent a
   /// response.
   Map<PluginInfo, Future<Response>> broadcastRequest(RequestParams params,
-      {analyzer.ContextRoot contextRoot}) {
+      {analyzer.ContextRoot? contextRoot}) {
     var plugins = pluginsForContextRoot(contextRoot);
     var responseMap = <PluginInfo, Future<Response>>{};
     for (var plugin in plugins) {
@@ -389,14 +389,15 @@
     bool matches(String pattern) =>
         Glob(resourceProvider.pathContext.separator, pattern).matches(filePath);
 
-    WatchEvent event;
+    WatchEvent? event;
     var responses = <Future<Response>>[];
     for (var plugin in _pluginMap.values) {
       var session = plugin.currentSession;
+      var interestingFiles = session?.interestingFiles;
       if (session != null &&
           plugin.isAnalyzing(filePath) &&
-          session.interestingFiles != null &&
-          session.interestingFiles.any(matches)) {
+          interestingFiles != null &&
+          interestingFiles.any(matches)) {
         // The list of interesting file globs is `null` if the plugin has not
         // yet responded to the plugin.versionCheck request. If that happens
         // then the plugin hasn't had a chance to analyze anything yet, and
@@ -435,6 +436,9 @@
     // plugin will need to be copied and pub will need to be run.
     //
     var stateFolder = resourceProvider.getStateLocation('.plugin_manager');
+    if (stateFolder == null) {
+      throw PluginException('No state location, so plugin could not be copied');
+    }
     var stateName = _uniqueDirectoryName(pluginPath);
     var parentFolder = stateFolder.getChildAssumingFolder(stateName);
     if (parentFolder.exists) {
@@ -449,7 +453,7 @@
   /// Return a list of all of the plugins that are currently associated with the
   /// given [contextRoot].
   @visibleForTesting
-  List<PluginInfo> pluginsForContextRoot(analyzer.ContextRoot contextRoot) {
+  List<PluginInfo> pluginsForContextRoot(analyzer.ContextRoot? contextRoot) {
     if (contextRoot == null) {
       return _pluginMap.values.toList();
     }
@@ -472,7 +476,7 @@
     } catch (exception, stackTrace) {
       var pluginPath = path.join(hostPackageName, 'tools', 'analyzer_plugin');
       var plugin = DiscoveredPluginInfo(
-          pluginPath, null, null, notificationManager, instrumentationService);
+          pluginPath, '', '', notificationManager, instrumentationService);
       plugin.reportException(CaughtException(exception, stackTrace));
       _pluginMap[pluginPath] = plugin;
     }
@@ -514,21 +518,23 @@
         //
         _pluginMap[path] = plugin;
         var session = await plugin.start(byteStorePath, sdkPath);
-        session?.onDone?.then((_) {
+        session?.onDone.then((_) {
           _pluginMap.remove(path);
         });
         //
         // Re-initialize the plugin.
         //
         plugin.addContextRoots(contextRoots);
-        if (_analysisSetSubscriptionsParams != null) {
-          plugin.sendRequest(_analysisSetSubscriptionsParams);
+        var analysisSetSubscriptionsParams = _analysisSetSubscriptionsParams;
+        if (analysisSetSubscriptionsParams != null) {
+          plugin.sendRequest(analysisSetSubscriptionsParams);
         }
         if (_overlayState.isNotEmpty) {
           plugin.sendRequest(AnalysisUpdateContentParams(_overlayState));
         }
-        if (_analysisSetPriorityFilesParams != null) {
-          plugin.sendRequest(_analysisSetPriorityFilesParams);
+        var analysisSetPriorityFilesParams = _analysisSetPriorityFilesParams;
+        if (analysisSetPriorityFilesParams != null) {
+          plugin.sendRequest(analysisSetPriorityFilesParams);
         }
       }
     }
@@ -573,7 +579,7 @@
       } else if (overlay is AddContentOverlay) {
         _overlayState[file] = overlay;
       } else if (overlay is ChangeContentOverlay) {
-        AddContentOverlay previousOverlay = _overlayState[file];
+        var previousOverlay = _overlayState[file]!;
         var newContent =
             SourceEdit.applySequence(previousOverlay.content, overlay.edits);
         _overlayState[file] = AddContentOverlay(newContent);
@@ -599,15 +605,15 @@
   ///
   /// Runs pub if [pubCommand] is provided and not null.
   List<String> _computePaths(Folder pluginFolder,
-      {String pubCommand, Workspace workspace}) {
+      {String? pubCommand, Workspace? workspace}) {
     var pluginFile = pluginFolder
         .getChildAssumingFolder('bin')
         .getChildAssumingFile('plugin.dart');
     if (!pluginFile.exists) {
       throw PluginException('File "${pluginFile.path}" does not exist.');
     }
-    String reason;
-    var packagesFile = pluginFolder.getChildAssumingFile('.packages');
+    String? reason;
+    File? packagesFile = pluginFolder.getChildAssumingFile('.packages');
     if (pubCommand != null) {
       var vmPath = Platform.executable;
       var pubPath = path.join(path.dirname(vmPath), 'pub');
@@ -647,6 +653,7 @@
       }
     }
     if (packagesFile == null) {
+      reason ??= 'Could not create packages file for an unknown reason.';
       throw PluginException(reason);
     }
     return <String>[pluginFile.path, packagesFile.path];
@@ -673,10 +680,10 @@
   /// the given [pluginFolder]. The [packageUriResolver] is used to determine
   /// the location of the packages that need to be included in the packages
   /// file.
-  File _createPackagesFile(
+  File? _createPackagesFile(
       Folder pluginFolder, UriResolver packageUriResolver) {
     var pluginPath = pluginFolder.path;
-    var stateFolder = resourceProvider.getStateLocation('.plugin_manager');
+    var stateFolder = resourceProvider.getStateLocation('.plugin_manager')!;
     var stateName = _uniqueDirectoryName(pluginPath) + '.packages';
     var packagesFile = stateFolder.getChildAssumingFile(stateName);
     if (!packagesFile.exists) {
@@ -698,11 +705,13 @@
             if (!visitedPackages.containsKey(packageName)) {
               var uri = Uri.parse('package:$packageName/$packageName.dart');
               var packageSource = packageUriResolver.resolveAbsolute(uri);
-              var libDirPath = context.dirname(packageSource.fullName);
-              visitedPackages[packageName] = libDirPath;
-              var pubspecPath =
-                  context.join(context.dirname(libDirPath), 'pubspec.yaml');
-              pubspecFiles.add(resourceProvider.getFile(pubspecPath));
+              if (packageSource != null) {
+                var libDirPath = context.dirname(packageSource.fullName);
+                visitedPackages[packageName] = libDirPath;
+                var pubspecPath =
+                    context.join(context.dirname(libDirPath), 'pubspec.yaml');
+                pubspecFiles.add(resourceProvider.getFile(pubspecPath));
+              }
             }
           }
         }
@@ -794,7 +803,7 @@
   Completer<void> pluginStoppedCompleter = Completer<void>();
 
   /// The channel used to communicate with the plugin.
-  ServerCommunicationChannel channel;
+  ServerCommunicationChannel? channel;
 
   /// The index of the next request to be sent to the plugin.
   int requestId = 0;
@@ -809,17 +818,17 @@
 
   /// The contact information to include when reporting problems related to the
   /// plugin.
-  String contactInfo;
+  String? contactInfo;
 
   /// The glob patterns of files that the plugin is interested in knowing about.
-  List<String> interestingFiles;
+  List<String>? interestingFiles;
 
   /// The name to be used when reporting problems related to the plugin.
-  String name;
+  String? name;
 
   /// The version number to be used when reporting problems related to the
   /// plugin.
-  String version;
+  String? version;
 
   /// Initialize the newly created information about the execution of a plugin.
   PluginSession(this.info);
@@ -847,7 +856,7 @@
   /// Handle the fact that the plugin has stopped.
   void handleOnDone() {
     if (channel != null) {
-      channel.close();
+      channel!.close();
       channel = null;
     }
     pluginStoppedCompleter.complete(null);
@@ -865,11 +874,11 @@
   /// created when the request was sent.
   void handleResponse(Response response) {
     var requestData = pendingRequests.remove(response.id);
-    var responseTime = DateTime.now().millisecondsSinceEpoch;
-    var duration = responseTime - requestData.requestTime;
-    PluginManager.recordResponseTime(info, requestData.method, duration);
-    var completer = requestData.completer;
-    if (completer != null) {
+    if (requestData != null) {
+      var responseTime = DateTime.now().millisecondsSinceEpoch;
+      var duration = responseTime - requestData.requestTime;
+      PluginManager.recordResponseTime(info, requestData.method, duration);
+      var completer = requestData.completer;
       completer.complete(response);
     }
   }
@@ -892,6 +901,7 @@
   /// Send a request, based on the given [parameters]. Return a future that will
   /// complete when a response is received.
   Future<Response> sendRequest(RequestParams parameters) {
+    var channel = this.channel;
     if (channel == null) {
       throw StateError('Cannot send a request to a plugin that has stopped.');
     }
@@ -912,34 +922,34 @@
     if (channel != null) {
       throw StateError('Cannot start a plugin that is already running.');
     }
-    if (byteStorePath == null || byteStorePath.isEmpty) {
+    if (byteStorePath.isEmpty) {
       throw StateError('Missing byte store path');
     }
     if (!isCompatible) {
-      info.reportException(
-          CaughtException(PluginException('Plugin is not compatible.'), null));
+      info.reportException(CaughtException(
+          PluginException('Plugin is not compatible.'), StackTrace.current));
       return false;
     }
     if (!info.canBeStarted) {
-      info.reportException(
-          CaughtException(PluginException('Plugin cannot be started.'), null));
+      info.reportException(CaughtException(
+          PluginException('Plugin cannot be started.'), StackTrace.current));
       return false;
     }
     channel = info._createChannel();
     // TODO(brianwilkerson) Determine if await is necessary, if so, change the
     // return type of `channel.listen` to `Future<void>`.
-    await (channel.listen(handleResponse, handleNotification,
+    await (channel!.listen(handleResponse, handleNotification,
         onDone: handleOnDone, onError: handleOnError) as dynamic);
     if (channel == null) {
       // If there is an error when starting the isolate, the channel will invoke
       // handleOnDone, which will cause `channel` to be set to `null`.
       info.reportException(CaughtException(
           PluginException('Unrecorded error while starting the plugin.'),
-          null));
+          StackTrace.current));
       return false;
     }
-    var response = await sendRequest(PluginVersionCheckParams(
-        byteStorePath ?? '', sdkPath, '1.0.0-alpha.0'));
+    var response = await sendRequest(
+        PluginVersionCheckParams(byteStorePath, sdkPath, '1.0.0-alpha.0'));
     var result = PluginVersionCheckResult.fromResponse(response);
     isCompatible = result.isCompatible;
     contactInfo = result.contactInfo;
@@ -948,8 +958,8 @@
     version = result.version;
     if (!isCompatible) {
       sendRequest(PluginShutdownParams());
-      info.reportException(
-          CaughtException(PluginException('Plugin is not compatible.'), null));
+      info.reportException(CaughtException(
+          PluginException('Plugin is not compatible.'), StackTrace.current));
       return false;
     }
     return true;
diff --git a/pkg/analysis_server/lib/src/plugin/plugin_watcher.dart b/pkg/analysis_server/lib/src/plugin/plugin_watcher.dart
index 6e9bb99..9aad161 100644
--- a/pkg/analysis_server/lib/src/plugin/plugin_watcher.dart
+++ b/pkg/analysis_server/lib/src/plugin/plugin_watcher.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:convert';
 
 import 'package:analysis_server/src/plugin/plugin_locator.dart';
@@ -40,7 +38,7 @@
   /// analysis.
   @override
   void addedDriver(AnalysisDriver driver) {
-    var contextRoot = driver.analysisContext.contextRoot;
+    var contextRoot = driver.analysisContext!.contextRoot;
     _driverInfo[driver] = _DriverInfo(
         contextRoot, <String>[contextRoot.root.path, _getSdkPath(driver)]);
     var enabledPlugins = driver.analysisOptions.enabledPluginNames;
@@ -68,7 +66,7 @@
           // If we don't, then tests don't have any way to know when to expect
           // that the list of plugins has been updated.
           manager.addPluginToContextRoot(
-              driver.analysisContext.contextRoot, pluginPath);
+              driver.analysisContext!.contextRoot, pluginPath);
         }
       }
     }
@@ -81,7 +79,7 @@
     if (info == null) {
       throw StateError('Cannot remove a driver that was not added');
     }
-    manager.removedContextRoot(driver.analysisContext.contextRoot);
+    manager.removedContextRoot(driver.analysisContext!.contextRoot);
     _driverInfo.remove(driver);
   }
 
@@ -99,7 +97,7 @@
       }
     }
 
-    var sdkRoot = coreSource.fullName;
+    var sdkRoot = coreSource!.fullName;
     while (resourceProvider.pathContext.basename(sdkRoot) != 'lib') {
       var parent = resourceProvider.pathContext.dirname(sdkRoot);
       if (parent == sdkRoot) {
diff --git a/pkg/analysis_server/lib/src/services/correction/assist_internal.dart b/pkg/analysis_server/lib/src/services/correction/assist_internal.dart
index 68c3a9b..af49455 100644
--- a/pkg/analysis_server/lib/src/services/correction/assist_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/assist_internal.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 'package:analysis_server/plugin/edit/assist/assist_core.dart';
 import 'package:analysis_server/plugin/edit/assist/assist_dart.dart';
 import 'package:analysis_server/src/services/correction/assist.dart';
@@ -169,19 +167,11 @@
         );
 
   Future<List<Assist>> compute() async {
-    if (!setupCompute()) {
-      return assists;
-    }
     await _addFromProducers();
-
     return assists;
   }
 
   Future<List<Assist>> computeAssist(AssistKind assistKind) async {
-    if (!setupCompute()) {
-      return assists;
-    }
-
     var context = CorrectionProducerContext.create(
       selectionOffset: selectionOffset,
       selectionLength: selectionLength,
@@ -199,8 +189,11 @@
           workspace: context.workspace, eol: context.utils.endOfLine);
       await producer.compute(builder);
 
-      _addAssistFromBuilder(builder, producer.assistKind,
-          args: producer.assistArguments);
+      var assistKind = producer.assistKind;
+      if (assistKind != null) {
+        _addAssistFromBuilder(builder, assistKind,
+            args: producer.assistArguments);
+      }
     }
 
     // Calculate only specific assists for edit.dartFix
@@ -219,10 +212,7 @@
   }
 
   void _addAssistFromBuilder(ChangeBuilder builder, AssistKind kind,
-      {List<Object> args}) {
-    if (builder == null) {
-      return;
-    }
+      {List<Object>? args}) {
     var change = builder.sourceChange;
     if (change.edits.isEmpty) {
       return;
@@ -240,7 +230,7 @@
       workspace: workspace,
     );
     if (context == null) {
-      return assists;
+      return;
     }
 
     Future<void> compute(CorrectionProducer producer) async {
@@ -249,8 +239,11 @@
           workspace: context.workspace, eol: context.utils.endOfLine);
       try {
         await producer.compute(builder);
-        _addAssistFromBuilder(builder, producer.assistKind,
-            args: producer.assistArguments);
+        var assistKind = producer.assistKind;
+        if (assistKind != null) {
+          _addAssistFromBuilder(builder, assistKind,
+              args: producer.assistArguments);
+        }
       } on ConflictingEditException catch (exception, stackTrace) {
         // Handle the exception by (a) not adding an assist based on the
         // producer and (b) logging the exception.
@@ -276,6 +269,11 @@
   }
 
   bool _containsErrorCode(Set<String> errorCodes) {
+    final node = findSelectedNode();
+    if (node == null) {
+      return false;
+    }
+
     final fileOffset = node.offset;
     for (var error in assistContext.resolveResult.errors) {
       final errorSource = error.source;
diff --git a/pkg/analysis_server/lib/src/services/correction/base_processor.dart b/pkg/analysis_server/lib/src/services/correction/base_processor.dart
index 25b6c84..543d8c9 100644
--- a/pkg/analysis_server/lib/src/services/correction/base_processor.dart
+++ b/pkg/analysis_server/lib/src/services/correction/base_processor.dart
@@ -11,7 +11,6 @@
 import 'package:analyzer/src/dart/analysis/session_helper.dart';
 import 'package:analyzer/src/dart/ast/utilities.dart';
 import 'package:analyzer_plugin/utilities/change_builder/change_workspace.dart';
-import 'package:meta/meta.dart';
 
 /// Base class for common processor functionality.
 abstract class BaseProcessor {
@@ -29,14 +28,12 @@
   final ResolvedUnitResult resolvedResult;
   final ChangeWorkspace workspace;
 
-  AstNode? node;
-
   BaseProcessor({
     this.selectionOffset = -1,
     this.selectionLength = 0,
     required this.resolvedResult,
     required this.workspace,
-  })   : file = resolvedResult.path!,
+  })  : file = resolvedResult.path!,
         session = resolvedResult.session,
         sessionHelper = AnalysisSessionHelper(resolvedResult.session),
         typeProvider = resolvedResult.typeProvider,
@@ -45,10 +42,8 @@
 
   Flutter get flutter => Flutter.instance;
 
-  @protected
-  bool setupCompute() {
+  AstNode? findSelectedNode() {
     final locator = NodeLocator(selectionOffset, selectionEnd);
-    node = locator.searchWithin(resolvedResult.unit);
-    return node != null;
+    return locator.searchWithin(resolvedResult.unit);
   }
 }
diff --git a/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart b/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart
index 9b3dba2..65467c5 100644
--- a/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart
+++ b/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.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';
 
 import 'package:analysis_server/plugin/edit/fix/fix_dart.dart';
@@ -150,9 +148,8 @@
   /// Initialize a newly created processor to create fixes for diagnostics in
   /// libraries in the [workspace].
   BulkFixProcessor(this.instrumentationService, this.workspace,
-      {bool useConfigFiles})
-      : useConfigFiles = useConfigFiles ?? false,
-        builder = ChangeBuilder(workspace: workspace);
+      {this.useConfigFiles = false})
+      : builder = ChangeBuilder(workspace: workspace);
 
   List<BulkFix> get fixDetails {
     var details = <BulkFix>[];
@@ -199,19 +196,19 @@
     );
 
     final analysisOptions = unit.session.analysisContext.analysisOptions;
-    final fixContext = DartFixContextImpl(
-      instrumentationService,
-      workspace,
-      unit,
-      null,
-      (name) => [],
-    );
 
     var overrideSet = _readOverrideSet(unit);
     for (var error in errors) {
       final processor = ErrorProcessor.getProcessor(analysisOptions, error);
       // Only fix errors not filtered out in analysis options.
       if (processor == null || processor.severity != null) {
+        final fixContext = DartFixContextImpl(
+          instrumentationService,
+          workspace,
+          unit,
+          error,
+          (name) => [],
+        );
         await _fixSingleError(fixContext, unit, error, overrideSet);
       }
     }
@@ -235,9 +232,7 @@
       for (var fix in fixes) {
         if (fix.canBeBulkApplied) {
           final generators = fix.generators;
-          if (generators != null) {
-            yield* generators.map((g) => g().fixKind).whereNotNull();
-          }
+          yield* generators.map((g) => g().fixKind).whereNotNull();
         }
       }
       return;
@@ -247,9 +242,7 @@
     for (var fix in fixes) {
       if (fix.canBeBulkApplied) {
         final generators = fix.generators;
-        if (generators != null) {
-          yield* generators.map((g) => g().fixKind).whereNotNull();
-        }
+        yield* generators.map((g) => g().fixKind).whereNotNull();
       }
     }
 
@@ -259,7 +252,7 @@
         instrumentationService,
         workspace,
         result,
-        null,
+        diagnostic,
         (name) => [],
       );
 
@@ -279,9 +272,7 @@
       for (final multiGenerator in multiGenerators) {
         final multiProducer = multiGenerator();
         multiProducer.configure(context);
-        yield* multiProducer.producers
-            .map((p) => p.fixKind)
-            .where((k) => k != null);
+        yield* multiProducer.producers.map((p) => p.fixKind).whereNotNull();
       }
     }
   }
@@ -290,19 +281,19 @@
   /// library associated with the analysis [result].
   Future<void> _fixErrorsInLibrary(ResolvedLibraryResult result) async {
     var analysisOptions = result.session.analysisContext.analysisOptions;
-    for (var unitResult in result.units) {
-      final fixContext = DartFixContextImpl(
-        instrumentationService,
-        workspace,
-        unitResult,
-        null,
-        (name) => [],
-      );
+    for (var unitResult in result.units!) {
       var overrideSet = _readOverrideSet(unitResult);
       for (var error in unitResult.errors) {
         var processor = ErrorProcessor.getProcessor(analysisOptions, error);
         // Only fix errors not filtered out in analysis options.
         if (processor == null || processor.severity != null) {
+          final fixContext = DartFixContextImpl(
+            instrumentationService,
+            workspace,
+            unitResult,
+            error,
+            (name) => [],
+          );
           await _fixSingleError(fixContext, unitResult, error, overrideSet);
         }
       }
@@ -316,7 +307,7 @@
       DartFixContext fixContext,
       ResolvedUnitResult result,
       AnalysisError diagnostic,
-      TransformOverrideSet overrideSet) async {
+      TransformOverrideSet? overrideSet) async {
     var context = CorrectionProducerContext.create(
       applyingBulkFixes: true,
       dartFixContext: fixContext,
@@ -357,7 +348,7 @@
       await compute(producer);
       var newHash = computeChangeHash();
       if (newHash != oldHash) {
-        changeMap.add(result.path, code);
+        changeMap.add(result.path!, code);
       }
     }
 
@@ -365,10 +356,8 @@
       for (var fix in fixes) {
         if (fix.canBeBulkApplied) {
           final generators = fix.generators;
-          if (generators != null) {
-            for (var generator in generators) {
-              await generate(generator(), codeName);
-            }
+          for (var generator in generators) {
+            await generate(generator(), codeName);
           }
         }
       }
@@ -405,11 +394,11 @@
   /// Return the override set corresponding to the given [result], or `null` if
   /// there is no corresponding configuration file or the file content isn't a
   /// valid override set.
-  TransformOverrideSet _readOverrideSet(ResolvedUnitResult result) {
+  TransformOverrideSet? _readOverrideSet(ResolvedUnitResult result) {
     if (useConfigFiles) {
       var provider = result.session.resourceProvider;
       var context = provider.pathContext;
-      var dartFileName = result.path;
+      var dartFileName = result.path!;
       var configFileName = '${context.withoutExtension(dartFileName)}.config';
       var configFile = provider.getFile(configFileName);
       try {
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/data_driven.dart b/pkg/analysis_server/lib/src/services/correction/dart/data_driven.dart
index 1f2770b..5261db3 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/data_driven.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/data_driven.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 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/fix.dart';
 import 'package:analysis_server/src/services/correction/fix/data_driven/code_template.dart';
@@ -20,7 +18,7 @@
 class DataDriven extends MultiCorrectionProducer {
   /// The transform sets used by the current test.
   @visibleForTesting
-  static List<TransformSet> transformSetsForTests;
+  static List<TransformSet>? transformSetsForTests;
 
   @override
   Iterable<CorrectionProducer> get producers sync* {
@@ -51,8 +49,9 @@
   /// Return the transform sets that are available for fixing issues in the
   /// given [library].
   List<TransformSet> _availableTransformSetsForLibrary(LibraryElement library) {
-    if (transformSetsForTests != null) {
-      return transformSetsForTests;
+    var setsForTests = transformSetsForTests;
+    if (setsForTests != null) {
+      return setsForTests;
     }
     var transformSets = TransformSetManager.instance.forLibrary(library);
     var overrideSet = this.overrideSet;
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/flutter_wrap.dart b/pkg/analysis_server/lib/src/services/correction/dart/flutter_wrap.dart
index a6400d8..1b02c88 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/flutter_wrap.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/flutter_wrap.dart
@@ -2,14 +2,13 @@
 // 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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/selection_analyzer.dart';
 import 'package:analyzer/dart/ast/ast.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/source/source_range.dart';
+import 'package:analyzer/src/dart/ast/extensions.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
 import 'package:analyzer_plugin/utilities/range_factory.dart';
@@ -19,7 +18,7 @@
   Iterable<CorrectionProducer> get producers sync* {
     var widgetExpr = flutter.identifyWidgetExpression(node);
     if (widgetExpr != null) {
-      var widgetType = widgetExpr.staticType;
+      var widgetType = widgetExpr.typeOrThrow;
       yield _FlutterWrapGeneric(widgetExpr);
       if (!flutter.isExactWidgetTypeCenter(widgetType)) {
         yield _FlutterWrapCenter(widgetExpr);
@@ -40,12 +39,13 @@
   Iterable<CorrectionProducer> _wrapMultipleWidgets() sync* {
     var selectionRange = SourceRange(selectionOffset, selectionLength);
     var analyzer = SelectionAnalyzer(selectionRange);
-    resolvedResult.unit.accept(analyzer);
+    resolvedResult.unit!.accept(analyzer);
 
     var widgetExpressions = <Expression>[];
     if (analyzer.hasSelectedNodes) {
       for (var selectedNode in analyzer.selectedNodes) {
-        if (!flutter.isWidgetExpression(selectedNode)) {
+        if (selectedNode is! Expression ||
+            !flutter.isWidgetExpression(selectedNode)) {
           return;
         }
         widgetExpressions.add(selectedNode);
@@ -249,9 +249,9 @@
 
   List<String> get _leadingLines => const [];
 
-  String get _parentClassName => null;
+  String? get _parentClassName => null;
 
-  String get _parentLibraryUri => null;
+  String? get _parentLibraryUri => null;
 
   @override
   Future<void> compute(ChangeBuilder builder) async {
@@ -260,7 +260,7 @@
     // If the wrapper class is specified, find its element.
     var parentLibraryUri = _parentLibraryUri;
     var parentClassName = _parentClassName;
-    ClassElement parentClassElement;
+    ClassElement? parentClassElement;
     if (parentLibraryUri != null && parentClassName != null) {
       parentClassElement =
           await sessionHelper.getClass(parentLibraryUri, parentClassName);
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/flutter_wrap_builder.dart b/pkg/analysis_server/lib/src/services/correction/dart/flutter_wrap_builder.dart
index a2b9351..752a414 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/flutter_wrap_builder.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/flutter_wrap_builder.dart
@@ -2,10 +2,9 @@
 // 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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
+import 'package:analyzer/src/dart/ast/extensions.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
 import 'package:analyzer_plugin/utilities/range_factory.dart';
@@ -20,7 +19,7 @@
     if (widgetExpr == null) {
       return;
     }
-    if (flutter.isExactWidgetTypeBuilder(widgetExpr.staticType)) {
+    if (flutter.isExactWidgetTypeBuilder(widgetExpr.typeOrThrow)) {
       return;
     }
     var widgetSrc = utils.getNodeText(widgetExpr);
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_parameters_in_getter_declaration.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_parameters_in_getter_declaration.dart
index cb17bce..cf13f53 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/remove_parameters_in_getter_declaration.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_parameters_in_getter_declaration.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 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/fix.dart';
 import 'package:analyzer/dart/ast/ast.dart';
@@ -22,11 +20,9 @@
       // Support for the analyzer error.
       var name = node.name;
       var body = node.body;
-      if (name != null && body != null) {
-        await builder.addDartFileEdit(file, (builder) {
-          builder.addSimpleReplacement(range.endStart(name, body), ' ');
-        });
-      }
+      await builder.addDartFileEdit(file, (builder) {
+        builder.addSimpleReplacement(range.endStart(name, body), ' ');
+      });
     } else if (node is FormalParameterList) {
       // Support for the fasta error.
       await builder.addDartFileEdit(file, (builder) {
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/rename_to_camel_case.dart b/pkg/analysis_server/lib/src/services/correction/dart/rename_to_camel_case.dart
index 7e61a0e..752dd51 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/rename_to_camel_case.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/rename_to_camel_case.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 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/fix.dart';
 import 'package:analysis_server/src/services/correction/util.dart';
@@ -16,7 +14,7 @@
 
 class RenameToCamelCase extends CorrectionProducer {
   /// The camel-case version of the name.
-  String _newName;
+  String _newName = '';
 
   @override
   List<Object> get fixArguments => [_newName];
@@ -29,10 +27,10 @@
 
   @override
   Future<void> compute(ChangeBuilder builder) async {
-    if (node is! SimpleIdentifier) {
+    var identifier = node;
+    if (identifier is! SimpleIdentifier) {
       return;
     }
-    SimpleIdentifier identifier = node;
 
     // Prepare the new name.
     var words = identifier.name.split('_');
@@ -42,17 +40,21 @@
     _newName = words.first + words.skip(1).map((w) => capitalize(w)).join();
 
     // Find references to the identifier.
-    List<SimpleIdentifier> references;
+    List<SimpleIdentifier>? references;
     var element = identifier.staticElement;
     if (element is LocalVariableElement) {
-      AstNode root = node.thisOrAncestorOfType<Block>();
-      references = findLocalElementReferences(root, element);
+      var root = node.thisOrAncestorOfType<Block>();
+      if (root != null) {
+        references = findLocalElementReferences(root, element);
+      }
     } else if (element is ParameterElement) {
       if (!element.isNamed) {
         var root = node.thisOrAncestorMatching((node) =>
             node.parent is ClassOrMixinDeclaration ||
             node.parent is CompilationUnit);
-        references = findLocalElementReferences(root, element);
+        if (root != null) {
+          references = findLocalElementReferences(root, element);
+        }
       }
     }
     if (references == null) {
@@ -60,8 +62,9 @@
     }
 
     // Compute the change.
+    var references_final = references;
     await builder.addDartFileEdit(file, (builder) {
-      for (var reference in references) {
+      for (var reference in references_final) {
         builder.addSimpleReplacement(range.node(reference), _newName);
       }
     });
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_boolean_with_bool.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_boolean_with_bool.dart
index 5039e9b7..c35c13f 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/replace_boolean_with_bool.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_boolean_with_bool.dart
@@ -2,10 +2,9 @@
 // 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 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/fix.dart';
+import 'package:analyzer/error/error.dart';
 import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
 import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
 import 'package:analyzer_plugin/utilities/range_factory.dart';
@@ -19,8 +18,13 @@
 
   @override
   Future<void> compute(ChangeBuilder builder) async {
+    final analysisError = diagnostic;
+    if (analysisError is! AnalysisError) {
+      return;
+    }
+
     await builder.addDartFileEdit(file, (builder) {
-      builder.addSimpleReplacement(range.error(diagnostic), 'bool');
+      builder.addSimpleReplacement(range.error(analysisError), 'bool');
     });
   }
 
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_cascade_with_dot.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_cascade_with_dot.dart
index 00d41c3..3a7b269 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/replace_cascade_with_dot.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_cascade_with_dot.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 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/fix.dart';
 import 'package:analyzer/dart/ast/ast.dart';
@@ -31,29 +29,35 @@
 
   @override
   Future<void> compute(ChangeBuilder builder) async {
-    var node = this.node;
-    if (node is CascadeExpression) {
-      var sections = node.cascadeSections;
-      if (sections.length == 1) {
-        await _replaceFor(builder, sections[0]);
-      }
+    final cascadeExpression = node;
+    if (cascadeExpression is! CascadeExpression) {
+      return;
+    }
+
+    var sections = cascadeExpression.cascadeSections;
+    if (sections.length == 1) {
+      await _replaceFor(builder, sections[0]);
     }
   }
 
-  Future<void> _replaceFor(ChangeBuilder builder, Expression section) async {
+  Future<void> _replaceFor(ChangeBuilder builder, Expression? section) async {
     if (section is AssignmentExpression) {
       return _replaceFor(builder, section.leftHandSide);
     }
 
     if (section is IndexExpression) {
-      if (section.period != null) {
-        return _replaceToken(builder, section.period, _indexReplacement);
+      var period = section.period;
+      if (period != null) {
+        return _replaceToken(builder, period, _indexReplacement);
       }
       return _replaceFor(builder, section.target);
     }
 
     if (section is MethodInvocation) {
-      return _replaceToken(builder, section.operator, _propertyReplacement);
+      var operator = section.operator;
+      if (operator != null) {
+        return _replaceToken(builder, operator, _propertyReplacement);
+      }
     }
 
     if (section is PropertyAccess) {
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_colon_with_equals.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_colon_with_equals.dart
index 4f9b235..f6adef4 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/replace_colon_with_equals.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_colon_with_equals.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 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/fix.dart';
 import 'package:analyzer/dart/ast/ast.dart';
@@ -20,12 +18,19 @@
 
   @override
   Future<void> compute(ChangeBuilder builder) async {
-    if (node is DefaultFormalParameter) {
-      await builder.addDartFileEdit(file, (builder) {
-        builder.addSimpleReplacement(
-            range.token((node as DefaultFormalParameter).separator), ' =');
-      });
+    final node = this.node;
+    if (node is! DefaultFormalParameter) {
+      return;
     }
+
+    var separator = node.separator;
+    if (separator == null) {
+      return;
+    }
+
+    await builder.addDartFileEdit(file, (builder) {
+      builder.addSimpleReplacement(range.token(separator), ' =');
+    });
   }
 
   /// Return an instance of this class. Used as a tear-off in `FixProcessor`.
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_conditional_with_if_else.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_conditional_with_if_else.dart
index adb16a8..7dee07a 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/replace_conditional_with_if_else.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_conditional_with_if_else.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 'package:_fe_analyzer_shared/src/scanner/token.dart';
 import 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
@@ -18,58 +16,98 @@
 
   @override
   Future<void> compute(ChangeBuilder builder) async {
-    ConditionalExpression conditional;
     // may be on Statement with Conditional
     var statement = node.thisOrAncestorOfType<Statement>();
     if (statement == null) {
       return;
     }
-    // variable declaration
-    var inVariable = false;
-    if (statement is VariableDeclarationStatement) {
-      var variableStatement = statement;
-      for (var variable in variableStatement.variables.variables) {
-        if (variable.initializer is ConditionalExpression) {
-          conditional = variable.initializer as ConditionalExpression;
-          inVariable = true;
-          break;
-        }
-      }
-    }
-    // assignment
-    var inAssignment = false;
-    if (statement is ExpressionStatement) {
-      var exprStmt = statement;
-      if (exprStmt.expression is AssignmentExpression) {
-        var assignment = exprStmt.expression as AssignmentExpression;
-        if (assignment.operator.type == TokenType.EQ &&
-            assignment.rightHandSide is ConditionalExpression) {
-          conditional = assignment.rightHandSide as ConditionalExpression;
-          inAssignment = true;
-        }
-      }
-    }
-    // return
-    var inReturn = false;
-    if (statement is ReturnStatement) {
-      var returnStatement = statement;
-      if (returnStatement.expression is ConditionalExpression) {
-        conditional = returnStatement.expression as ConditionalExpression;
-        inReturn = true;
-      }
-    }
-    // prepare environment
-    var indent = utils.getIndent(1);
-    var prefix = utils.getNodePrefix(statement);
 
-    if (inVariable || inAssignment || inReturn) {
+    // Type v = conditional;
+    if (statement is VariableDeclarationStatement) {
+      return _variableDeclarationStatement(builder, statement);
+    }
+
+    // v = conditional;
+    if (statement is ExpressionStatement) {
+      var expression = statement.expression;
+      if (expression is AssignmentExpression) {
+        return _assignmentExpression(builder, statement, expression);
+      }
+    }
+
+    // return conditional;
+    if (statement is ReturnStatement) {
+      return _returnStatement(builder, statement);
+    }
+  }
+
+  Future<void> _assignmentExpression(
+    ChangeBuilder builder,
+    ExpressionStatement statement,
+    AssignmentExpression assignment,
+  ) async {
+    var conditional = assignment.rightHandSide;
+    if (assignment.operator.type == TokenType.EQ &&
+        conditional is ConditionalExpression) {
+      var indent = utils.getIndent(1);
+      var prefix = utils.getNodePrefix(statement);
+
       await builder.addDartFileEdit(file, (builder) {
-        // Type v = Conditional;
-        if (inVariable) {
+        var leftSide = assignment.leftHandSide;
+        var conditionSrc = utils.getNodeText(conditional.condition);
+        var thenSrc = utils.getNodeText(conditional.thenExpression);
+        var elseSrc = utils.getNodeText(conditional.elseExpression);
+        var name = utils.getNodeText(leftSide);
+        var src = '';
+        src += 'if ($conditionSrc) {' + eol;
+        src += prefix + indent + '$name = $thenSrc;' + eol;
+        src += prefix + '} else {' + eol;
+        src += prefix + indent + '$name = $elseSrc;' + eol;
+        src += prefix + '}';
+        builder.addSimpleReplacement(range.node(statement), src);
+      });
+    }
+  }
+
+  Future<void> _returnStatement(
+    ChangeBuilder builder,
+    ReturnStatement statement,
+  ) async {
+    var conditional = statement.expression;
+    if (conditional is ConditionalExpression) {
+      var indent = utils.getIndent(1);
+      var prefix = utils.getNodePrefix(statement);
+
+      await builder.addDartFileEdit(file, (builder) {
+        var conditionSrc = utils.getNodeText(conditional.condition);
+        var thenSrc = utils.getNodeText(conditional.thenExpression);
+        var elseSrc = utils.getNodeText(conditional.elseExpression);
+        var src = '';
+        src += 'if ($conditionSrc) {' + eol;
+        src += prefix + indent + 'return $thenSrc;' + eol;
+        src += prefix + '} else {' + eol;
+        src += prefix + indent + 'return $elseSrc;' + eol;
+        src += prefix + '}';
+        builder.addSimpleReplacement(range.node(statement), src);
+      });
+    }
+  }
+
+  Future<void> _variableDeclarationStatement(
+    ChangeBuilder builder,
+    VariableDeclarationStatement statement,
+  ) async {
+    for (var variable in statement.variables.variables) {
+      var conditional = variable.initializer;
+      if (conditional is ConditionalExpression) {
+        var indent = utils.getIndent(1);
+        var prefix = utils.getNodePrefix(statement);
+
+        await builder.addDartFileEdit(file, (builder) {
           var variable = conditional.parent as VariableDeclaration;
           var variableList = variable.parent as VariableDeclarationList;
           if (variableList.type == null) {
-            var type = variable.declaredElement.type;
+            var type = variable.declaredElement!.type;
             var keyword = variableList.keyword;
             if (keyword != null && keyword.keyword == Keyword.VAR) {
               builder.addReplacement(range.token(keyword), (builder) {
@@ -94,37 +132,8 @@
           src += prefix + indent + '$name = $elseSrc;' + eol;
           src += prefix + '}';
           builder.addSimpleReplacement(range.endLength(statement, 0), src);
-        }
-        // v = Conditional;
-        if (inAssignment) {
-          var assignment = conditional.parent as AssignmentExpression;
-          var leftSide = assignment.leftHandSide;
-          var conditionSrc = utils.getNodeText(conditional.condition);
-          var thenSrc = utils.getNodeText(conditional.thenExpression);
-          var elseSrc = utils.getNodeText(conditional.elseExpression);
-          var name = utils.getNodeText(leftSide);
-          var src = '';
-          src += 'if ($conditionSrc) {' + eol;
-          src += prefix + indent + '$name = $thenSrc;' + eol;
-          src += prefix + '} else {' + eol;
-          src += prefix + indent + '$name = $elseSrc;' + eol;
-          src += prefix + '}';
-          builder.addSimpleReplacement(range.node(statement), src);
-        }
-        // return Conditional;
-        if (inReturn) {
-          var conditionSrc = utils.getNodeText(conditional.condition);
-          var thenSrc = utils.getNodeText(conditional.thenExpression);
-          var elseSrc = utils.getNodeText(conditional.elseExpression);
-          var src = '';
-          src += 'if ($conditionSrc) {' + eol;
-          src += prefix + indent + 'return $thenSrc;' + eol;
-          src += prefix + '} else {' + eol;
-          src += prefix + indent + 'return $elseSrc;' + eol;
-          src += prefix + '}';
-          builder.addSimpleReplacement(range.node(statement), src);
-        }
-      });
+        });
+      }
     }
   }
 
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_final_with_const.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_final_with_const.dart
index 3a77351..76b2a8e 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/replace_final_with_const.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_final_with_const.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 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/fix.dart';
 import 'package:analyzer/dart/ast/ast.dart';
@@ -20,11 +18,14 @@
 
   @override
   Future<void> compute(ChangeBuilder builder) async {
+    final node = this.node;
     if (node is VariableDeclarationList) {
-      await builder.addDartFileEdit(file, (builder) {
-        builder.addSimpleReplacement(
-            range.token((node as VariableDeclarationList).keyword), 'const');
-      });
+      var keyword = node.keyword;
+      if (keyword != null) {
+        await builder.addDartFileEdit(file, (builder) {
+          builder.addSimpleReplacement(range.token(keyword), 'const');
+        });
+      }
     }
   }
 
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_final_with_var.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_final_with_var.dart
index 58a4a76..9371a8d 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/replace_final_with_var.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_final_with_var.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 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/fix.dart';
 import 'package:analyzer/dart/ast/ast.dart';
@@ -20,11 +18,12 @@
 
   @override
   Future<void> compute(ChangeBuilder builder) async {
-    var target = node;
-    if (target is VariableDeclarationList) {
-      if (target.type == null) {
+    final node = this.node;
+    if (node is VariableDeclarationList) {
+      var keyword = node.keyword;
+      if (keyword != null && node.type == null) {
         await builder.addDartFileEdit(file, (builder) {
-          builder.addSimpleReplacement(range.token(target.keyword), 'var');
+          builder.addSimpleReplacement(range.token(keyword), 'var');
         });
       }
     }
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_if_else_with_conditional.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_if_else_with_conditional.dart
index 9224921..85e9599 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/replace_if_else_with_conditional.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_if_else_with_conditional.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 'package:_fe_analyzer_shared/src/scanner/token.dart';
 import 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_new_with_const.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_new_with_const.dart
index 9a9cd77..e8db9a3 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/replace_new_with_const.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_new_with_const.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 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/fix.dart';
 import 'package:analyzer/dart/ast/ast.dart';
@@ -20,7 +18,7 @@
 
   @override
   Future<void> compute(ChangeBuilder builder) async {
-    var node = this.node;
+    AstNode? node = this.node;
     if (node is ConstructorName) {
       node = node.parent;
     }
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_null_with_closure.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_null_with_closure.dart
index 39aabc2..9da2766 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/replace_null_with_closure.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_null_with_closure.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 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/fix.dart';
 import 'package:analyzer/dart/ast/ast.dart';
@@ -22,13 +20,14 @@
 
   @override
   Future<void> compute(ChangeBuilder builder) async {
-    AstNode nodeToFix;
+    AstNode? nodeToFix;
     var parameters = const <ParameterElement>[];
+
+    final coveredNode = this.coveredNode;
     if (coveredNode is NamedExpression) {
-      NamedExpression namedExpression = coveredNode;
-      var expression = namedExpression.expression;
+      var expression = coveredNode.expression;
       if (expression is NullLiteral) {
-        var element = namedExpression.element;
+        var element = coveredNode.element;
         if (element is ParameterElement) {
           var type = element.type;
           if (type is FunctionType) {
@@ -41,14 +40,17 @@
       nodeToFix = coveredNode;
     }
 
-    if (nodeToFix != null) {
-      await builder.addDartFileEdit(file, (builder) {
-        builder.addReplacement(range.node(nodeToFix), (builder) {
-          builder.writeParameters(parameters);
-          builder.write(' => null');
-        });
-      });
+    if (nodeToFix == null) {
+      return;
     }
+
+    final nodeToFix_final = nodeToFix;
+    await builder.addDartFileEdit(file, (builder) {
+      builder.addReplacement(range.node(nodeToFix_final), (builder) {
+        builder.writeParameters(parameters);
+        builder.write(' => null');
+      });
+    });
   }
 
   /// Return an instance of this class. Used as a tear-off in `FixProcessor`.
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_return_type_future.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_return_type_future.dart
index 3d0000a..c19cf4a 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/replace_return_type_future.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_return_type_future.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 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/fix.dart';
 import 'package:analyzer/dart/ast/ast.dart';
@@ -18,7 +16,10 @@
   Future<void> compute(ChangeBuilder builder) async {
     // prepare the existing type
     var typeName = node.thisOrAncestorOfType<TypeAnnotation>();
-    var typeProvider = this.typeProvider;
+    if (typeName == null) {
+      return;
+    }
+
     await builder.addDartFileEdit(file, (builder) {
       builder.replaceTypeWithFuture(typeName, typeProvider);
     });
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_var_with_dynamic.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_var_with_dynamic.dart
index 3da975f..1991391 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/replace_var_with_dynamic.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_var_with_dynamic.dart
@@ -2,10 +2,9 @@
 // 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 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/fix.dart';
+import 'package:analyzer/error/error.dart';
 import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
 import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
 import 'package:analyzer_plugin/utilities/range_factory.dart';
@@ -16,9 +15,12 @@
 
   @override
   Future<void> compute(ChangeBuilder builder) async {
-    await builder.addDartFileEdit(file, (builder) {
-      builder.addSimpleReplacement(range.error(diagnostic), 'dynamic');
-    });
+    final diagnostic = this.diagnostic;
+    if (diagnostic is AnalysisError) {
+      await builder.addDartFileEdit(file, (builder) {
+        builder.addSimpleReplacement(range.error(diagnostic), 'dynamic');
+      });
+    }
   }
 
   /// Return an instance of this class. Used as a tear-off in `FixProcessor`.
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_brackets.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_brackets.dart
index 83f4caf..eb4fc02 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_brackets.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_brackets.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 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/fix.dart';
 import 'package:analyzer/dart/ast/ast.dart';
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_conditional_assignment.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_conditional_assignment.dart
index e7dfbd2..9d69d50 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_conditional_assignment.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_conditional_assignment.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 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/fix.dart';
 import 'package:analyzer/dart/ast/ast.dart';
@@ -21,20 +19,14 @@
 
   @override
   Future<void> compute(ChangeBuilder builder) async {
-    IfStatement ifStatement =
+    var node = this.node;
+    var ifStatement =
         node is IfStatement ? node : node.thisOrAncestorOfType<IfStatement>();
     if (ifStatement == null) {
       return;
     }
-    var thenStatement = ifStatement.thenStatement;
-    Statement uniqueStatement(Statement statement) {
-      if (statement is Block) {
-        return uniqueStatement(statement.statements.first);
-      }
-      return statement;
-    }
 
-    thenStatement = uniqueStatement(thenStatement);
+    var thenStatement = _uniqueStatement(ifStatement.thenStatement);
     if (thenStatement is ExpressionStatement) {
       final expression = thenStatement.expression.unParenthesized;
       if (expression is AssignmentExpression) {
@@ -53,4 +45,11 @@
   /// Return an instance of this class. Used as a tear-off in `FixProcessor`.
   static ReplaceWithConditionalAssignment newInstance() =>
       ReplaceWithConditionalAssignment();
+
+  static Statement _uniqueStatement(Statement statement) {
+    if (statement is Block) {
+      return _uniqueStatement(statement.statements.first);
+    }
+    return statement;
+  }
 }
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_eight_digit_hex.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_eight_digit_hex.dart
index d0c7229..ff9e2eb 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_eight_digit_hex.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_eight_digit_hex.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 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/fix.dart';
 import 'package:analyzer/dart/ast/ast.dart';
@@ -13,7 +11,7 @@
 
 class ReplaceWithEightDigitHex extends CorrectionProducer {
   /// The replacement text, used as an argument to the fix message.
-  String _replacement;
+  String _replacement = '';
 
   @override
   List<Object> get fixArguments => [_replacement];
@@ -33,6 +31,9 @@
       return;
     }
     var value = (node as IntegerLiteral).value;
+    if (value == null) {
+      return;
+    }
     _replacement = '0x' + value.toRadixString(16).padLeft(8, '0');
     //
     // Build the edit.
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_extension_name.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_extension_name.dart
index ed7fa48..6bac2bd 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_extension_name.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_extension_name.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 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/fix.dart';
 import 'package:analyzer/dart/ast/ast.dart';
@@ -12,7 +10,7 @@
 import 'package:analyzer_plugin/utilities/range_factory.dart';
 
 class ReplaceWithExtensionName extends CorrectionProducer {
-  String _extensionName;
+  String _extensionName = '';
 
   @override
   List<Object> get fixArguments => [_extensionName];
@@ -35,7 +33,7 @@
     }
   }
 
-  AstNode _getTarget(AstNode invocation) {
+  AstNode? _getTarget(AstNode? invocation) {
     if (invocation is MethodInvocation && node == invocation.methodName) {
       return invocation.target;
     } else if (invocation is PropertyAccess &&
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_filled.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_filled.dart
index fc40853..860e620 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_filled.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_filled.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 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/fix.dart';
 import 'package:analyzer/dart/ast/ast.dart';
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_identifier.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_identifier.dart
index 33d0b66..9b30817 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_identifier.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_identifier.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 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/fix.dart';
 import 'package:analyzer/dart/ast/ast.dart';
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_interpolation.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_interpolation.dart
index 77aa027..639f53f 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_interpolation.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_interpolation.dart
@@ -2,16 +2,14 @@
 // 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 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/fix.dart';
 import 'package:analyzer/dart/ast/ast.dart';
 import 'package:analyzer/dart/ast/token.dart';
+import 'package:analyzer/src/dart/ast/extensions.dart';
 import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
 import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
 import 'package:analyzer_plugin/utilities/range_factory.dart';
-import 'package:meta/meta.dart';
 
 class ReplaceWithInterpolation extends CorrectionProducer {
   @override
@@ -22,9 +20,9 @@
     //
     // Validate the fix.
     //
-    BinaryExpression binary;
-    var candidate = node;
-    while (_isStringConcatenation(candidate)) {
+    BinaryExpression? binary;
+    AstNode? candidate = node;
+    while (candidate is BinaryExpression && _isStringConcatenation(candidate)) {
       binary = candidate;
       candidate = candidate.parent;
     }
@@ -43,8 +41,9 @@
     //
     // Build the edit.
     //
+    final binary_final = binary;
     await builder.addDartFileEdit(file, (builder) {
-      builder.addSimpleReplacement(range.node(binary), interpolation);
+      builder.addSimpleReplacement(range.node(binary_final), interpolation);
     });
   }
 
@@ -82,9 +81,11 @@
         return leftStyle;
       }
       return leftStyle == rightStyle ? leftStyle : _StringStyle.invalid;
-    } else if (expression is MethodInvocation &&
-        expression.methodName.name == 'toString') {
-      return _extractComponentsInto(expression.target, components);
+    } else if (expression is MethodInvocation) {
+      var target = expression.target;
+      if (target != null && expression.methodName.name == 'toString') {
+        return _extractComponentsInto(target, components);
+      }
     } else if (expression is ParenthesizedExpression) {
       return _extractComponentsInto(expression.expression, components);
     }
@@ -95,8 +96,8 @@
   bool _isStringConcatenation(AstNode node) =>
       node is BinaryExpression &&
       node.operator.type == TokenType.PLUS &&
-      node.leftOperand.staticType.isDartCoreString &&
-      node.rightOperand.staticType.isDartCoreString;
+      node.leftOperand.typeOrThrow.isDartCoreString &&
+      node.rightOperand.typeOrThrow.isDartCoreString;
 
   String _mergeComponents(_StringStyle style, List<AstNode> components) {
     var quotes = style.quotes;
@@ -161,10 +162,11 @@
 
   final int state;
 
-  factory _StringStyle(
-      {@required bool multiline,
-      @required bool raw,
-      @required bool singleQuoted}) {
+  factory _StringStyle({
+    required bool multiline,
+    required bool raw,
+    required bool singleQuoted,
+  }) {
     return _StringStyle._((multiline ? multilineBit : 0) +
         (raw ? rawBit : 0) +
         (singleQuoted ? singleQuotedBit : 0));
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_is_empty.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_is_empty.dart
index 9c02fda..96b25d6 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_is_empty.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_is_empty.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 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/fix.dart';
 import 'package:analyzer/dart/ast/ast.dart';
@@ -14,106 +12,28 @@
 
 class ReplaceWithIsEmpty extends CorrectionProducer {
   @override
-  FixKind fixKind;
+  FixKind fixKind = DartFixKind.REPLACE_WITH_IS_EMPTY;
 
   @override
-  FixKind multiFixKind;
+  FixKind multiFixKind = DartFixKind.REPLACE_WITH_IS_EMPTY_MULTI;
 
   @override
   Future<void> compute(ChangeBuilder builder) async {
-    /// Return the value of an integer literal or prefix expression with a
-    /// minus and then an integer literal. For anything else, returns `null`.
-    int getIntValue(Expression expressions) {
-      // Copied from package:linter/src/rules/prefer_is_empty.dart.
-      if (expressions is IntegerLiteral) {
-        return expressions.value;
-      } else if (expressions is PrefixExpression) {
-        var operand = expressions.operand;
-        if (expressions.operator.type == TokenType.MINUS &&
-            operand is IntegerLiteral) {
-          return -operand.value;
-        }
-      }
-      return null;
-    }
-
-    /// Return the expression producing the object on which `length` is being
-    /// invoked, or `null` if there is no such expression.
-    Expression getLengthTarget(Expression expression) {
-      if (expression is PropertyAccess &&
-          expression.propertyName.name == 'length') {
-        return expression.target;
-      } else if (expression is PrefixedIdentifier &&
-          expression.identifier.name == 'length') {
-        return expression.prefix;
-      }
-      return null;
-    }
-
     var binary = node.thisOrAncestorOfType<BinaryExpression>();
-    var operator = binary.operator.type;
-    String getter;
-    Expression lengthTarget;
-    var rightValue = getIntValue(binary.rightOperand);
-    if (rightValue != null) {
-      lengthTarget = getLengthTarget(binary.leftOperand);
-      if (rightValue == 0) {
-        if (operator == TokenType.EQ_EQ || operator == TokenType.LT_EQ) {
-          getter = 'isEmpty';
-          fixKind = DartFixKind.REPLACE_WITH_IS_EMPTY;
-          multiFixKind = DartFixKind.REPLACE_WITH_IS_EMPTY_MULTI;
-        } else if (operator == TokenType.GT || operator == TokenType.BANG_EQ) {
-          getter = 'isNotEmpty';
-          fixKind = DartFixKind.REPLACE_WITH_IS_NOT_EMPTY;
-          multiFixKind = DartFixKind.REPLACE_WITH_IS_NOT_EMPTY_MULTI;
-        }
-      } else if (rightValue == 1) {
-        // 'length >= 1' is same as 'isNotEmpty',
-        // and 'length < 1' is same as 'isEmpty'
-        if (operator == TokenType.GT_EQ) {
-          getter = 'isNotEmpty';
-          fixKind = DartFixKind.REPLACE_WITH_IS_NOT_EMPTY;
-          multiFixKind = DartFixKind.REPLACE_WITH_IS_NOT_EMPTY_MULTI;
-        } else if (operator == TokenType.LT) {
-          getter = 'isEmpty';
-          fixKind = DartFixKind.REPLACE_WITH_IS_EMPTY;
-          multiFixKind = DartFixKind.REPLACE_WITH_IS_EMPTY_MULTI;
-        }
-      }
-    } else {
-      var leftValue = getIntValue(binary.leftOperand);
-      if (leftValue != null) {
-        lengthTarget = getLengthTarget(binary.rightOperand);
-        if (leftValue == 0) {
-          if (operator == TokenType.EQ_EQ || operator == TokenType.GT_EQ) {
-            getter = 'isEmpty';
-            fixKind = DartFixKind.REPLACE_WITH_IS_EMPTY;
-            multiFixKind = DartFixKind.REPLACE_WITH_IS_EMPTY_MULTI;
-          } else if (operator == TokenType.LT ||
-              operator == TokenType.BANG_EQ) {
-            getter = 'isNotEmpty';
-            fixKind = DartFixKind.REPLACE_WITH_IS_NOT_EMPTY;
-            multiFixKind = DartFixKind.REPLACE_WITH_IS_NOT_EMPTY_MULTI;
-          }
-        } else if (leftValue == 1) {
-          // '1 <= length' is same as 'isNotEmpty',
-          // and '1 > length' is same as 'isEmpty'
-          if (operator == TokenType.LT_EQ) {
-            getter = 'isNotEmpty';
-            fixKind = DartFixKind.REPLACE_WITH_IS_NOT_EMPTY;
-            multiFixKind = DartFixKind.REPLACE_WITH_IS_NOT_EMPTY_MULTI;
-          } else if (operator == TokenType.GT) {
-            getter = 'isEmpty';
-            fixKind = DartFixKind.REPLACE_WITH_IS_EMPTY;
-            multiFixKind = DartFixKind.REPLACE_WITH_IS_EMPTY_MULTI;
-          }
-        }
-      }
-    }
-    if (lengthTarget == null || getter == null || fixKind == null) {
+    if (binary == null) {
       return;
     }
-    var target = utils.getNodeText(lengthTarget);
+
+    var replacement = _analyzeBinaryExpression(binary);
+    if (replacement == null) {
+      return;
+    }
+
+    fixKind = replacement.fixKind;
+    multiFixKind = replacement.multiFixKind;
+
+    var target = utils.getNodeText(replacement.lengthTarget);
+    var getter = replacement.getter;
     await builder.addDartFileEdit(file, (builder) {
       builder.addSimpleReplacement(range.node(binary), '$target.$getter');
     });
@@ -121,4 +41,117 @@
 
   /// Return an instance of this class. Used as a tear-off in `FixProcessor`.
   static ReplaceWithIsEmpty newInstance() => ReplaceWithIsEmpty();
+
+  static _Replacement? _analyzeBinaryExpression(BinaryExpression binary) {
+    var operator = binary.operator.type;
+    var rightValue = _getIntValue(binary.rightOperand);
+    if (rightValue != null) {
+      var lengthTarget = _getLengthTarget(binary.leftOperand);
+      if (lengthTarget == null) {
+        return null;
+      }
+      if (rightValue == 0) {
+        if (operator == TokenType.EQ_EQ || operator == TokenType.LT_EQ) {
+          return _Replacement.isEmpty(lengthTarget);
+        } else if (operator == TokenType.GT || operator == TokenType.BANG_EQ) {
+          return _Replacement.isNotEmpty(lengthTarget);
+        }
+      } else if (rightValue == 1) {
+        // 'length >= 1' is same as 'isNotEmpty',
+        // and 'length < 1' is same as 'isEmpty'
+        if (operator == TokenType.GT_EQ) {
+          return _Replacement.isNotEmpty(lengthTarget);
+        } else if (operator == TokenType.LT) {
+          return _Replacement.isEmpty(lengthTarget);
+        }
+      }
+    } else {
+      var leftValue = _getIntValue(binary.leftOperand);
+      if (leftValue != null) {
+        var lengthTarget = _getLengthTarget(binary.rightOperand);
+        if (lengthTarget == null) {
+          return null;
+        }
+        if (leftValue == 0) {
+          if (operator == TokenType.EQ_EQ || operator == TokenType.GT_EQ) {
+            return _Replacement.isEmpty(lengthTarget);
+          } else if (operator == TokenType.LT ||
+              operator == TokenType.BANG_EQ) {
+            return _Replacement.isNotEmpty(lengthTarget);
+          }
+        } else if (leftValue == 1) {
+          // '1 <= length' is same as 'isNotEmpty',
+          // and '1 > length' is same as 'isEmpty'
+          if (operator == TokenType.LT_EQ) {
+            return _Replacement.isNotEmpty(lengthTarget);
+          } else if (operator == TokenType.GT) {
+            return _Replacement.isEmpty(lengthTarget);
+          }
+        }
+      }
+    }
+    return null;
+  }
+
+  /// Return the value of an integer literal or prefix expression with a
+  /// minus and then an integer literal. For anything else, returns `null`.
+  static int? _getIntValue(Expression expressions) {
+    // Copied from package:linter/src/rules/prefer_is_empty.dart.
+    if (expressions is IntegerLiteral) {
+      return expressions.value;
+    } else if (expressions is PrefixExpression) {
+      var operand = expressions.operand;
+      if (expressions.operator.type == TokenType.MINUS &&
+          operand is IntegerLiteral) {
+        var value = operand.value;
+        if (value != null) {
+          return -value;
+        }
+      }
+    }
+    return null;
+  }
+
+  /// Return the expression producing the object on which `length` is being
+  /// invoked, or `null` if there is no such expression.
+  static Expression? _getLengthTarget(Expression expression) {
+    if (expression is PropertyAccess &&
+        expression.propertyName.name == 'length') {
+      return expression.target;
+    } else if (expression is PrefixedIdentifier &&
+        expression.identifier.name == 'length') {
+      return expression.prefix;
+    }
+    return null;
+  }
+}
+
+class _Replacement {
+  final FixKind fixKind;
+  final FixKind multiFixKind;
+  final String getter;
+  final Expression lengthTarget;
+
+  _Replacement.isEmpty(Expression lengthTarget)
+      : this._(
+          fixKind: DartFixKind.REPLACE_WITH_IS_EMPTY,
+          multiFixKind: DartFixKind.REPLACE_WITH_IS_EMPTY_MULTI,
+          getter: 'isEmpty',
+          lengthTarget: lengthTarget,
+        );
+
+  _Replacement.isNotEmpty(Expression lengthTarget)
+      : this._(
+          fixKind: DartFixKind.REPLACE_WITH_IS_NOT_EMPTY,
+          multiFixKind: DartFixKind.REPLACE_WITH_IS_NOT_EMPTY_MULTI,
+          getter: 'isNotEmpty',
+          lengthTarget: lengthTarget,
+        );
+
+  _Replacement._({
+    required this.fixKind,
+    required this.multiFixKind,
+    required this.getter,
+    required this.lengthTarget,
+  });
 }
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_not_null_aware.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_not_null_aware.dart
index 4cc14c0..a46a17e 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_not_null_aware.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_not_null_aware.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 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/fix.dart';
 import 'package:analyzer/dart/ast/ast.dart';
@@ -14,7 +12,7 @@
 
 class ReplaceWithNotNullAware extends CorrectionProducer {
   /// The operator that will replace the existing operator.
-  String _newOperator;
+  String _newOperator = '';
 
   @override
   List<Object> get fixArguments => [_newOperator];
@@ -26,11 +24,13 @@
   Future<void> compute(ChangeBuilder builder) async {
     var node = coveredNode;
     if (node is MethodInvocation) {
-      _newOperator =
-          node.operator.type == TokenType.QUESTION_PERIOD ? '.' : '..';
-      await builder.addDartFileEdit(file, (builder) {
-        builder.addSimpleReplacement(range.token(node.operator), _newOperator);
-      });
+      var operator = node.operator;
+      if (operator != null) {
+        _newOperator = operator.type == TokenType.QUESTION_PERIOD ? '.' : '..';
+        await builder.addDartFileEdit(file, (builder) {
+          builder.addSimpleReplacement(range.token(operator), _newOperator);
+        });
+      }
     } else if (node is PropertyAccess) {
       _newOperator =
           node.operator.type == TokenType.QUESTION_PERIOD ? '.' : '..';
@@ -38,15 +38,17 @@
         builder.addSimpleReplacement(range.token(node.operator), _newOperator);
       });
     } else if (node is IndexExpression) {
-      if (node.period != null) {
+      var period = node.period;
+      var question = node.question;
+      if (period != null) {
         _newOperator = '..';
         await builder.addDartFileEdit(file, (builder) {
-          builder.addSimpleReplacement(range.token(node.period), '..');
+          builder.addSimpleReplacement(range.token(period), '..');
         });
-      } else if (node.question != null) {
+      } else if (question != null) {
         _newOperator = '[';
         await builder.addDartFileEdit(file, (builder) {
-          builder.addDeletion(range.token(node.question));
+          builder.addDeletion(range.token(question));
         });
       }
     } else if (node is SpreadElement) {
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_null_aware.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_null_aware.dart
index 0f36a39..c6b7dd1 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_null_aware.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_null_aware.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 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/fix.dart';
 import 'package:analyzer/dart/ast/ast.dart';
@@ -19,18 +17,22 @@
   Future<void> compute(ChangeBuilder builder) async {
     var node = coveredNode;
     if (node is Expression) {
+      final node_final = node;
       await builder.addDartFileEdit(file, (builder) {
-        var parent = node.parent;
+        var parent = node_final.parent;
         while (parent != null) {
           if (parent is MethodInvocation && parent.target == node) {
-            builder.addSimpleReplacement(range.token(parent.operator), '?.');
+            var operator = parent.operator;
+            if (operator != null) {
+              builder.addSimpleReplacement(range.token(operator), '?.');
+            }
           } else if (parent is PropertyAccess && parent.target == node) {
             builder.addSimpleReplacement(range.token(parent.operator), '?.');
           } else {
             break;
           }
           node = parent;
-          parent = node.parent;
+          parent = node?.parent;
         }
       });
     }
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_tear_off.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_tear_off.dart
index 44df3ff..14d77c2 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_tear_off.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_tear_off.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 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/fix.dart';
 import 'package:analyzer/dart/ast/ast.dart';
@@ -24,16 +22,22 @@
     if (ancestor == null) {
       return;
     }
-    Future<void> addFixOfExpression(InvocationExpression expression) async {
-      await builder.addDartFileEdit(file, (builder) {
-        builder.addReplacement(range.node(ancestor), (builder) {
-          if (expression is MethodInvocation && expression.target != null) {
-            builder.write(utils.getNodeText(expression.target));
-            builder.write('.');
-          }
-          builder.write(utils.getNodeText(expression.function));
+
+    Future<void> addFixOfExpression(Expression? expression) async {
+      if (expression is InvocationExpression) {
+        await builder.addDartFileEdit(file, (builder) {
+          builder.addReplacement(range.node(ancestor), (builder) {
+            if (expression is MethodInvocation) {
+              var target = expression.target;
+              if (target != null) {
+                builder.write(utils.getNodeText(target));
+                builder.write('.');
+              }
+            }
+            builder.write(utils.getNodeText(expression.function));
+          });
         });
-      });
+      }
     }
 
     final body = ancestor.body;
@@ -47,7 +51,7 @@
         await addFixOfExpression(expression.unParenthesized);
       } else if (statement is ReturnStatement) {
         final expression = statement.expression;
-        await addFixOfExpression(expression.unParenthesized);
+        await addFixOfExpression(expression?.unParenthesized);
       }
     }
   }
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_var.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_var.dart
index dcdee93..1c6da82 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_var.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_var.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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/fix.dart';
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/src/dart/ast/extensions.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
 import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
@@ -44,25 +43,28 @@
         return;
       }
       var initializer = variables[0].initializer;
-      String typeArgumentsText;
-      int typeArgumentsOffset;
-      if (type is NamedType && type.typeArguments != null) {
-        if (initializer is CascadeExpression) {
-          initializer = (initializer as CascadeExpression).target;
-        }
-        if (initializer is TypedLiteral) {
-          if (initializer.typeArguments == null) {
-            typeArgumentsText = utils.getNodeText(type.typeArguments);
-            if (initializer is ListLiteral) {
-              typeArgumentsOffset = initializer.leftBracket.offset;
-            } else if (initializer is SetOrMapLiteral) {
-              typeArgumentsOffset = initializer.leftBracket.offset;
-            }
+      String? typeArgumentsText;
+      int? typeArgumentsOffset;
+      if (type is NamedType) {
+        var typeArguments = type.typeArguments;
+        if (typeArguments != null) {
+          if (initializer is CascadeExpression) {
+            initializer = initializer.target;
           }
-        } else if (initializer is InstanceCreationExpression) {
-          if (initializer.constructorName.type.typeArguments == null) {
-            typeArgumentsText = utils.getNodeText(type.typeArguments);
-            typeArgumentsOffset = initializer.constructorName.type.end;
+          if (initializer is TypedLiteral) {
+            if (initializer.typeArguments == null) {
+              typeArgumentsText = utils.getNodeText(typeArguments);
+              if (initializer is ListLiteral) {
+                typeArgumentsOffset = initializer.leftBracket.offset;
+              } else if (initializer is SetOrMapLiteral) {
+                typeArgumentsOffset = initializer.leftBracket.offset;
+              }
+            }
+          } else if (initializer is InstanceCreationExpression) {
+            if (initializer.constructorName.type.typeArguments == null) {
+              typeArgumentsText = utils.getNodeText(typeArguments);
+              typeArgumentsOffset = initializer.constructorName.type.end;
+            }
           }
         }
       }
@@ -80,19 +82,22 @@
         } else {
           builder.addSimpleReplacement(range.node(type), 'var');
         }
-        if (typeArgumentsText != null) {
+        if (typeArgumentsText != null && typeArgumentsOffset != null) {
           builder.addSimpleInsertion(typeArgumentsOffset, typeArgumentsText);
         }
       });
     } else if (parent is DeclaredIdentifier &&
         grandparent is ForEachPartsWithDeclaration) {
-      String typeArgumentsText;
-      int typeArgumentsOffset;
-      if (type is NamedType && type.typeArguments != null) {
-        var iterable = grandparent.iterable;
-        if (iterable is TypedLiteral && iterable.typeArguments == null) {
-          typeArgumentsText = utils.getNodeText(type.typeArguments);
-          typeArgumentsOffset = iterable.offset;
+      String? typeArgumentsText;
+      int? typeArgumentsOffset;
+      if (type is NamedType) {
+        var typeArguments = type.typeArguments;
+        if (typeArguments != null) {
+          var iterable = grandparent.iterable;
+          if (iterable is TypedLiteral && iterable.typeArguments == null) {
+            typeArgumentsText = utils.getNodeText(typeArguments);
+            typeArgumentsOffset = iterable.offset;
+          }
         }
       }
       await builder.addDartFileEdit(file, (builder) {
@@ -101,7 +106,7 @@
         } else {
           builder.addSimpleReplacement(range.node(type), 'var');
         }
-        if (typeArgumentsText != null) {
+        if (typeArgumentsText != null && typeArgumentsOffset != null) {
           builder.addSimpleInsertion(typeArgumentsOffset, typeArgumentsText);
         }
       });
@@ -110,7 +115,7 @@
 
   /// Return `true` if the type in the [node] can be replaced with `var`.
   bool _canConvertVariableDeclarationList(VariableDeclarationList node) {
-    final staticType = node?.type?.type;
+    final staticType = node.type?.type;
     if (staticType == null || staticType.isDynamic) {
       return false;
     }
@@ -137,10 +142,10 @@
         if (staticType == null || staticType.isDynamic) {
           return false;
         }
-        final iterableType = parent.iterable.staticType;
+        final iterableType = parent.iterable.typeOrThrow;
         var instantiatedType =
             iterableType.asInstanceOf(typeProvider.iterableElement);
-        if (instantiatedType?.typeArguments?.first == staticType) {
+        if (instantiatedType?.typeArguments.first == staticType) {
           return true;
         }
         return false;
@@ -152,7 +157,7 @@
 
   /// Using the [node] as a starting point, return the type annotation that is
   /// to be replaced, or `null` if there is no type annotation.
-  TypeAnnotation _findType(AstNode node) {
+  TypeAnnotation? _findType(AstNode node) {
     if (node is VariableDeclarationList) {
       return node.type;
     }
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/shadow_field.dart b/pkg/analysis_server/lib/src/services/correction/dart/shadow_field.dart
index 8f4de40..c46f159 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/shadow_field.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/shadow_field.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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analyzer/dart/ast/ast.dart';
@@ -20,34 +18,45 @@
 
   @override
   Future<void> compute(ChangeBuilder builder) async {
+    final node = this.node;
     if (node is! SimpleIdentifier) {
       return;
     }
-    var element = (node as SimpleIdentifier).writeOrReadElement;
-    if (element is! PropertyAccessorElement) {
+
+    var accessor = node.writeOrReadElement;
+    if (accessor is! PropertyAccessorElement) {
       return;
     }
-    var accessor = element as PropertyAccessorElement;
+
     if (!accessor.isGetter || accessor.enclosingElement is! ClassElement) {
       // TODO(brianwilkerson) Should we also require that the getter be synthetic?
       return;
     }
+
     var statement = _getStatement();
     if (statement == null) {
       return;
     }
-    if (statement.parent is! Block) {
+
+    var enclosingBlock = statement.parent;
+    if (enclosingBlock is! Block) {
       // TODO(brianwilkerson) Support adding a block between the statement and
       //  its parent (where the parent will be something like a while or if
       //  statement). Also support the case where the parent is a case clause.
       return;
     }
-    var enclosingBlock = statement.parent as Block;
-    var finder = _ReferenceFinder(accessor.correspondingSetter);
+
+    var correspondingSetter = accessor.correspondingSetter;
+    if (correspondingSetter == null) {
+      return;
+    }
+
+    var finder = _ReferenceFinder(correspondingSetter);
     enclosingBlock.accept(finder);
     if (finder.hasSetterReference) {
       return;
     }
+
     var fieldName = accessor.name;
     var offset = statement.offset;
     var prefix = utils.getLinePrefix(offset);
@@ -74,13 +83,13 @@
 
   /// Return the statement immediately enclosing the [node] that would promote
   /// the type of the field if it were replaced by a local variable.
-  Statement _getStatement() {
+  Statement? _getStatement() {
     var parent = node.parent;
 
-    Statement enclosingIf(Expression expression) {
+    Statement? enclosingIf(Expression expression) {
       var parent = expression.parent;
       while (parent is BinaryExpression) {
-        var opType = (parent as BinaryExpression).operator.type;
+        var opType = parent.operator.type;
         if (opType != TokenType.AMPERSAND_AMPERSAND) {
           break;
         }
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/sort_child_property_last.dart b/pkg/analysis_server/lib/src/services/correction/dart/sort_child_property_last.dart
index 6f0d392..e2cc444 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/sort_child_property_last.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/sort_child_property_last.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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/fix.dart';
@@ -32,13 +30,12 @@
       return;
     }
 
-    var parent = childProp.parent?.parent;
-    if (parent is! InstanceCreationExpression ||
-        !flutter.isWidgetCreation(parent)) {
+    var creationExpression = childProp.parent?.parent;
+    if (creationExpression is! InstanceCreationExpression ||
+        !flutter.isWidgetCreation(creationExpression)) {
       return;
     }
 
-    InstanceCreationExpression creationExpression = parent;
     var args = creationExpression.argumentList;
 
     var last = args.arguments.last;
@@ -48,10 +45,10 @@
     }
 
     await builder.addDartFileEdit(file, (fileEditBuilder) {
-      var hasTrailingComma = last.endToken.next.type == TokenType.COMMA;
+      var hasTrailingComma = last.endToken.next!.type == TokenType.COMMA;
 
-      var childStart = childProp.beginToken.previous.end;
-      var childEnd = childProp.endToken.next.end;
+      var childStart = childProp.beginToken.previous!.end;
+      var childEnd = childProp.endToken.next!.end;
       var childRange = range.startOffsetEndOffset(childStart, childEnd);
 
       var deletionRange = childRange;
@@ -69,7 +66,7 @@
 
       var insertionPoint = last.end;
       if (hasTrailingComma) {
-        insertionPoint = last.endToken.next.end;
+        insertionPoint = last.endToken.next!.end;
       } else if (childStart == childProp.offset) {
         childText = ', $childText';
       } else {
@@ -85,7 +82,7 @@
 
   /// Using the [node] as the starting point, find the named expression that is
   /// for either the `child` or `children` parameter.
-  NamedExpression _findNamedExpression(AstNode node) {
+  NamedExpression? _findNamedExpression(AstNode node) {
     if (node is NamedExpression) {
       var name = node.name.label.name;
       if (name == 'child' || name == 'children') {
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/split_and_condition.dart b/pkg/analysis_server/lib/src/services/correction/dart/split_and_condition.dart
index f358b4e8..028d245 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/split_and_condition.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/split_and_condition.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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/util.dart';
@@ -20,10 +18,10 @@
   @override
   Future<void> compute(ChangeBuilder builder) async {
     // check that user invokes quick assist on binary expression
-    if (node is! BinaryExpression) {
+    var binaryExpression = node;
+    if (binaryExpression is! BinaryExpression) {
       return;
     }
-    var binaryExpression = node as BinaryExpression;
     // prepare operator position
     if (!isOperatorSelected(binaryExpression)) {
       return;
@@ -33,11 +31,10 @@
       return;
     }
     // prepare "if"
-    var statement = node.thisOrAncestorOfType<Statement>();
-    if (statement is! IfStatement) {
+    var ifStatement = node.thisOrAncestorOfType<Statement>();
+    if (ifStatement is! IfStatement) {
       return;
     }
-    var ifStatement = statement as IfStatement;
     // no support "else"
     if (ifStatement.elseStatement != null) {
       return;
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/split_variable_declaration.dart b/pkg/analysis_server/lib/src/services/correction/dart/split_variable_declaration.dart
index c5b109e..83073d8 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/split_variable_declaration.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/split_variable_declaration.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 'package:_fe_analyzer_shared/src/scanner/token.dart';
 import 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
@@ -18,16 +16,20 @@
 
   @override
   Future<void> compute(ChangeBuilder builder) async {
-    var variableList = node?.thisOrAncestorOfType<VariableDeclarationList>();
-
-    // Must be a local variable declaration.
-    if (variableList?.parent is! VariableDeclarationStatement) {
+    var variableList = node.thisOrAncestorOfType<VariableDeclarationList>();
+    if (variableList == null) {
       return;
     }
-    VariableDeclarationStatement statement = variableList.parent;
+
+    // Must be a local variable declaration.
+    var statement = variableList.parent;
+    if (statement is! VariableDeclarationStatement) {
+      return;
+    }
 
     // Cannot be `const` or `final`.
-    var keywordKind = variableList.keyword?.keyword;
+    var keyword = variableList.keyword;
+    var keywordKind = keyword?.keyword;
     if (keywordKind == Keyword.CONST || keywordKind == Keyword.FINAL) {
       return;
     }
@@ -50,9 +52,9 @@
 
     await builder.addDartFileEdit(file, (builder) {
       if (variableList.type == null) {
-        final type = variable.declaredElement.type;
-        if (!type.isDynamic) {
-          builder.addReplacement(range.token(variableList.keyword), (builder) {
+        final type = variable.declaredElement!.type;
+        if (!type.isDynamic && keyword != null) {
+          builder.addReplacement(range.token(keyword), (builder) {
             builder.writeType(type);
           });
         }
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/surround_with.dart b/pkg/analysis_server/lib/src/services/correction/dart/surround_with.dart
index e2868bb..84d8648 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/surround_with.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/surround_with.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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/statement_analyzer.dart';
@@ -249,7 +247,8 @@
 
   @override
   Future<void> compute(ChangeBuilder builder) async {
-    var classDeclaration = node.parent.thisOrAncestorOfType<ClassDeclaration>();
+    var classDeclaration =
+        node.parent?.thisOrAncestorOfType<ClassDeclaration>();
     if (classDeclaration != null &&
         flutter.isState(classDeclaration.declaredElement)) {
       await builder.addDartFileEdit(file, (builder) {
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/update_sdk_constraints.dart b/pkg/analysis_server/lib/src/services/correction/dart/update_sdk_constraints.dart
index dddf351..4cab9d2 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/update_sdk_constraints.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/update_sdk_constraints.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 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/fix.dart';
 import 'package:analyzer/file_system/file_system.dart';
@@ -25,32 +23,25 @@
 
   @override
   Future<void> compute(ChangeBuilder builder) async {
-    var context = resourceProvider.pathContext;
-    File pubspecFile;
-    var folder = resourceProvider.getFolder(context.dirname(file));
-    while (folder != null) {
-      pubspecFile = folder.getChildAssumingFile('pubspec.yaml');
-      if (pubspecFile.exists) {
-        break;
-      }
-      pubspecFile = null;
-      folder = folder.parent2;
-    }
+    var pubspecFile = _findPubspecFile();
     if (pubspecFile == null) {
       return;
     }
+
     var extractor = SdkConstraintExtractor(pubspecFile);
     var text = extractor.constraintText();
     var offset = extractor.constraintOffset();
     if (text == null || offset < 0) {
       return;
     }
+
     var length = text.length;
-    String newText;
     var spaceOffset = text.indexOf(' ');
     if (spaceOffset >= 0) {
       length = spaceOffset;
     }
+
+    String? newText;
     if (text == 'any') {
       newText = '^$_minimumVersion';
     } else if (text.startsWith('^')) {
@@ -63,11 +54,23 @@
     if (newText == null) {
       return;
     }
+
+    final newText_final = newText;
     await builder.addGenericFileEdit(pubspecFile.path, (builder) {
-      builder.addSimpleReplacement(SourceRange(offset, length), newText);
+      builder.addSimpleReplacement(SourceRange(offset, length), newText_final);
     });
   }
 
+  File? _findPubspecFile() {
+    var file = resourceProvider.getFile(this.file);
+    for (var folder in file.parent2.withAncestors) {
+      var pubspecFile = folder.getChildAssumingFile('pubspec.yaml');
+      if (pubspecFile.exists) {
+        return pubspecFile;
+      }
+    }
+  }
+
   /// Return an instance of this class that will update the SDK constraints to
   /// '2.1.0'. Used as a tear-off in `FixProcessor`.
   static UpdateSdkConstraints version_2_1_0() => UpdateSdkConstraints('2.1.0');
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/use_const.dart b/pkg/analysis_server/lib/src/services/correction/dart/use_const.dart
index 1c9d823..110432e 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/use_const.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/use_const.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 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/fix.dart';
 import 'package:analyzer/dart/ast/ast.dart';
@@ -20,12 +18,12 @@
     if (coveredNode is InstanceCreationExpression) {
       var instanceCreation = coveredNode as InstanceCreationExpression;
       await builder.addDartFileEdit(file, (builder) {
-        if (instanceCreation.keyword == null) {
+        var keyword = instanceCreation.keyword;
+        if (keyword == null) {
           builder.addSimpleInsertion(
               instanceCreation.constructorName.offset, 'const');
         } else {
-          builder.addSimpleReplacement(
-              range.token(instanceCreation.keyword), 'const');
+          builder.addSimpleReplacement(range.token(keyword), 'const');
         }
       });
     }
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/use_curly_braces.dart b/pkg/analysis_server/lib/src/services/correction/dart/use_curly_braces.dart
index f76e561..b414e48 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/use_curly_braces.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/use_curly_braces.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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/fix.dart';
@@ -37,9 +35,12 @@
     } else if (parent is ForStatement) {
       return _forStatement(builder, parent);
     } else if (statement is IfStatement) {
-      if (statement.elseKeyword != null &&
-          range.token(statement.elseKeyword).contains(selectionOffset)) {
-        return _ifStatement(builder, statement, statement.elseStatement);
+      var elseKeyword = statement.elseKeyword;
+      var elseStatement = statement.elseStatement;
+      if (elseKeyword != null &&
+          elseStatement != null &&
+          range.token(elseKeyword).contains(selectionOffset)) {
+        return _ifStatement(builder, statement, elseStatement);
       } else {
         return _ifStatement(builder, statement, null);
       }
@@ -88,21 +89,22 @@
   }
 
   Future<void> _ifStatement(
-      ChangeBuilder builder, IfStatement node, Statement thenOrElse) async {
+      ChangeBuilder builder, IfStatement node, Statement? thenOrElse) async {
     var prefix = utils.getLinePrefix(node.offset);
     var indent = prefix + utils.getIndent(1);
 
     await builder.addDartFileEdit(file, (builder) {
       var thenStatement = node.thenStatement;
+      var elseKeyword = node.elseKeyword;
       if (thenStatement is! Block &&
           (thenOrElse == null || thenOrElse == thenStatement)) {
         builder.addSimpleReplacement(
           range.endStart(node.rightParenthesis, thenStatement),
           ' {$eol$indent',
         );
-        if (node.elseKeyword != null) {
+        if (elseKeyword != null) {
           builder.addSimpleReplacement(
-            range.endStart(thenStatement, node.elseKeyword),
+            range.endStart(thenStatement, elseKeyword),
             '$eol$prefix} ',
           );
         } else {
@@ -111,11 +113,12 @@
       }
 
       var elseStatement = node.elseStatement;
-      if (elseStatement != null &&
+      if (elseKeyword != null &&
+          elseStatement != null &&
           elseStatement is! Block &&
           (thenOrElse == null || thenOrElse == elseStatement)) {
         builder.addSimpleReplacement(
-          range.endStart(node.elseKeyword, elseStatement),
+          range.endStart(elseKeyword, elseStatement),
           ' {$eol$indent',
         );
         builder.addSimpleInsertion(elseStatement.end, '$eol$prefix}');
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/use_effective_integer_division.dart b/pkg/analysis_server/lib/src/services/correction/dart/use_effective_integer_division.dart
index babab16..5a0839d 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/use_effective_integer_division.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/use_effective_integer_division.dart
@@ -2,10 +2,9 @@
 // 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 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/fix.dart';
+import 'package:analysis_server/src/utilities/extensions/ast.dart';
 import 'package:analyzer/dart/ast/ast.dart';
 import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
 import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
@@ -17,21 +16,24 @@
 
   @override
   Future<void> compute(ChangeBuilder builder) async {
-    for (var n = node; n != null; n = n.parent) {
-      if (n is MethodInvocation &&
-          n.offset == errorOffset &&
-          n.length == errorLength) {
-        var target = (n as MethodInvocation).target.unParenthesized;
-        await builder.addDartFileEdit(file, (builder) {
-          // replace "/" with "~/"
-          var binary = target as BinaryExpression;
-          builder.addSimpleReplacement(range.token(binary.operator), '~/');
-          // remove everything before and after
-          builder.addDeletion(range.startStart(n, binary.leftOperand));
-          builder.addDeletion(range.endEnd(binary.rightOperand, n));
-        });
-        // done
-        break;
+    for (var n in node.withParents) {
+      if (n is MethodInvocation) {
+        if (n.offset == errorOffset && n.length == errorLength) {
+          var target = n.target;
+          if (target != null) {
+            target = target.unParenthesized;
+            await builder.addDartFileEdit(file, (builder) {
+              // replace "/" with "~/"
+              var binary = target as BinaryExpression;
+              builder.addSimpleReplacement(range.token(binary.operator), '~/');
+              // remove everything before and after
+              builder.addDeletion(range.startStart(n, binary.leftOperand));
+              builder.addDeletion(range.endEnd(binary.rightOperand, n));
+            });
+          }
+          // done
+          break;
+        }
       }
     }
   }
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/use_eq_eq_null.dart b/pkg/analysis_server/lib/src/services/correction/dart/use_eq_eq_null.dart
index ce4e1f4..86ad614 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/use_eq_eq_null.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/use_eq_eq_null.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 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/fix.dart';
 import 'package:analyzer/dart/ast/ast.dart';
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/use_is_not_empty.dart b/pkg/analysis_server/lib/src/services/correction/dart/use_is_not_empty.dart
index ca10cbf..8b06bc9 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/use_is_not_empty.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/use_is_not_empty.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 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/fix.dart';
 import 'package:analyzer/dart/ast/ast.dart';
@@ -21,10 +19,10 @@
 
   @override
   Future<void> compute(ChangeBuilder builder) async {
-    if (node is! PrefixExpression) {
+    var prefixExpression = node;
+    if (prefixExpression is! PrefixExpression) {
       return;
     }
-    PrefixExpression prefixExpression = node;
     var negation = prefixExpression.operator;
     if (negation.type != TokenType.BANG) {
       return;
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/use_not_eq_null.dart b/pkg/analysis_server/lib/src/services/correction/dart/use_not_eq_null.dart
index 120e87d..e53bc02 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/use_not_eq_null.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/use_not_eq_null.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 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/fix.dart';
 import 'package:analyzer/dart/ast/ast.dart';
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/use_rethrow.dart b/pkg/analysis_server/lib/src/services/correction/dart/use_rethrow.dart
index dc55220..9ebe4dc 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/use_rethrow.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/use_rethrow.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 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/fix.dart';
 import 'package:analyzer/dart/ast/ast.dart';
@@ -20,6 +18,7 @@
 
   @override
   Future<void> compute(ChangeBuilder builder) async {
+    final coveredNode = this.coveredNode;
     if (coveredNode is ThrowExpression) {
       await builder.addDartFileEdit(file, (builder) {
         builder.addSimpleReplacement(range.node(coveredNode), 'rethrow');
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/wrap_in_text.dart b/pkg/analysis_server/lib/src/services/correction/dart/wrap_in_text.dart
index bfd97f5..49fb849 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/wrap_in_text.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/wrap_in_text.dart
@@ -2,20 +2,16 @@
 // 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 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
 import 'package:analysis_server/src/services/correction/fix.dart';
 import 'package:analyzer/dart/ast/ast.dart';
 import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/src/dart/ast/extensions.dart';
 import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
 import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
 import 'package:analyzer_plugin/utilities/range_factory.dart';
 
 class WrapInText extends CorrectionProducer {
-  ParameterElement _parameterElement;
-  Expression _stringExpression;
-
   @override
   FixKind get fixKind => DartFixKind.WRAP_IN_TEXT;
 
@@ -24,43 +20,55 @@
     //
     // Extract the information needed to build the edit.
     //
-    _extractContextInformation(node);
-    if (_parameterElement == null || _stringExpression == null) {
+    var context = _extractContextInformation(node);
+    if (context == null) {
       return;
     }
-    if (!flutter.isWidgetType(_parameterElement.type)) {
+    if (!flutter.isWidgetType(context.parameterElement.type)) {
       return;
     }
 
     //
     // Extract the information needed to build the edit.
     //
-    var stringExpressionCode = utils.getNodeText(_stringExpression);
+    var stringExpressionCode = utils.getNodeText(context.stringExpression);
 
     //
     // Build the edit.
     //
     await builder.addDartFileEdit(file, (builder) {
       builder.addSimpleReplacement(
-        range.node(_stringExpression),
+        range.node(context.stringExpression),
         'Text($stringExpressionCode)',
       );
     });
   }
 
-  /// Set the `String` typed named expression to [_stringExpression], and the
-  /// corresponding parameter to [_parameterElement]. Leave the fields `null`
-  /// if not a named argument, or not a `String` typed expression.
-  void _extractContextInformation(AstNode node) {
+  /// Return an instance of this class. Used as a tear-off in `FixProcessor`.
+  static WrapInText newInstance() => WrapInText();
+
+  static _Context? _extractContextInformation(AstNode node) {
     if (node is NamedExpression) {
       var expression = node.expression;
-      if (expression.staticType.isDartCoreString) {
-        _parameterElement = node.name.label.staticElement;
-        _stringExpression = expression;
+      if (expression.typeOrThrow.isDartCoreString) {
+        var parameterElement = node.name.label.staticElement;
+        if (parameterElement is ParameterElement) {
+          return _Context(
+            stringExpression: expression,
+            parameterElement: parameterElement,
+          );
+        }
       }
     }
   }
+}
 
-  /// Return an instance of this class. Used as a tear-off in `FixProcessor`.
-  static WrapInText newInstance() => WrapInText();
+class _Context {
+  final Expression stringExpression;
+  final ParameterElement parameterElement;
+
+  _Context({
+    required this.stringExpression,
+    required this.parameterElement,
+  });
 }
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/analysis_options/fix_generator.dart b/pkg/analysis_server/lib/src/services/correction/fix/analysis_options/fix_generator.dart
index 31034bf..5b5d7cf 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/analysis_options/fix_generator.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/analysis_options/fix_generator.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:math' as math;
 
 import 'package:analysis_server/plugin/edit/fix/fix_core.dart';
@@ -38,8 +36,6 @@
 
   final List<Fix> fixes = <Fix>[];
 
-  List<YamlNode> coveringNodePath;
-
   AnalysisOptionsFixGenerator(this.error, this.content, this.options)
       : errorOffset = error.offset,
         errorLength = error.length,
@@ -53,7 +49,7 @@
   Future<List<Fix>> computeFixes() async {
     var locator =
         YamlNodeLocator(start: errorOffset, end: errorOffset + errorLength - 1);
-    coveringNodePath = locator.searchWithin(options);
+    var coveringNodePath = locator.searchWithin(options);
     if (coveringNodePath.isEmpty) {
       return fixes;
     }
@@ -70,10 +66,10 @@
 //    } else
 
     if (errorCode == DEPRECATED_LINT_HINT) {
-      await _addFix_removeLint();
+      await _addFix_removeLint(coveringNodePath);
     } else if (errorCode ==
         AnalysisOptionsHintCode.SUPER_MIXINS_SETTING_DEPRECATED) {
-      await _addFix_removeSetting();
+      await _addFix_removeSetting(coveringNodePath);
 //    } else if (errorCode ==
 //        AnalysisOptionsWarningCode.ANALYSIS_OPTION_DEPRECATED) {
 //    } else if (errorCode == AnalysisOptionsWarningCode.INCLUDED_FILE_WARNING) {
@@ -85,7 +81,7 @@
 //        AnalysisOptionsWarningCode.UNRECOGNIZED_ERROR_CODE) {
     } else if (errorCode ==
         AnalysisOptionsWarningCode.UNSUPPORTED_OPTION_WITHOUT_VALUES) {
-      await _addFix_removeSetting();
+      await _addFix_removeSetting(coveringNodePath);
 //    } else if (errorCode ==
 //        AnalysisOptionsWarningCode.UNSUPPORTED_OPTION_WITH_LEGAL_VALUE) {
 //    } else if (errorCode ==
@@ -95,16 +91,16 @@
     return fixes;
   }
 
-  Future<void> _addFix_removeLint() async {
-    var builder = await _createScalarDeletionBuilder();
+  Future<void> _addFix_removeLint(List<YamlNode> coveringNodePath) async {
+    var builder = await _createScalarDeletionBuilder(coveringNodePath);
     if (builder != null) {
       _addFixFromBuilder(builder, AnalysisOptionsFixKind.REMOVE_LINT,
           args: [coveringNodePath[0].toString()]);
     }
   }
 
-  Future<void> _addFix_removeSetting() async {
-    var builder = await _createScalarDeletionBuilder();
+  Future<void> _addFix_removeSetting(List<YamlNode> coveringNodePath) async {
+    var builder = await _createScalarDeletionBuilder(coveringNodePath);
     if (builder != null) {
       _addFixFromBuilder(builder, AnalysisOptionsFixKind.REMOVE_SETTING,
           args: [coveringNodePath[0].toString()]);
@@ -114,7 +110,7 @@
   /// Add a fix whose edits were built by the [builder] that has the given
   /// [kind]. If [args] are provided, they will be used to fill in the message
   /// for the fix.
-  void _addFixFromBuilder(ChangeBuilder builder, FixKind kind, {List args}) {
+  void _addFixFromBuilder(ChangeBuilder builder, FixKind kind, {List? args}) {
     var change = builder.sourceChange;
     if (change.edits.isEmpty) {
       return;
@@ -123,12 +119,14 @@
     fixes.add(Fix(kind, change));
   }
 
-  Future<ChangeBuilder> _createScalarDeletionBuilder() async {
+  Future<ChangeBuilder?> _createScalarDeletionBuilder(
+    List<YamlNode> coveringNodePath,
+  ) async {
     if (coveringNodePath[0] is! YamlScalar) {
       return null;
     }
 
-    SourceRange deletionRange;
+    SourceRange? deletionRange;
     var index = 1;
     while (index < coveringNodePath.length) {
       var parent = coveringNodePath[index];
@@ -142,8 +140,8 @@
       } else if (parent is YamlMap) {
         var nodes = parent.nodes;
         if (nodes.length > 1) {
-          YamlNode key;
-          YamlNode value;
+          YamlNode? key;
+          YamlNode? value;
           var child = coveringNodePath[index - 1];
           if (nodes.containsKey(child)) {
             key = child;
@@ -176,8 +174,10 @@
     var builder = ChangeBuilder(
       workspace: _NonDartChangeWorkspace(),
     );
+
+    final deletionRange_final = deletionRange;
     await builder.addGenericFileEdit(file, (builder) {
-      builder.addDeletion(deletionRange);
+      builder.addDeletion(deletionRange_final);
     });
     return builder;
   }
@@ -190,9 +190,9 @@
   }
 
   SourceRange _lines(int start, int end) {
-    CharacterLocation startLocation = lineInfo.getLocation(start);
+    var startLocation = lineInfo.getLocation(start);
     var startOffset = lineInfo.getOffsetOfLine(startLocation.lineNumber - 1);
-    CharacterLocation endLocation = lineInfo.getLocation(end);
+    var endLocation = lineInfo.getLocation(end);
     var endOffset = lineInfo.getOffsetOfLine(
         math.min(endLocation.lineNumber, lineInfo.lineCount - 1));
     return SourceRange(startOffset, endOffset - startOffset);
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/add_type_parameter.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/add_type_parameter.dart
index c75c1dc..86dcc3b 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/add_type_parameter.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/add_type_parameter.dart
@@ -2,14 +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 'package:analysis_server/src/services/correction/dart/data_driven.dart';
 import 'package:analysis_server/src/services/correction/fix/data_driven/change.dart';
 import 'package:analysis_server/src/services/correction/fix/data_driven/code_template.dart';
 import 'package:analyzer/dart/ast/ast.dart';
 import 'package:analyzer_plugin/utilities/change_builder/change_builder_dart.dart';
-import 'package:meta/meta.dart';
 
 /// The data related to a type parameter that was added to either a function or
 /// a type.
@@ -22,7 +19,7 @@
 
   /// The name of the type that the type parameter extends, or `null` if the
   /// type parameter doesn't have a bound.
-  final CodeTemplate extendedType;
+  final CodeTemplate? extendedType;
 
   /// The code template used to compute the value of the type argument.
   final CodeTemplate argumentValue;
@@ -30,13 +27,11 @@
   /// Initialize a newly created change to describe adding a type parameter to a
   /// type or a function.
   AddTypeParameter(
-      {@required this.index,
-      @required this.name,
-      @required this.argumentValue,
-      @required this.extendedType})
-      : assert(index >= 0),
-        assert(name != null),
-        assert(argumentValue != null);
+      {required this.index,
+      required this.name,
+      required this.argumentValue,
+      required this.extendedType})
+      : assert(index >= 0);
 
   @override
   void apply(DartFileEditBuilder builder, DataDrivenFix fix, _Data data) {
@@ -50,7 +45,7 @@
   }
 
   @override
-  _Data validate(DataDrivenFix fix) {
+  _Data? validate(DataDrivenFix fix) {
     var node = fix.node;
     var context = TemplateContext.forInvocation(node, fix.utils);
     if (node is NamedType) {
@@ -68,8 +63,7 @@
     var parent = node.parent;
     if (parent is InvocationExpression) {
       // wrong_number_of_type_arguments_method
-      var argument = argumentValue.validate(context);
-      if (argument == null) {
+      if (!argumentValue.validate(context)) {
         return null;
       }
       var typeArguments = parent.typeArguments;
@@ -79,6 +73,7 @@
       return _TypeArgumentData(typeArguments, parent.argumentList.offset);
     } else if (parent is MethodDeclaration) {
       // invalid_override
+      var extendedType = this.extendedType;
       if (extendedType != null && !extendedType.validate(context)) {
         return null;
       }
@@ -89,11 +84,10 @@
       return _TypeParameterData(typeParameters, parent.name.end);
     } else if (node is TypeArgumentList && parent is ExtensionOverride) {
       // wrong_number_of_type_arguments_extension
-      var argument = argumentValue.validate(context);
-      if (argument == null) {
+      if (!argumentValue.validate(context)) {
         return null;
       }
-      if (_isInvalidIndex(node?.arguments)) {
+      if (_isInvalidIndex(node.arguments)) {
         return null;
       }
       return _TypeArgumentData(node, parent.extensionName.end);
@@ -136,6 +130,7 @@
 
     void writeParameter(DartEditBuilder builder) {
       builder.write(name);
+      var extendedType = this.extendedType;
       if (extendedType != null) {
         builder.write(' extends ');
         extendedType.writeOn(builder, context);
@@ -168,7 +163,7 @@
     }
   }
 
-  bool _isInvalidIndex(List<AstNode> list) {
+  bool _isInvalidIndex(List<AstNode>? list) {
     var length = list == null ? 0 : list.length;
     return index > length;
   }
@@ -181,7 +176,7 @@
 class _TypeArgumentData extends _Data {
   /// The list of type arguments to which a new type argument is being added, or
   /// `null` if the first type argument is being added.
-  final TypeArgumentList typeArguments;
+  final TypeArgumentList? typeArguments;
 
   /// The offset at which the type argument list should be inserted if
   /// [typeArguments] is `null`.
@@ -195,7 +190,7 @@
 class _TypeParameterData extends _Data {
   /// The list of type parameters to which a new type parameter is being added,
   /// or `null` if the first type parameter is being added.
-  final TypeParameterList typeParameters;
+  final TypeParameterList? typeParameters;
 
   /// The offset at which the type parameter list should be inserted if
   /// [typeParameters] is `null`.
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/change.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/change.dart
index 2966d55..f0d50bc 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/change.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/change.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 'package:analysis_server/src/services/correction/dart/data_driven.dart';
 import 'package:analyzer_plugin/utilities/change_builder/change_builder_dart.dart';
 
@@ -16,5 +14,5 @@
 
   /// Validate that this change can be applied. Return the data to be passed to
   /// [apply] if the change can be applied, or `null` if it can't be applied.
-  D validate(DataDrivenFix fix);
+  D? validate(DataDrivenFix fix);
 }
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/changes_selector.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/changes_selector.dart
index e8e7a33..cd8b2f5 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/changes_selector.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/changes_selector.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 'package:analysis_server/src/services/correction/fix/data_driven/change.dart';
 import 'package:analysis_server/src/services/correction/fix/data_driven/code_template.dart';
 import 'package:analysis_server/src/services/correction/fix/data_driven/expression.dart';
@@ -12,7 +10,7 @@
 /// possible lists.
 abstract class ChangesSelector {
   /// Return the list of changes that should be applied based on the [context].
-  List<Change> getChanges(TemplateContext context);
+  List<Change>? getChanges(TemplateContext context);
 }
 
 /// A changes selector that uses boolean-valued conditions to select the list.
@@ -26,7 +24,7 @@
   ConditionalChangesSelector(this.changeMap);
 
   @override
-  List<Change> getChanges(TemplateContext context) {
+  List<Change>? getChanges(TemplateContext context) {
     for (var entry in changeMap.entries) {
       var value = entry.key.evaluateIn(context);
       if (value is bool && value) {
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/code_fragment_parser.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/code_fragment_parser.dart
index bebdc17..3b561ca 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/code_fragment_parser.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/code_fragment_parser.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 'package:analysis_server/src/services/correction/fix/data_driven/accessor.dart';
 import 'package:analysis_server/src/services/correction/fix/data_driven/expression.dart';
 import 'package:analysis_server/src/services/correction/fix/data_driven/parameter_reference.dart';
@@ -21,21 +19,21 @@
 
   /// The amount to be added to translate from offsets within the content to
   /// offsets within the file.
-  int delta;
+  int delta = 0;
 
   /// The tokens being parsed.
-  /* late */ List<_Token> tokens;
+  late List<_Token> tokens;
 
   /// The index in the [tokens] of the next token to be consumed.
   int currentIndex = 0;
 
   /// Initialize a newly created parser to report errors to the [errorReporter].
-  CodeFragmentParser(this.errorReporter, {VariableScope scope})
+  CodeFragmentParser(this.errorReporter, {VariableScope? scope})
       : variableScope = scope ?? VariableScope(null, {});
 
   /// Return the current token, or `null` if the end of the tokens has been
   /// reached.
-  _Token get currentToken =>
+  _Token? get currentToken =>
       currentIndex < tokens.length ? tokens[currentIndex] : null;
 
   /// Advance to the next token.
@@ -50,13 +48,15 @@
   ///
   /// <content> ::=
   ///   <accessor> ('.' <accessor>)*
-  List<Accessor> parseAccessors(String content, int delta) {
+  List<Accessor>? parseAccessors(String content, int delta) {
     this.delta = delta;
-    tokens = _CodeFragmentScanner(content, delta, errorReporter).scan();
-    if (tokens == null) {
+    var scannedTokens =
+        _CodeFragmentScanner(content, delta, errorReporter).scan();
+    if (scannedTokens == null) {
       // The error has already been reported.
       return null;
     }
+    tokens = scannedTokens;
     currentIndex = 0;
     var accessors = <Accessor>[];
     var accessor = _parseAccessor();
@@ -66,6 +66,9 @@
     accessors.add(accessor);
     while (currentIndex < tokens.length) {
       var token = currentToken;
+      if (token == null) {
+        return accessors;
+      }
       if (token.kind == _TokenKind.period) {
         advance();
         accessor = _parseAccessor();
@@ -87,13 +90,15 @@
   ///
   /// <content> ::=
   ///   <logicalExpression>
-  Expression parseCondition(String content, int delta) {
+  Expression? parseCondition(String content, int delta) {
     this.delta = delta;
-    tokens = _CodeFragmentScanner(content, delta, errorReporter).scan();
-    if (tokens == null) {
+    var scannedTokens =
+        _CodeFragmentScanner(content, delta, errorReporter).scan();
+    if (scannedTokens == null) {
       // The error has already been reported.
       return null;
     }
+    tokens = scannedTokens;
     currentIndex = 0;
     var expression = _parseLogicalAndExpression();
     if (currentIndex < tokens.length) {
@@ -107,7 +112,7 @@
 
   /// Return the current token if it exists and has one of the [validKinds].
   /// Report an error and return `null` if those conditions aren't met.
-  _Token _expect(List<_TokenKind> validKinds) {
+  _Token? _expect(List<_TokenKind> validKinds) {
     String validKindsDisplayString() {
       var buffer = StringBuffer();
       for (var i = 0; i < validKinds.length; i++) {
@@ -151,7 +156,7 @@
   ///
   /// <accessor> ::=
   ///   <identifier> '[' (<integer> | <identifier>) ']'
-  Accessor _parseAccessor() {
+  Accessor? _parseAccessor() {
     var token = _expect(const [_TokenKind.identifier]);
     if (token == null) {
       // The error has already been reported.
@@ -221,7 +226,7 @@
   ///   <primaryExpression> (<comparisonOperator> <primaryExpression>)?
   /// <comparisonOperator> ::=
   ///   '==' | '!='
-  Expression _parseEqualityExpression() {
+  Expression? _parseEqualityExpression() {
     var expression = _parsePrimaryExpression();
     if (expression == null) {
       return null;
@@ -229,7 +234,7 @@
     if (currentIndex >= tokens.length) {
       return expression;
     }
-    var kind = currentToken.kind;
+    var kind = currentToken?.kind;
     if (kind == _TokenKind.equal || kind == _TokenKind.notEqual) {
       advance();
       var operator =
@@ -247,15 +252,16 @@
   ///
   /// <logicalExpression> ::=
   ///   <equalityExpression> ('&&' <equalityExpression>)*
-  Expression _parseLogicalAndExpression() {
-    var expression = _parseEqualityExpression();
-    if (expression == null) {
+  Expression? _parseLogicalAndExpression() {
+    var leftOperand = _parseEqualityExpression();
+    if (leftOperand == null) {
       return null;
     }
     if (currentIndex >= tokens.length) {
-      return expression;
+      return leftOperand;
     }
-    var kind = currentToken.kind;
+    var expression = leftOperand;
+    var kind = currentToken?.kind;
     while (kind == _TokenKind.and) {
       advance();
       var rightOperand = _parseEqualityExpression();
@@ -266,7 +272,7 @@
       if (currentIndex >= tokens.length) {
         return expression;
       }
-      kind = currentToken.kind;
+      kind = currentToken?.kind;
     }
     return expression;
   }
@@ -275,27 +281,29 @@
   ///
   /// <primaryExpression> ::=
   ///   <identifier> | <string>
-  Expression _parsePrimaryExpression() {
+  Expression? _parsePrimaryExpression() {
     var token = currentToken;
-    var kind = token?.kind;
-    if (kind == _TokenKind.identifier) {
-      advance();
-      var variableName = token.lexeme;
-      var generator = variableScope.lookup(variableName);
-      if (generator == null) {
-        errorReporter.reportErrorForOffset(
-            TransformSetErrorCode.undefinedVariable,
-            token.offset + delta,
-            token.length,
-            [variableName]);
-        return null;
+    if (token != null) {
+      var kind = token.kind;
+      if (kind == _TokenKind.identifier) {
+        advance();
+        var variableName = token.lexeme;
+        var generator = variableScope.lookup(variableName);
+        if (generator == null) {
+          errorReporter.reportErrorForOffset(
+              TransformSetErrorCode.undefinedVariable,
+              token.offset + delta,
+              token.length,
+              [variableName]);
+          return null;
+        }
+        return VariableReference(generator);
+      } else if (kind == _TokenKind.string) {
+        advance();
+        var lexeme = token.lexeme;
+        var value = lexeme.substring(1, lexeme.length - 1);
+        return LiteralString(value);
       }
-      return VariableReference(generator);
-    } else if (kind == _TokenKind.string) {
-      advance();
-      var lexeme = token.lexeme;
-      var value = lexeme.substring(1, lexeme.length - 1);
-      return LiteralString(value);
     }
     int offset;
     int length;
@@ -356,7 +364,7 @@
 
   /// Return the tokens in the content, or `null` if there is an error in the
   /// content that prevents it from being scanned.
-  List<_Token> scan() {
+  List<_Token>? scan() {
     var length = content.length;
 
     int peekAt(int offset) {
@@ -515,6 +523,5 @@
       case _TokenKind.string:
         return 'a string';
     }
-    return '';
   }
 }
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/code_template.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/code_template.dart
index 3a89d93..ce509a1 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/code_template.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/code_template.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 'package:analysis_server/src/services/correction/fix/data_driven/expression.dart'
     as data_driven;
 import 'package:analysis_server/src/services/correction/fix/data_driven/value_generator.dart';
@@ -21,13 +19,11 @@
 
   /// The expression used to determine whether the template is required to be
   /// used, or `null` if the template is not required to be used.
-  final data_driven.Expression requiredIfCondition;
+  final data_driven.Expression? requiredIfCondition;
 
   /// Initialize a newly generated code template with the given [kind] and
   /// [components].
-  CodeTemplate(this.kind, this.components, this.requiredIfCondition)
-      : assert(kind != null),
-        assert(components != null);
+  CodeTemplate(this.kind, this.components, this.requiredIfCondition);
 
   /// Use the [context] to validate that this template will be able to generate
   /// a value.
@@ -69,7 +65,7 @@
 /// The context in which a template is being evaluated.
 class TemplateContext {
   /// The node in the AST that is being transformed.
-  final AstNode node;
+  final AstNode? node;
 
   /// The utilities used to help extract the code associated with various nodes.
   final CorrectionUtils utils;
@@ -85,11 +81,11 @@
   /// Return the invocation containing the given [node]. The invocation will be
   /// either an instance creation expression, function invocation, method
   /// invocation, or an extension override.
-  static AstNode _getInvocation(AstNode node) {
+  static AstNode? _getInvocation(AstNode node) {
     if (node is ArgumentList) {
       return node.parent;
     } else if (node.parent is ArgumentList) {
-      return node.parent.parent;
+      return node.parent?.parent;
     } else if (node is InstanceCreationExpression ||
         node is InvocationExpression) {
       return node;
@@ -101,13 +97,13 @@
           return grandparent;
         }
       } else if (parent is Label && parent.parent is NamedExpression) {
-        return parent.parent.parent.parent;
+        return parent.parent?.parent?.parent;
       } else if (parent is MethodInvocation && parent.methodName == node) {
         return parent;
       } else if (parent is TypeName &&
           parent.parent is ConstructorName &&
-          parent.parent.parent is InstanceCreationExpression) {
-        return parent.parent.parent;
+          parent.parent?.parent is InstanceCreationExpression) {
+        return parent.parent?.parent;
       }
     } else if (node is TypeArgumentList) {
       var parent = node.parent;
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/expression.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/expression.dart
index 3a554d3..f23a609 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/expression.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/expression.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 'package:analysis_server/src/services/correction/fix/data_driven/code_template.dart';
 import 'package:analysis_server/src/services/correction/fix/data_driven/value_generator.dart';
 
@@ -23,7 +21,7 @@
   BinaryExpression(this.leftOperand, this.operator, this.rightOperand);
 
   @override
-  Object evaluateIn(TemplateContext context) {
+  Object? evaluateIn(TemplateContext context) {
     switch (operator) {
       case Operator.and:
         var left = leftOperand.evaluateIn(context);
@@ -41,7 +39,6 @@
         var right = rightOperand.evaluateIn(context);
         return left != right;
     }
-    return null;
   }
 
   @override
@@ -50,8 +47,9 @@
 
 /// An expression.
 abstract class Expression {
-  /// Return the result of evaluating this expression.
-  Object evaluateIn(TemplateContext context);
+  /// Return the result of evaluating this expression, or `null` if the
+  /// expression can't be evaluated in the given [context].
+  Object? evaluateIn(TemplateContext context);
 }
 
 /// A literal string.
@@ -106,6 +104,5 @@
       case Operator.notEqual:
         return '!=';
     }
-    return 'impossible';
   }
 }
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/modify_parameters.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/modify_parameters.dart
index 76ec8f6..56e83f4 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/modify_parameters.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/modify_parameters.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 'package:analysis_server/src/services/correction/dart/data_driven.dart';
 import 'package:analysis_server/src/services/correction/fix/data_driven/change.dart';
 import 'package:analysis_server/src/services/correction/fix/data_driven/code_template.dart';
@@ -11,7 +9,6 @@
 import 'package:analyzer/dart/ast/ast.dart';
 import 'package:analyzer_plugin/utilities/change_builder/change_builder_dart.dart';
 import 'package:analyzer_plugin/utilities/range_factory.dart';
-import 'package:meta/meta.dart';
 
 /// The addition of a new parameter.
 class AddParameter extends ParameterModification {
@@ -33,15 +30,14 @@
   /// argument needs to be added. The only time an argument needs to be added
   /// for an optional parameter is if the parameter is positional and there are
   /// pre-existing optional positional parameters after the ones being added.
-  final CodeTemplate argumentValue;
+  final CodeTemplate? argumentValue;
 
   /// Initialize a newly created parameter modification to represent the
   /// addition of a parameter. If provided, the [argumentValue] will be used as
   /// the value of the new argument in invocations of the function.
   AddParameter(this.index, this.name, this.isRequired, this.isPositional,
       this.argumentValue)
-      : assert(index >= 0),
-        assert(name != null);
+      : assert(index >= 0);
 }
 
 /// The data related to an executable element whose parameters have been
@@ -52,16 +48,20 @@
 
   /// Initialize a newly created transform to modifications to the parameter
   /// list of a function.
-  ModifyParameters({@required this.modifications})
-      : assert(modifications != null),
-        assert(modifications.isNotEmpty);
+  ModifyParameters({required this.modifications})
+      : assert(modifications.isNotEmpty);
 
   @override
   void apply(DartFileEditBuilder builder, DataDrivenFix fix, _Data data) {
     var argumentList = data.argumentList;
+    var invocation = argumentList.parent;
+    if (invocation == null) {
+      // This should only happen if `validate` didn't check this case.
+      return;
+    }
     var arguments = argumentList.arguments;
     var argumentCount = arguments.length;
-    var templateContext = TemplateContext(argumentList.parent, fix.utils);
+    var templateContext = TemplateContext(invocation, fix.utils);
 
     var indexToNewArgumentMap = <int, AddParameter>{};
     var argumentsToInsert = <int>[];
@@ -77,7 +77,7 @@
           var requiredIfCondition =
               modification.argumentValue?.requiredIfCondition;
           if (requiredIfCondition != null &&
-              requiredIfCondition.evaluateIn(templateContext)) {
+              requiredIfCondition.evaluateIn(templateContext) == true) {
             argumentsToInsert.add(index);
           }
         }
@@ -99,11 +99,14 @@
     /// Write to the [builder] the argument associated with a single
     /// [parameter].
     void writeArgument(DartEditBuilder builder, AddParameter parameter) {
-      if (!parameter.isPositional) {
-        builder.write(parameter.name);
-        builder.write(': ');
+      var argumentValue = parameter.argumentValue;
+      if (argumentValue != null) {
+        if (!parameter.isPositional) {
+          builder.write(parameter.name);
+          builder.write(': ');
+        }
+        argumentValue.writeOn(builder, templateContext);
       }
-      parameter.argumentValue.writeOn(builder, templateContext);
     }
 
     var insertionRanges = argumentsToInsert.contiguousSubRanges.toList();
@@ -124,7 +127,9 @@
             needsComma = true;
           }
           var parameter = indexToNewArgumentMap[argumentIndex];
-          writeArgument(builder, parameter);
+          if (parameter != null) {
+            writeArgument(builder, parameter);
+          }
         }
       }
 
@@ -187,7 +192,7 @@
         var insertionRange = insertionRanges[nextInsertionRange];
         var lower = insertionRange.lower;
         var upper = insertionRange.upper;
-        var parameter = indexToNewArgumentMap[upper];
+        var parameter = indexToNewArgumentMap[upper]!;
         while (upper >= lower &&
             (parameter.isPositional && !parameter.isRequired)) {
           upper--;
@@ -223,25 +228,26 @@
   }
 
   @override
-  _Data validate(DataDrivenFix fix) {
+  _Data? validate(DataDrivenFix fix) {
     var node = fix.node;
     var parent = node.parent;
+    var grandParent = parent?.parent;
+    var greatGrandParent = grandParent?.parent;
     if (parent is InvocationExpression) {
       var argumentList = parent.argumentList;
       return _Data(argumentList);
     } else if (parent is Label) {
-      var argumentList = parent.parent.parent;
+      var argumentList = grandParent?.parent;
       if (argumentList is ArgumentList) {
         return _Data(argumentList);
       }
-    } else if (parent?.parent is InvocationExpression) {
-      var argumentList = (parent.parent as InvocationExpression).argumentList;
+    } else if (grandParent is InvocationExpression) {
+      var argumentList = grandParent.argumentList;
       return _Data(argumentList);
     } else if (parent is TypeName &&
-        parent.parent is ConstructorName &&
-        parent.parent.parent is InstanceCreationExpression) {
-      var argumentList =
-          (parent.parent.parent as InstanceCreationExpression).argumentList;
+        grandParent is ConstructorName &&
+        greatGrandParent is InstanceCreationExpression) {
+      var argumentList = greatGrandParent.argumentList;
       return _Data(argumentList);
     }
     return null;
@@ -249,7 +255,7 @@
 
   /// Return the range from the list of [ranges] that contains the given
   /// [index], or `null` if there is no such range.
-  _IndexRange _rangeContaining(List<_IndexRange> ranges, int index) {
+  _IndexRange? _rangeContaining(List<_IndexRange> ranges, int index) {
     for (var range in ranges) {
       if (index >= range.lower && index <= range.upper) {
         return range;
@@ -261,8 +267,10 @@
   /// Return the element of the argument list whose value is the given
   /// [argument]. If the argument is the child of a named expression, then that
   /// will be the named expression, otherwise it will be the argument itself.
-  Expression _realArgument(Expression argument) =>
-      argument.parent is NamedExpression ? argument.parent : argument;
+  Expression _realArgument(Expression argument) {
+    var parent = argument.parent;
+    return parent is NamedExpression ? parent : argument;
+  }
 }
 
 /// A modification related to a parameter.
@@ -275,7 +283,7 @@
 
   /// Initialize a newly created parameter modification to represent the removal
   /// of an existing [parameter].
-  RemoveParameter(this.parameter) : assert(parameter != null);
+  RemoveParameter(this.parameter);
 }
 
 /// The data returned when updating an invocation site.
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/rename.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/rename.dart
index b7958ad9..d3089e9 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/rename.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/rename.dart
@@ -2,48 +2,47 @@
 // 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 'package:analysis_server/src/services/correction/dart/data_driven.dart';
 import 'package:analysis_server/src/services/correction/fix/data_driven/change.dart';
 import 'package:analyzer/dart/ast/ast.dart';
 import 'package:analyzer_plugin/utilities/change_builder/change_builder_dart.dart';
 import 'package:analyzer_plugin/utilities/range_factory.dart';
-import 'package:meta/meta.dart';
 
 /// The data related to an element that has been renamed.
-class Rename extends Change<SimpleIdentifier> {
+class Rename extends Change<_Data> {
   /// The new name of the element.
   final String newName;
 
   /// Initialize a newly created transform to describe a renaming of an element
   /// to the [newName].
-  Rename({@required this.newName});
+  Rename({required this.newName});
 
   @override
-  void apply(DartFileEditBuilder builder, DataDrivenFix fix,
-      SimpleIdentifier nameNode) {
+  void apply(DartFileEditBuilder builder, DataDrivenFix fix, _Data data) {
+    var nameNode = data.nameNode;
     if (fix.element.isConstructor) {
-      var parent = nameNode.parent;
+      var parent = nameNode?.parent;
       if (parent is ConstructorName) {
         if (nameNode != null && newName.isEmpty) {
           // The constructor was renamed from a named constructor to an unnamed
           // constructor.
-          builder.addDeletion(range.startEnd(parent.period, parent));
+          builder.addDeletion(range.startEnd(parent.period!, parent));
         } else if (nameNode == null && newName.isNotEmpty) {
           // The constructor was renamed from an unnamed constructor to a named
           // constructor.
           builder.addSimpleInsertion(parent.end, '.$newName');
-        } else {
+        } else if (nameNode != null) {
           // The constructor was renamed from a named constructor to another
           // named constructor.
           builder.addSimpleReplacement(range.node(nameNode), newName);
         }
+      } else if (nameNode == null) {
+        return;
       } else if (parent is MethodInvocation) {
         if (newName.isEmpty) {
           // The constructor was renamed from a named constructor to an unnamed
           // constructor.
-          builder.addDeletion(range.startEnd(parent.operator, nameNode));
+          builder.addDeletion(range.startEnd(parent.operator!, nameNode));
         } else {
           // The constructor was renamed from a named constructor to another
           // named constructor.
@@ -58,30 +57,38 @@
         // constructor.
         builder.addSimpleReplacement(range.node(nameNode), newName);
       }
-    } else {
+    } else if (nameNode != null) {
       // The name is a simple identifier.
       builder.addSimpleReplacement(range.node(nameNode), newName);
     }
   }
 
   @override
-  SimpleIdentifier validate(DataDrivenFix fix) {
+  _Data? validate(DataDrivenFix fix) {
     var node = fix.node;
     if (node is SimpleIdentifier) {
       var parent = node.parent;
-      if (parent is Label && parent.parent is NamedExpression) {
-        var invocation = parent.parent.parent.parent;
+      var grandParent = parent?.parent;
+      if (parent is Label && grandParent is NamedExpression) {
+        var invocation = grandParent.parent?.parent;
         if (invocation is InstanceCreationExpression) {
           invocation.constructorName.name;
         } else if (invocation is MethodInvocation) {
-          return invocation.methodName;
+          return _Data(invocation.methodName);
         }
         return null;
       }
-      return node;
+      return _Data(node);
     } else if (node is ConstructorName) {
-      return node.name;
+      return _Data(node.name);
     }
     return null;
   }
 }
+
+/// The data renaming a declaration.
+class _Data {
+  final SimpleIdentifier? nameNode;
+
+  _Data(this.nameNode);
+}
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/rename_parameter.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/rename_parameter.dart
index 7f9dbac..729692e 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/rename_parameter.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/rename_parameter.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 'package:analysis_server/src/services/correction/dart/data_driven.dart';
 import 'package:analysis_server/src/services/correction/fix/data_driven/change.dart';
 import 'package:analyzer/dart/ast/ast.dart';
@@ -11,7 +9,6 @@
 import 'package:analyzer/src/dart/element/inheritance_manager3.dart';
 import 'package:analyzer_plugin/utilities/change_builder/change_builder_dart.dart';
 import 'package:analyzer_plugin/utilities/range_factory.dart';
-import 'package:meta/meta.dart';
 
 /// The data related to a parameter that has been renamed.
 class RenameParameter extends Change<_Data> {
@@ -23,7 +20,7 @@
 
   /// Initialize a newly created transform to describe a renaming of a parameter
   /// from the [oldName] to the [newName].
-  RenameParameter({@required this.newName, @required this.oldName});
+  RenameParameter({required this.newName, required this.oldName});
 
   @override
   void apply(DartFileEditBuilder builder, DataDrivenFix fix, _Data data) {
@@ -38,23 +35,27 @@
         if (overriddenParameter == null) {
           // If the overridden parameter has already been removed, then just
           // rename the old parameter to have the new name.
-          builder.addSimpleReplacement(
-              range.node(parameter.identifier), newName);
+          var identifier = parameter.identifier;
+          if (identifier != null) {
+            builder.addSimpleReplacement(range.node(identifier), newName);
+          }
         } else {
           // If the overridden parameter still exists, then mark it as
           // deprecated (if it isn't already) and add a declaration of the new
           // parameter.
-          builder.addInsertion(parameter.offset, (builder) {
-            var parameterElement = parameter.declaredElement;
-            builder.writeParameter(newName,
-                isCovariant: parameterElement.isCovariant,
-                isRequiredNamed: parameterElement.isRequiredNamed,
-                type: parameterElement.type);
-            builder.write(', ');
-            if (!parameterElement.hasDeprecated) {
-              builder.write('@deprecated ');
-            }
-          });
+          var parameterElement = parameter.declaredElement;
+          if (parameterElement != null) {
+            builder.addInsertion(parameter.offset, (builder) {
+              builder.writeParameter(newName,
+                  isCovariant: parameterElement.isCovariant,
+                  isRequiredNamed: parameterElement.isRequiredNamed,
+                  type: parameterElement.type);
+              builder.write(', ');
+              if (!parameterElement.hasDeprecated) {
+                builder.write('@deprecated ');
+              }
+            });
+          }
         }
       }
     }
@@ -65,11 +66,12 @@
     var node = fix.node;
     if (node is SimpleIdentifier) {
       var parent = node.parent;
+      var grandParent = parent?.parent;
       if (node.name == oldName &&
           parent is Label &&
-          parent.parent is NamedExpression) {
-        var invocation = parent.parent.parent.parent;
-        if (fix.element.matches(invocation)) {
+          grandParent is NamedExpression) {
+        var invocation = grandParent.parent?.parent;
+        if (invocation != null && fix.element.matches(invocation)) {
           return _InvocationData(node);
         }
       } else if (parent is MethodDeclaration) {
@@ -111,10 +113,13 @@
 extension on MethodDeclaration {
   /// Return the parameter of this method whose name matches the given [name],
   /// or `null` if there is no such parameter.
-  FormalParameter parameterNamed(String name) {
-    for (var parameter in parameters.parameters) {
-      if (parameter.declaredElement.name == name) {
-        return parameter;
+  FormalParameter? parameterNamed(String name) {
+    var parameters = this.parameters;
+    if (parameters != null) {
+      for (var parameter in parameters.parameters) {
+        if (parameter.declaredElement?.name == name) {
+          return parameter;
+        }
       }
     }
     return null;
@@ -122,12 +127,14 @@
 
   /// Return the element that this method overrides, or `null` if this method
   /// doesn't override any inherited member.
-  ExecutableElement overriddenElement() {
+  ExecutableElement? overriddenElement() {
     var element = declaredElement;
-    var enclosingElement = element.enclosingElement;
-    if (enclosingElement is ClassElement) {
-      var name = Name(enclosingElement.library.source.uri, element.name);
-      return InheritanceManager3().getInherited2(enclosingElement, name);
+    if (element != null) {
+      var enclosingElement = element.enclosingElement;
+      if (enclosingElement is ClassElement) {
+        var name = Name(enclosingElement.library.source.uri, element.name);
+        return InheritanceManager3().getInherited2(enclosingElement, name);
+      }
     }
     return null;
   }
@@ -136,7 +143,7 @@
 extension on ExecutableElement {
   /// Return the parameter of this executable element whose name matches the
   /// given [name], or `null` if there is no such parameter.
-  ParameterElement parameterNamed(String name) {
+  ParameterElement? parameterNamed(String name) {
     for (var parameter in parameters) {
       if (parameter.name == name) {
         return parameter;
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform.dart
index cc03b29..75d72c2 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform.dart
@@ -2,13 +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.
 
-// @dart = 2.9
-
 import 'package:analysis_server/src/services/correction/fix/data_driven/changes_selector.dart';
 import 'package:analysis_server/src/services/correction/fix/data_driven/element_descriptor.dart';
 import 'package:analysis_server/src/services/correction/fix/data_driven/element_matcher.dart';
 import 'package:analysis_server/src/services/correction/fix/data_driven/transform_override.dart';
-import 'package:meta/meta.dart';
 
 /// A description of a set of changes to a single element of the API.
 class Transform {
@@ -31,17 +28,17 @@
   /// Initialize a newly created transform to describe a transformation of the
   /// [element].
   Transform(
-      {@required this.title,
-      this.date,
-      @required this.bulkApply,
-      @required this.element,
-      @required this.changesSelector});
+      {required this.title,
+      required this.date,
+      required this.bulkApply,
+      required this.element,
+      required this.changesSelector});
 
   /// Return `true` if this transform can be applied to fix an issue related to
   /// an element that matches the given [matcher]. The flag [applyingBulkFixes]
   /// indicates whether the transforms are being applied in the context of a
   /// bulk fix.
-  bool appliesTo(ElementMatcher matcher, {@required bool applyingBulkFixes}) {
+  bool appliesTo(ElementMatcher matcher, {required bool applyingBulkFixes}) {
     if (applyingBulkFixes && !bulkApply) {
       return false;
     }
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_override_set_parser.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_override_set_parser.dart
index 30c3995..aec5cc03 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_override_set_parser.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_override_set_parser.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 'package:analysis_server/src/services/correction/fix/data_driven/transform_override.dart';
 import 'package:analysis_server/src/services/correction/fix/data_driven/transform_override_set.dart';
 import 'package:analysis_server/src/services/correction/fix/data_driven/transform_set_error_code.dart';
@@ -26,8 +24,7 @@
 
   /// Return the result of parsing the file [content] into a transform override,
   /// or `null` if the content does not represent a valid transform override.
-  TransformOverrideSet parse(String content) {
-    assert(content != null);
+  TransformOverrideSet? parse(String content) {
     var map = _parseYaml(content);
     if (map == null) {
       // The error has already been reported.
@@ -51,13 +48,15 @@
   }
 
   /// Return the result of parsing the file [content] into a YAML node.
-  YamlNode _parseYaml(String content) {
+  YamlNode? _parseYaml(String content) {
     try {
       return loadYamlNode(content);
     } on YamlException catch (e) {
       var span = e.span;
-      errorReporter.reportErrorForOffset(TransformSetErrorCode.yamlSyntaxError,
-          span.start.offset, span.length, [e.message]);
+      var offset = span?.start.offset ?? 0;
+      var length = span?.length ?? 0;
+      errorReporter.reportErrorForOffset(
+          TransformSetErrorCode.yamlSyntaxError, offset, length, [e.message]);
     }
     return null;
   }
@@ -66,7 +65,7 @@
   /// [node]. A list of [arguments] should be provided if the diagnostic message
   /// has parameters.
   void _reportError(TransformSetErrorCode code, YamlNode node,
-      [List<String> arguments]) {
+      [List<String>? arguments]) {
     var span = node.span;
     errorReporter.reportErrorForOffset(
         code, span.start.offset, span.length, arguments);
@@ -103,7 +102,7 @@
   /// if the [node] doesn't represent a valid bool. If the [node] isn't valid,
   /// use the [context] to report the error. If the [node] doesn't exist and
   /// [required] is `true`, then report an error.
-  bool _translateBool(YamlNode node, ErrorContext context,
+  bool? _translateBool(YamlNode? node, ErrorContext context,
       {bool required = true}) {
     if (node is YamlScalar) {
       var value = node.value;
@@ -122,7 +121,7 @@
   }
 
   /// Translate the given [node] as a key.
-  String _translateKey(YamlNode node) {
+  String? _translateKey(YamlNode node) {
     String type;
     if (node is YamlScalar) {
       if (node.value is String) {
@@ -144,7 +143,7 @@
   /// if the [node] doesn't represent a valid string. If the [node] isn't valid,
   /// use the [context] to report the error. If the [node] doesn't exist and
   /// [required] is `true`, then report an error.
-  String _translateString(YamlNode node, ErrorContext context,
+  String? _translateString(YamlNode? node, ErrorContext context,
       {bool required = true}) {
     if (node is YamlScalar) {
       var value = node.value;
@@ -165,9 +164,8 @@
   /// Translate the [node] into a transform override. Return the resulting
   /// transform override, or `null` if the [node] does not represent a valid
   /// transform override.
-  TransformOverride _translateTransformOverride(
+  TransformOverride? _translateTransformOverride(
       YamlNode node, ErrorContext context, String title) {
-    assert(node != null);
     if (node is YamlMap) {
       _reportUnsupportedKeys(node, const {_bulkApplyKey});
       var bulkApplyNode = node.valueAt(_bulkApplyKey);
@@ -188,8 +186,7 @@
   /// Translate the [node] into a transform override. Return the resulting
   /// transform override, or `null` if the [node] does not represent a valid
   /// transform override.
-  TransformOverrideSet _translateTransformOverrideSet(YamlNode node) {
-    assert(node != null);
+  TransformOverrideSet? _translateTransformOverrideSet(YamlNode node) {
     if (node is YamlMap) {
       var overrides = <TransformOverride>[];
       for (var entry in node.nodes.entries) {
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set.dart
index 5ef1a7a..9aba8fc 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set.dart
@@ -2,12 +2,9 @@
 // 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 'package:analysis_server/src/services/correction/fix/data_driven/element_matcher.dart';
 import 'package:analysis_server/src/services/correction/fix/data_driven/transform.dart';
 import 'package:analysis_server/src/services/correction/fix/data_driven/transform_override_set.dart';
-import 'package:meta/meta.dart';
 
 /// A set of transforms used to aid in the construction of fixes for issues
 /// related to some body of code. Typically there is one set of transforms for
@@ -40,7 +37,7 @@
   /// [applyingBulkFixes] indicates whether the transforms are being applied in
   /// the context of a bulk fix.
   List<Transform> transformsFor(ElementMatcher matcher,
-      {@required bool applyingBulkFixes}) {
+      {required bool applyingBulkFixes}) {
     var result = <Transform>[];
     for (var transform in _transforms) {
       if (transform.appliesTo(matcher, applyingBulkFixes: applyingBulkFixes)) {
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_manager.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_manager.dart
index 38f3aa0..c2f427a 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_manager.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_manager.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 'package:analysis_server/src/services/correction/fix/data_driven/transform_set.dart';
 import 'package:analysis_server/src/services/correction/fix/data_driven/transform_set_parser.dart';
 import 'package:analyzer/dart/element/element.dart';
@@ -54,7 +52,7 @@
   /// Read the [file] and parse the content. Return the transform set that was
   /// parsed, or `null` if the file doesn't exist, isn't readable, or if the
   /// content couldn't be parsed.
-  TransformSet _loadTransformSet(File file) {
+  TransformSet? _loadTransformSet(File file) {
     try {
       // TODO(brianwilkerson) Consider caching the transform sets.
       var content = file.readAsStringSync();
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_parser.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_parser.dart
index eb162b3..4605bd6 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_parser.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_parser.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 'package:analysis_server/src/services/correction/fix/data_driven/add_type_parameter.dart';
 import 'package:analysis_server/src/services/correction/fix/data_driven/change.dart';
 import 'package:analysis_server/src/services/correction/fix/data_driven/changes_selector.dart';
@@ -23,7 +21,6 @@
 import 'package:analysis_server/src/services/correction/fix/data_driven/variable_scope.dart';
 import 'package:analyzer/error/listener.dart';
 import 'package:analyzer/src/util/yaml.dart';
-import 'package:meta/meta.dart';
 import 'package:yaml/yaml.dart';
 
 /// Information used to report errors when translating a node.
@@ -37,7 +34,7 @@
   final YamlNode parentNode;
 
   /// Initialize a newly created error context.
-  ErrorContext({@required this.key, @required this.parentNode});
+  ErrorContext({required this.key, required this.parentNode});
 }
 
 /// A parser used to read a transform set from a file.
@@ -133,7 +130,7 @@
 
   /// The parameter modifications associated with the current transform, or
   /// `null` if the current transform does not yet have any such modifications.
-  List<ParameterModification> _parameterModifications;
+  List<ParameterModification>? _parameterModifications;
 
   /// Initialize a newly created parser to report diagnostics to the
   /// [errorReporter].
@@ -141,8 +138,7 @@
 
   /// Return the result of parsing the file [content] into a transform set, or
   /// `null` if the content does not represent a valid transform set.
-  TransformSet parse(String content) {
-    assert(content != null);
+  TransformSet? parse(String content) {
     var map = _parseYaml(content);
     if (map == null) {
       // The error has already been reported.
@@ -223,13 +219,15 @@
   }
 
   /// Return the result of parsing the file [content] into a YAML node.
-  YamlNode _parseYaml(String content) {
+  YamlNode? _parseYaml(String content) {
     try {
       return loadYamlNode(content);
     } on YamlException catch (e) {
       var span = e.span;
-      errorReporter.reportErrorForOffset(TransformSetErrorCode.yamlSyntaxError,
-          span.start.offset, span.length, [e.message]);
+      var offset = span?.start.offset ?? 0;
+      var length = span?.length ?? 0;
+      errorReporter.reportErrorForOffset(
+          TransformSetErrorCode.yamlSyntaxError, offset, length, [e.message]);
     }
     return null;
   }
@@ -238,7 +236,7 @@
   /// [node]. A list of [arguments] should be provided if the diagnostic message
   /// has parameters.
   void _reportError(TransformSetErrorCode code, YamlNode node,
-      [List<String> arguments]) {
+      [List<String>? arguments]) {
     var span = node.span;
     errorReporter.reportErrorForOffset(
         code, span.start.offset, span.length, arguments);
@@ -284,15 +282,14 @@
   /// keys is in the map and return it. If more than one of the keys is in the
   /// map, report a diagnostic for each extra key. If [required] is `true` and
   /// none of the keys is in the map, report a diagnostic at the [errorNode].
-  String _singleKey(YamlMap map, List<String> validKeys, YamlNode errorNode,
+  String? _singleKey(YamlMap map, List<String> validKeys, YamlNode errorNode,
       {bool required = true}) {
-    assert(validKeys != null);
     var foundKeys = <String>[];
     var keyToNodeMap = <String, YamlNode>{};
     for (var keyNode in map.nodes.keys) {
       if (keyNode is YamlScalar && keyNode.value is String) {
-        var key = keyNode.value as String;
-        if (key != null && validKeys.contains(key)) {
+        var key = keyNode.value;
+        if (key is String && validKeys.contains(key)) {
           foundKeys.add(key);
           keyToNodeMap[key] = keyNode;
         }
@@ -309,7 +306,7 @@
     var firstKey = foundKeys[0];
     for (var i = 1; i < foundKeys.length; i++) {
       var foundKey = foundKeys[i];
-      var invalidNode = keyToNodeMap[foundKey];
+      var invalidNode = keyToNodeMap[foundKey]!;
       _reportError(TransformSetErrorCode.conflictingKey, invalidNode,
           [foundKey, firstKey]);
     }
@@ -335,7 +332,7 @@
     var styleNode = node.valueAt(_styleKey);
     var style = _translateString(
         styleNode, ErrorContext(key: _styleKey, parentNode: node));
-    if (style == null) {
+    if (styleNode == null || style == null) {
       // The error has already been reported.
       return;
     }
@@ -366,23 +363,19 @@
       if (style != 'optional_named') {
         var valueNode = argumentValueNode as YamlMap;
         _reportError(TransformSetErrorCode.invalidRequiredIf,
-            valueNode.keyAtValue(valueNode.valueAt(_requiredIfKey)));
-        return;
-      } else if (argumentValue == null) {
-        // TODO(brianwilkerson) Report that conditionally required parameters must
-        //  have an argument value.
+            valueNode.keyAtValue(valueNode.valueAt(_requiredIfKey)!)!);
         return;
       }
     }
     _parameterModifications ??= [];
-    _parameterModifications.add(
+    _parameterModifications!.add(
         AddParameter(index, name, isRequired, isPositional, argumentValue));
   }
 
   /// Translate the [node] into an add-type-parameter change. Return the
   /// resulting change, or `null` if the [node] does not represent a valid
   /// add-type-parameter change.
-  AddTypeParameter _translateAddTypeParameterChange(YamlMap node) {
+  AddTypeParameter? _translateAddTypeParameterChange(YamlMap node) {
     _reportUnsupportedKeys(node,
         const {_extendsKey, _indexKey, _kindKey, _nameKey, _argumentValueKey});
     var index = _translateInteger(node.valueAt(_indexKey),
@@ -413,7 +406,7 @@
   /// if the [node] doesn't represent a valid bool. If the [node] isn't valid,
   /// use the [context] to report the error. If the [node] doesn't exist and
   /// [required] is `true`, then report an error.
-  bool _translateBool(YamlNode node, ErrorContext context,
+  bool? _translateBool(YamlNode? node, ErrorContext context,
       {bool required = true}) {
     if (node is YamlScalar) {
       var value = node.value;
@@ -434,13 +427,12 @@
   /// Translate the [node] into a change. Return the resulting change, or `null`
   /// if the [node] does not represent a valid change. If the [node] is not
   /// valid, use the [context] to report the error.
-  Change _translateChange(YamlNode node, ErrorContext context) {
-    assert(node != null);
+  Change? _translateChange(YamlNode node, ErrorContext context) {
     if (node is YamlMap) {
       var kindNode = node.valueAt(_kindKey);
       var kindContext = ErrorContext(key: _kindKey, parentNode: node);
       var kind = _translateString(kindNode, kindContext);
-      if (kind == null) {
+      if (kindNode == null || kind == null) {
         return null;
       } else if (kind == _addParameterKind) {
         _translateAddParameterChange(node);
@@ -470,12 +462,12 @@
   /// Translate the [node] into a value generator. Return the resulting
   /// generator, or `null` if the [node] does not represent a valid value
   /// extractor.
-  ValueGenerator _translateCodeFragment(YamlMap node) {
+  ValueGenerator? _translateCodeFragment(YamlMap node) {
     _reportUnsupportedKeys(node, const {_kindKey, _valueKey});
     var valueNode = node.valueAt(_valueKey);
     var value = _translateString(
         valueNode, ErrorContext(key: _valueKey, parentNode: node));
-    if (value == null) {
+    if (valueNode is! YamlScalar || value == null) {
       // The error has already been reported.
       return null;
     }
@@ -492,7 +484,7 @@
   /// or `null` if the [node] doesn't represent a valid code template. If the
   /// [node] isn't valid, use the [context] to report the error. If the [node]
   /// doesn't exist and [required] is `true`, then report an error.
-  CodeTemplate _translateCodeTemplate(YamlNode node, ErrorContext context,
+  CodeTemplate? _translateCodeTemplate(YamlNode? node, ErrorContext context,
       {bool canBeConditionallyRequired = false, bool required = true}) {
     if (node is YamlMap) {
       if (canBeConditionallyRequired) {
@@ -507,13 +499,13 @@
       var variableScope = _translateTemplateVariables(
           node.valueAt(_variablesKey),
           ErrorContext(key: _variablesKey, parentNode: node));
-      Expression requiredIfCondition;
+      Expression? requiredIfCondition;
       if (canBeConditionallyRequired) {
         var requiredIfNode = node.valueAt(_requiredIfKey);
         var requiredIfText = _translateString(
             requiredIfNode, ErrorContext(key: _requiredIfKey, parentNode: node),
             required: false);
-        if (requiredIfText != null) {
+        if (requiredIfNode is YamlScalar && requiredIfText != null) {
           requiredIfCondition = CodeFragmentParser(errorReporter,
                   scope: variableScope)
               .parseCondition(requiredIfText, _offsetOfString(requiredIfNode));
@@ -523,7 +515,7 @@
           }
         }
       }
-      if (template == null) {
+      if (expressionNode is! YamlScalar || template == null) {
         // The error has already been reported.
         return null;
       }
@@ -551,13 +543,16 @@
           expressionNode, ErrorContext(key: _ifKey, parentNode: node));
       var changes = _translateList(node.valueAt(_changesKey),
           ErrorContext(key: _changesKey, parentNode: node), _translateChange);
-      if (_parameterModifications != null) {
+      var parameterModifications = _parameterModifications;
+      if (parameterModifications != null) {
         if (changes != null) {
-          changes.add(ModifyParameters(modifications: _parameterModifications));
+          changes.add(ModifyParameters(modifications: parameterModifications));
         }
         _parameterModifications = null;
       }
-      if (expressionText != null && changes != null) {
+      if (expressionNode is YamlScalar &&
+          expressionText != null &&
+          changes != null) {
         var expression = CodeFragmentParser(errorReporter,
                 scope: transformVariableScope)
             .parseCondition(expressionText, _offsetOfString(expressionNode));
@@ -570,7 +565,7 @@
     }
   }
 
-  ChangesSelector _translateConditionalChanges(
+  ChangesSelector? _translateConditionalChanges(
       YamlNode node, ErrorContext context) {
     if (node is YamlList) {
       var changeMap = <Expression, List<Change>>{};
@@ -586,7 +581,7 @@
   /// Translate the [node] into a date. Return the resulting date, or `null`
   /// if the [node] does not represent a valid date. If the [node] is not
   /// valid, use the [context] to report the error.
-  DateTime _translateDate(YamlNode node, ErrorContext context) {
+  DateTime? _translateDate(YamlNode? node, ErrorContext context) {
     if (node is YamlScalar) {
       var value = node.value;
       if (value is String) {
@@ -608,7 +603,7 @@
   /// descriptor, or `null` if the [node] does not represent a valid element
   /// descriptor. If the [node] is not valid, use the [context] to report the
   /// error.
-  ElementDescriptor _translateElement(YamlNode node, ErrorContext context) {
+  ElementDescriptor? _translateElement(YamlNode? node, ErrorContext context) {
     if (node is YamlMap) {
       var urisNode = node.valueAt(_urisKey);
       var uris = _translateList(urisNode,
@@ -643,12 +638,15 @@
       }
       var components = [elementName];
       if (_containerKeyMap.containsKey(elementKey)) {
-        var validContainerKeys = _containerKeyMap[elementKey];
+        var validContainerKeys = _containerKeyMap[elementKey]!;
         var containerKey =
             _singleKey(node, validContainerKeys, node, required: false);
-        var containerName = _translateString(node.valueAt(containerKey),
-            ErrorContext(key: containerKey, parentNode: node),
-            required: false);
+        String? containerName;
+        if (containerKey != null) {
+          containerName = _translateString(node.valueAt(containerKey),
+              ErrorContext(key: containerKey, parentNode: node),
+              required: false);
+        }
         if (containerName == null) {
           if ([_constructorKey, _constantKey, _methodKey, _fieldKey]
               .contains(elementKey)) {
@@ -674,7 +672,7 @@
       }
       return ElementDescriptor(
           libraryUris: uris,
-          kind: ElementKindUtilities.fromName(elementKey),
+          kind: ElementKindUtilities.fromName(elementKey)!,
           components: components);
     } else if (node == null) {
       return _reportMissingKey(context);
@@ -686,7 +684,7 @@
   /// Translate the [node] into a value generator. Return the resulting
   /// generator, or `null` if the [node] does not represent a valid value
   /// extractor.
-  ValueGenerator _translateImportValue(YamlMap node) {
+  ValueGenerator? _translateImportValue(YamlMap node) {
     _reportUnsupportedKeys(node, const {_kindKey, _nameKey, _urisKey});
     var urisNode = node.valueAt(_urisKey);
     var uris = _translateList(
@@ -709,7 +707,7 @@
   /// Translate the [node] into an integer. Return the resulting integer, or
   /// `null` if the [node] does not represent a valid integer. If the [node] is
   /// not valid, use the [context] to report the error.
-  int _translateInteger(YamlNode node, ErrorContext context) {
+  int? _translateInteger(YamlNode? node, ErrorContext context) {
     if (node is YamlScalar) {
       var value = node.value;
       if (value is int) {
@@ -724,7 +722,7 @@
   }
 
   /// Translate the given [node] as a key.
-  String _translateKey(YamlNode node) {
+  String? _translateKey(YamlNode node) {
     String type;
     if (node is YamlScalar) {
       if (node.value is String) {
@@ -747,8 +745,8 @@
   /// valid list. If any of the elements of the list can't be translated, they
   /// will be omitted from the list, the [context] will be used to report the
   /// error, and the valid elements will be returned.
-  List<R> _translateList<R>(YamlNode node, ErrorContext context,
-      R Function(YamlNode, ErrorContext) elementTranslator) {
+  List<R>? _translateList<R>(YamlNode? node, ErrorContext context,
+      R? Function(YamlNode, ErrorContext) elementTranslator) {
     if (node is YamlList) {
       var translatedList = <R>[];
       for (var element in node.nodes) {
@@ -777,7 +775,7 @@
     if (parameterSpecKey == _indexKey) {
       var index = _translateInteger(node.valueAt(_indexKey),
           ErrorContext(key: _indexKey, parentNode: node));
-      if (parameterSpecKey == null) {
+      if (index == null) {
         // The error has already been reported.
         return null;
       }
@@ -791,13 +789,13 @@
       }
       reference = NamedParameterReference(name);
     }
-    _parameterModifications ??= [];
-    _parameterModifications.add(RemoveParameter(reference));
+    var parameterModifications = _parameterModifications ??= [];
+    parameterModifications.add(RemoveParameter(reference));
   }
 
   /// Translate the [node] into a rename change. Return the resulting change, or
   /// `null` if the [node] does not represent a valid rename change.
-  Rename _translateRenameChange(YamlMap node) {
+  Rename? _translateRenameChange(YamlMap node) {
     _reportUnsupportedKeys(node, const {_kindKey, _newNameKey});
     var newName = _translateString(node.valueAt(_newNameKey),
         ErrorContext(key: _newNameKey, parentNode: node));
@@ -810,7 +808,7 @@
 
   /// Translate the [node] into a rename parameter change. Return the resulting
   /// change, or `null` if the [node] does not represent a valid rename change.
-  RenameParameter _translateRenameParameterChange(YamlMap node) {
+  RenameParameter? _translateRenameParameterChange(YamlMap node) {
     _reportUnsupportedKeys(node, const {_kindKey, _newNameKey, _oldNameKey});
     var oldName = _translateString(node.valueAt(_oldNameKey),
         ErrorContext(key: _oldNameKey, parentNode: node));
@@ -827,7 +825,7 @@
   /// if the [node] doesn't represent a valid string. If the [node] isn't valid,
   /// use the [context] to report the error. If the [node] doesn't exist and
   /// [required] is `true`, then report an error.
-  String _translateString(YamlNode node, ErrorContext context,
+  String? _translateString(YamlNode? node, ErrorContext context,
       {bool required = true}) {
     if (node is YamlScalar) {
       var value = node.value;
@@ -849,7 +847,7 @@
   /// the enclosing scope if the [node] does not represent a valid variables
   /// map. If the [node] is not valid, use the [context] to report the error.
   VariableScope _translateTemplateVariables(
-      YamlNode node, ErrorContext context) {
+      YamlNode? node, ErrorContext context) {
     if (node is YamlMap) {
       var generators = <String, ValueGenerator>{};
       for (var entry in node.nodes.entries) {
@@ -874,8 +872,7 @@
   /// Translate the [node] into a transform. Return the resulting transform, or
   /// `null` if the [node] does not represent a valid transform. If the [node]
   /// is not valid, use the [context] to report the error.
-  Transform _translateTransform(YamlNode node, ErrorContext context) {
-    assert(node != null);
+  Transform? _translateTransform(YamlNode node, ErrorContext context) {
     if (node is YamlMap) {
       _reportUnsupportedKeys(node, const {
         _bulkApplyKey,
@@ -899,12 +896,12 @@
       transformVariableScope = _translateTemplateVariables(
           node.valueAt(_variablesKey),
           ErrorContext(key: _variablesKey, parentNode: node));
-      ChangesSelector selector;
+      ChangesSelector? selector;
       var key = _singleKey(
           node, const [_changesKey, _oneOfKey], context.parentNode,
           required: true);
       if (key == _oneOfKey) {
-        selector = _translateConditionalChanges(node.valueAt(_oneOfKey),
+        selector = _translateConditionalChanges(node.valueAt(_oneOfKey)!,
             ErrorContext(key: _oneOfKey, parentNode: node));
       } else if (key == _changesKey) {
         var changes = _translateList(node.valueAt(_changesKey),
@@ -914,8 +911,9 @@
           _parameterModifications = null;
           return null;
         }
-        if (_parameterModifications != null) {
-          changes.add(ModifyParameters(modifications: _parameterModifications));
+        var parameterModifications = _parameterModifications;
+        if (parameterModifications != null) {
+          changes.add(ModifyParameters(modifications: parameterModifications));
           _parameterModifications = null;
         }
         selector = UnconditionalChangesSelector(changes);
@@ -944,14 +942,13 @@
 
   /// Translate the [node] into a transform set. Return the resulting transform
   /// set, or `null` if the [node] does not represent a valid transform set.
-  TransformSet _translateTransformSet(YamlNode node) {
-    assert(node != null);
+  TransformSet? _translateTransformSet(YamlNode node) {
     if (node is YamlMap) {
       _reportUnsupportedKeys(node, const {_transformsKey, _versionKey});
       var versionNode = node.valueAt(_versionKey);
       var version = _translateInteger(
           versionNode, ErrorContext(key: _versionKey, parentNode: node));
-      if (version == null) {
+      if (versionNode == null || version == null) {
         // The error has already been reported.
         return null;
       } else if (version < 1 || version > currentVersion) {
@@ -987,7 +984,7 @@
   /// the [node] doesn't represent a valid URI. If the [node] isn't valid, use
   /// the [context] to report the error. If the [node] doesn't exist and
   /// [required] is `true`, then report an error.
-  Uri _translateUri(YamlNode node, ErrorContext context,
+  Uri? _translateUri(YamlNode? node, ErrorContext context,
       {bool required = true}) {
     if (node is YamlScalar) {
       var value = node.value;
@@ -1012,12 +1009,13 @@
   /// extractor, or `null` if the [node] does not represent a valid value
   /// extractor. If the [node] is not valid, use the [context] to report the
   /// error.
-  ValueGenerator _translateValueGenerator(YamlNode node, ErrorContext context) {
+  ValueGenerator? _translateValueGenerator(
+      YamlNode? node, ErrorContext context) {
     if (node is YamlMap) {
       var kindNode = node.valueAt(_kindKey);
       var kindContext = ErrorContext(key: _kindKey, parentNode: node);
       var kind = _translateString(kindNode, kindContext);
-      if (kind == null) {
+      if (kindNode == null || kind == null) {
         return null;
       } else if (kind == _fragmentKind) {
         return _translateCodeFragment(node);
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/value_generator.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/value_generator.dart
index fc9b2fb..ec53b79 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/value_generator.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/value_generator.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 'package:analysis_server/src/services/correction/fix/data_driven/accessor.dart';
 import 'package:analysis_server/src/services/correction/fix/data_driven/code_template.dart';
 import 'package:analyzer/dart/ast/ast.dart';
@@ -22,7 +20,7 @@
 
   @override
   String evaluateIn(TemplateContext context) {
-    Object target = context.node;
+    Object? target = context.node;
     for (var i = 0; i < accessors.length; i++) {
       var result = accessors[i].getValue(target);
       if (!result.isValid) {
@@ -46,7 +44,7 @@
 
   @override
   bool validate(TemplateContext context) {
-    Object target = context.node;
+    Object? target = context.node;
     for (var accessor in accessors) {
       var result = accessor.getValue(target);
       if (!result.isValid) {
@@ -59,7 +57,7 @@
 
   @override
   void writeOn(DartEditBuilder builder, TemplateContext context) {
-    Object target = context.node;
+    Object? target = context.node;
     for (var accessor in accessors) {
       target = accessor.getValue(target).result;
     }
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/variable_scope.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/variable_scope.dart
index 6137a32..77a3e75 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/variable_scope.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/variable_scope.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 'package:analysis_server/src/services/correction/fix/data_driven/value_generator.dart';
 
 /// A scope in which the generators associated with variables can be looked up.
@@ -12,7 +10,7 @@
   static final empty = VariableScope(null, {});
 
   /// The outer scope in which this scope is nested.
-  final VariableScope outerScope;
+  final VariableScope? outerScope;
 
   /// A table mapping variable names to generators.
   final Map<String, ValueGenerator> _generators;
@@ -24,7 +22,7 @@
 
   /// Return the generator used to generate the value of the variable with the
   /// given [variableName], or `null` if the variable is not defined.
-  ValueGenerator lookup(String variableName) {
+  ValueGenerator? lookup(String variableName) {
     return _generators[variableName] ?? outerScope?.lookup(variableName);
   }
 }
diff --git a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
index 02560a0..2eeadb5 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.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';
 
 import 'package:analysis_server/plugin/edit/fix/fix_core.dart';
@@ -165,10 +163,8 @@
 import 'package:analyzer/src/generated/java_core.dart';
 import 'package:analyzer/src/generated/parser.dart';
 import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
-import 'package:analyzer_plugin/utilities/change_builder/change_workspace.dart';
 import 'package:analyzer_plugin/utilities/change_builder/conflicting_edit_exception.dart';
 import 'package:analyzer_plugin/utilities/fixes/fixes.dart' hide FixContributor;
-import 'package:meta/meta.dart';
 
 /// A function that can be executed to create a multi-correction producer.
 typedef MultiProducerGenerator = MultiCorrectionProducer Function();
@@ -226,7 +222,9 @@
 
     var fixes = <Fix>[];
     for (var generator in generators) {
-      var fixState = FixState(workspace);
+      _FixState fixState = _EmptyFixState(
+        ChangeBuilder(workspace: workspace),
+      );
       for (var error in errors) {
         var fixContext = DartFixContextImpl(
           instrumentationService,
@@ -235,12 +233,12 @@
           error,
           (name) => [],
         );
-        await _fixError(fixContext, fixState, generator(), error);
+        fixState = await _fixError(fixContext, fixState, generator(), error);
       }
-      var sourceChange = fixState.builder.sourceChange;
-      if (sourceChange.edits.isNotEmpty) {
-        var fixKind = fixState.fixKind;
-        if (fixState.fixCount > 1) {
+      if (fixState is _NotEmptyFixState) {
+        var sourceChange = fixState.builder.sourceChange;
+        if (sourceChange.edits.isNotEmpty && fixState.fixCount > 1) {
+          var fixKind = fixState.fixKind;
           sourceChange.message = fixKind.message;
           fixes.add(Fix(fixKind, sourceChange));
         }
@@ -249,7 +247,7 @@
     return fixes;
   }
 
-  Future<void> _fixError(DartFixContext fixContext, FixState fixState,
+  Future<_FixState> _fixError(DartFixContext fixContext, _FixState fixState,
       CorrectionProducer producer, AnalysisError diagnostic) async {
     var context = CorrectionProducerContext.create(
       applyingBulkFixes: true,
@@ -261,7 +259,7 @@
       workspace: fixContext.workspace,
     );
     if (context == null) {
-      return;
+      return fixState;
     }
 
     producer.configure(context);
@@ -269,14 +267,23 @@
     try {
       var localBuilder = fixState.builder.copy();
       await producer.compute(localBuilder);
-      fixState.builder = localBuilder;
+
+      var multiFixKind = producer.multiFixKind;
+      if (multiFixKind == null) {
+        return fixState;
+      }
+
       // todo (pq): consider discarding the change if the producer's fixKind
       // doesn't match a previously cached one.
-      fixState.fixKind = producer.multiFixKind;
-      fixState.fixCount++;
+      return _NotEmptyFixState(
+        builder: localBuilder,
+        fixKind: multiFixKind,
+        fixCount: fixState.fixCount + 1,
+      );
     } on ConflictingEditException {
       // If a conflicting edit was added in [compute], then the [localBuilder]
       // is discarded and we revert to the previous state of the builder.
+      return fixState;
     }
   }
 
@@ -308,9 +315,9 @@
   final bool canBeBulkApplied;
   final List<ProducerGenerator> generators;
   const FixInfo({
-    @required this.canBeAppliedToFile,
-    @required this.canBeBulkApplied,
-    @required this.generators,
+    required this.canBeAppliedToFile,
+    required this.canBeBulkApplied,
+    required this.generators,
   });
 }
 
@@ -1726,19 +1733,23 @@
     return fixes;
   }
 
-  Future<Fix> computeFix() async {
+  Future<Fix?> computeFix() async {
     await _addFromProducers();
     fixes.sort(Fix.SORT_BY_RELEVANCE);
     return fixes.isNotEmpty ? fixes.first : null;
   }
 
   void _addFixFromBuilder(ChangeBuilder builder, CorrectionProducer producer) {
-    if (builder == null) return;
     var change = builder.sourceChange;
     if (change.edits.isEmpty) {
       return;
     }
+
     var kind = producer.fixKind;
+    if (kind == null) {
+      return;
+    }
+
     change.id = kind.id;
     change.message = formatList(kind.message, producer.fixArguments);
     fixes.add(Fix(kind, change));
@@ -1801,11 +1812,37 @@
   }
 }
 
+/// [_FixState] that is still empty.
+class _EmptyFixState implements _FixState {
+  @override
+  final ChangeBuilder builder;
+
+  _EmptyFixState(this.builder);
+
+  @override
+  int get fixCount => 0;
+}
+
 /// State associated with producing fix-all-in-file fixes.
-class FixState {
-  ChangeBuilder builder;
-  FixKind fixKind;
-  int fixCount = 0;
-  FixState(ChangeWorkspace workspace)
-      : builder = ChangeBuilder(workspace: workspace);
+abstract class _FixState {
+  ChangeBuilder get builder;
+
+  int get fixCount;
+}
+
+/// [_FixState] that has a fix, so knows its kind.
+class _NotEmptyFixState implements _FixState {
+  @override
+  final ChangeBuilder builder;
+
+  final FixKind fixKind;
+
+  @override
+  final int fixCount;
+
+  _NotEmptyFixState({
+    required this.builder,
+    required this.fixKind,
+    required this.fixCount,
+  });
 }
diff --git a/pkg/analysis_server/lib/src/services/correction/selection_analyzer.dart b/pkg/analysis_server/lib/src/services/correction/selection_analyzer.dart
index d71a7e1..5e42503 100644
--- a/pkg/analysis_server/lib/src/services/correction/selection_analyzer.dart
+++ b/pkg/analysis_server/lib/src/services/correction/selection_analyzer.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 'package:analyzer/dart/ast/ast.dart';
 import 'package:analyzer/dart/ast/visitor.dart';
 import 'package:analyzer/src/generated/source.dart';
@@ -13,18 +11,18 @@
 class SelectionAnalyzer extends GeneralizingAstVisitor<void> {
   final SourceRange selection;
 
-  AstNode _coveringNode;
-  List<AstNode> _selectedNodes;
+  AstNode? _coveringNode;
+  List<AstNode> _selectedNodes = [];
 
   SelectionAnalyzer(this.selection);
 
   /// Return the [AstNode] with the shortest length which completely covers the
   /// specified selection.
-  AstNode get coveringNode => _coveringNode;
+  AstNode? get coveringNode => _coveringNode;
 
   /// Returns the first selected [AstNode], may be `null`.
-  AstNode get firstSelectedNode {
-    if (_selectedNodes == null || _selectedNodes.isEmpty) {
+  AstNode? get firstSelectedNode {
+    if (_selectedNodes.isEmpty) {
       return null;
     }
     return _selectedNodes[0];
@@ -32,15 +30,14 @@
 
   /// Returns `true` if there are [AstNode]s fully covered by the
   /// selection [SourceRange].
-  bool get hasSelectedNodes =>
-      _selectedNodes != null && _selectedNodes.isNotEmpty;
+  bool get hasSelectedNodes => _selectedNodes.isNotEmpty;
 
   /// Returns `true` if there was no selected nodes yet.
-  bool get isFirstNode => _selectedNodes == null;
+  bool get isFirstNode => _selectedNodes.isEmpty;
 
   /// Returns the last selected [AstNode], may be `null`.
-  AstNode get lastSelectedNode {
-    if (_selectedNodes == null || _selectedNodes.isEmpty) {
+  AstNode? get lastSelectedNode {
+    if (_selectedNodes.isEmpty) {
       return null;
     }
     return _selectedNodes[_selectedNodes.length - 1];
@@ -48,9 +45,6 @@
 
   /// Return the [AstNode]s fully covered by the selection [SourceRange].
   List<AstNode> get selectedNodes {
-    if (_selectedNodes == null || _selectedNodes.isEmpty) {
-      return [];
-    }
     return _selectedNodes;
   }
 
@@ -62,7 +56,7 @@
 
   /// Adds second or more selected [AstNode].
   void handleNextSelectedNode(AstNode node) {
-    if (firstSelectedNode.parent == node.parent) {
+    if (firstSelectedNode?.parent == node.parent) {
       _selectedNodes.add(node);
     }
   }
@@ -75,7 +69,7 @@
 
   /// Resets selected nodes.
   void reset() {
-    _selectedNodes = null;
+    _selectedNodes = [];
   }
 
   @override
diff --git a/pkg/analysis_server/lib/src/services/correction/statement_analyzer.dart b/pkg/analysis_server/lib/src/services/correction/statement_analyzer.dart
index 3f62794..320aae7 100644
--- a/pkg/analysis_server/lib/src/services/correction/statement_analyzer.dart
+++ b/pkg/analysis_server/lib/src/services/correction/statement_analyzer.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 'package:analysis_server/src/protocol_server.dart';
 import 'package:analysis_server/src/services/correction/selection_analyzer.dart';
 import 'package:analysis_server/src/services/correction/status.dart';
@@ -12,6 +10,7 @@
 import 'package:analyzer/dart/analysis/results.dart';
 import 'package:analyzer/dart/ast/ast.dart';
 import 'package:analyzer/dart/ast/token.dart';
+import 'package:analyzer/error/listener.dart';
 import 'package:analyzer/src/dart/scanner/reader.dart';
 import 'package:analyzer/src/dart/scanner/scanner.dart';
 import 'package:analyzer/src/generated/source.dart';
@@ -22,7 +21,8 @@
 List<Token> _getTokens(String text, FeatureSet featureSet) {
   try {
     var tokens = <Token>[];
-    var scanner = Scanner(null, CharSequenceReader(text), null)
+    var scanner = Scanner(_SourceMock.instance, CharSequenceReader(text),
+        AnalysisErrorListener.NULL_LISTENER)
       ..configureFeatures(
         featureSetForOverriding: featureSet,
         featureSet: featureSet,
@@ -30,11 +30,11 @@
     var token = scanner.tokenize();
     while (token.type != TokenType.EOF) {
       tokens.add(token);
-      token = token.next;
+      token = token.next!;
     }
     return tokens;
   } catch (e) {
-    return List<Token>.filled(0, null);
+    return const <Token>[];
   }
 }
 
@@ -52,11 +52,11 @@
 
   /// Analyze the selection, compute [status] and nodes.
   void analyze() {
-    resolveResult.unit.accept(this);
+    resolveResult.unit!.accept(this);
   }
 
   /// Records fatal error with given message and [Location].
-  void invalidSelection(String message, [Location context]) {
+  void invalidSelection(String message, [Location? context]) {
     if (!_status.hasFatalError) {
       _status.addFatalError(message, context);
     }
@@ -64,16 +64,16 @@
   }
 
   @override
-  Object visitCompilationUnit(CompilationUnit node) {
+  void visitCompilationUnit(CompilationUnit node) {
     super.visitCompilationUnit(node);
     if (!hasSelectedNodes) {
-      return null;
+      return;
     }
     // check that selection does not begin/end in comment
     {
       var selectionStart = selection.offset;
       var selectionEnd = selection.end;
-      var commentRanges = getCommentRanges(resolveResult.unit);
+      var commentRanges = getCommentRanges(resolveResult.unit!);
       for (var commentRange in commentRanges) {
         if (commentRange.contains(selectionStart)) {
           invalidSelection('Selection begins inside a comment.');
@@ -87,22 +87,20 @@
     if (!_status.hasFatalError) {
       _checkSelectedNodes(node);
     }
-    return null;
   }
 
   @override
-  Object visitDoStatement(DoStatement node) {
+  void visitDoStatement(DoStatement node) {
     super.visitDoStatement(node);
     var selectedNodes = this.selectedNodes;
     if (_contains(selectedNodes, node.body)) {
       invalidSelection(
           "Operation not applicable to a 'do' statement's body and expression.");
     }
-    return null;
   }
 
   @override
-  Object visitForStatement(ForStatement node) {
+  void visitForStatement(ForStatement node) {
     super.visitForStatement(node);
     var forLoopParts = node.forLoopParts;
     if (forLoopParts is ForParts) {
@@ -129,11 +127,10 @@
             "Operation not applicable to a 'for' statement's updaters and body.");
       }
     }
-    return null;
   }
 
   @override
-  Object visitSwitchStatement(SwitchStatement node) {
+  void visitSwitchStatement(SwitchStatement node) {
     super.visitSwitchStatement(node);
     var selectedNodes = this.selectedNodes;
     List<SwitchMember> switchMembers = node.members;
@@ -144,11 +141,10 @@
         break;
       }
     }
-    return null;
   }
 
   @override
-  Object visitTryStatement(TryStatement node) {
+  void visitTryStatement(TryStatement node) {
     super.visitTryStatement(node);
     var firstSelectedNode = this.firstSelectedNode;
     if (firstSelectedNode != null) {
@@ -168,11 +164,10 @@
         }
       }
     }
-    return null;
   }
 
   @override
-  Object visitWhileStatement(WhileStatement node) {
+  void visitWhileStatement(WhileStatement node) {
     super.visitWhileStatement(node);
     var selectedNodes = this.selectedNodes;
     if (_contains(selectedNodes, node.condition) &&
@@ -180,7 +175,6 @@
       invalidSelection(
           "Operation not applicable to a while statement's expression and body.");
     }
-    return null;
   }
 
   /// Checks final selected [AstNode]s after processing [CompilationUnit].
@@ -214,13 +208,13 @@
 
   /// Returns `true` if there are [Token]s in the given [SourceRange].
   bool _hasTokens(SourceRange range) {
-    var fullText = resolveResult.content;
+    var fullText = resolveResult.content!;
     var rangeText = fullText.substring(range.offset, range.end);
-    return _getTokens(rangeText, resolveResult.unit.featureSet).isNotEmpty;
+    return _getTokens(rangeText, resolveResult.unit!.featureSet).isNotEmpty;
   }
 
   /// Returns `true` if [nodes] contains [node].
-  static bool _contains(List<AstNode> nodes, AstNode node) =>
+  static bool _contains(List<AstNode> nodes, AstNode? node) =>
       nodes.contains(node);
 
   /// Returns `true` if [nodes] contains one of the [otherNodes].
@@ -233,3 +227,10 @@
     return false;
   }
 }
+
+class _SourceMock implements Source {
+  static final Source instance = _SourceMock();
+
+  @override
+  dynamic noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
+}
diff --git a/pkg/analysis_server/lib/src/services/correction/util.dart b/pkg/analysis_server/lib/src/services/correction/util.dart
index c61a3fd..2f4bec9 100644
--- a/pkg/analysis_server/lib/src/services/correction/util.dart
+++ b/pkg/analysis_server/lib/src/services/correction/util.dart
@@ -429,7 +429,7 @@
 
 /// Returns the given [statement] if not a block, or the first child statement
 /// if a block, or `null` if more than one child.
-Statement? getSingleStatement(Statement statement) {
+Statement? getSingleStatement(Statement? statement) {
   if (statement is Block) {
     List<Statement> blockStatements = statement.statements;
     if (blockStatements.length != 1) {
diff --git a/pkg/analysis_server/test/analysis/get_hover_test.dart b/pkg/analysis_server/test/analysis/get_hover_test.dart
index 47d5d33..d361d10 100644
--- a/pkg/analysis_server/test/analysis/get_hover_test.dart
+++ b/pkg/analysis_server/test/analysis/get_hover_test.dart
@@ -14,11 +14,36 @@
 
 void main() {
   defineReflectiveSuite(() {
+    defineReflectiveTests(AnalysisHoverBazelTest);
     defineReflectiveTests(AnalysisHoverTest);
   });
 }
 
 @reflectiveTest
+class AnalysisHoverBazelTest extends AbstractAnalysisTest {
+  Future<void> test_bazel_notOwnedUri() async {
+    newFile('/workspace/WORKSPACE');
+    projectPath = newFolder('/workspace').path;
+    testFile = convertPath('/workspace/dart/my/lib/test.dart');
+
+    newFile(
+      '/workspace/bazel-genfiles/dart/my/lib/test.dart',
+      content: '// generated',
+    );
+
+    createProject();
+
+    addTestFile('''
+class A {}
+''');
+
+    var request = AnalysisGetHoverParams(testFile, 0).toRequest('0');
+    var response = await waitResponse(request);
+    expect(response.error, isNotNull);
+  }
+}
+
+@reflectiveTest
 class AnalysisHoverTest extends AbstractAnalysisTest {
   Future<HoverInformation> prepareHover(String search) {
     var offset = findOffset(search);
diff --git a/pkg/analysis_server/test/src/plugin/notification_manager_test.dart b/pkg/analysis_server/test/src/plugin/notification_manager_test.dart
index 25f5615..0f7483d 100644
--- a/pkg/analysis_server/test/src/plugin/notification_manager_test.dart
+++ b/pkg/analysis_server/test/src/plugin/notification_manager_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 'package:analysis_server/protocol/protocol.dart' as server;
 import 'package:analysis_server/protocol/protocol_generated.dart' as server;
 import 'package:analysis_server/src/channel/channel.dart';
@@ -33,13 +31,13 @@
 
 @reflectiveTest
 class NotificationManagerTest extends ProtocolTestUtilities {
-  String testDir;
-  String fileA;
-  String fileB;
+  late String testDir;
+  late String fileA;
+  late String fileB;
 
-  TestChannel channel;
+  late TestChannel channel;
 
-  NotificationManager manager;
+  late NotificationManager manager;
 
   void setUp() {
     var provider = MemoryResourceProvider();
@@ -389,8 +387,7 @@
   }
 
   void _verifyErrors(String fileName, List<AnalysisError> expectedErrors) {
-    var notification = channel.sentNotification;
-    expect(notification, isNotNull);
+    var notification = channel.sentNotification!;
     expect(notification.event, 'analysis.errors');
     var params = server.AnalysisErrorsParams.fromNotification(notification);
     expect(params, isNotNull);
@@ -401,8 +398,7 @@
 
   void _verifyFoldingRegions(
       String fileName, List<FoldingRegion> expectedRegions) {
-    var notification = channel.sentNotification;
-    expect(notification, isNotNull);
+    var notification = channel.sentNotification!;
     expect(notification.event, 'analysis.folding');
     var params = server.AnalysisFoldingParams.fromNotification(notification);
     expect(params, isNotNull);
@@ -413,8 +409,7 @@
 
   void _verifyHighlightRegions(
       String fileName, List<HighlightRegion> expectedRegions) {
-    var notification = channel.sentNotification;
-    expect(notification, isNotNull);
+    var notification = channel.sentNotification!;
     expect(notification.event, 'analysis.highlights');
     var params = server.AnalysisHighlightsParams.fromNotification(notification);
     expect(params, isNotNull);
@@ -424,8 +419,7 @@
   }
 
   void _verifyNavigationParams(server.AnalysisNavigationParams expectedParams) {
-    var notification = channel.sentNotification;
-    expect(notification, isNotNull);
+    var notification = channel.sentNotification!;
     expect(notification.event, 'analysis.navigation');
     var params = server.AnalysisNavigationParams.fromNotification(notification);
     expect(params, isNotNull);
@@ -438,8 +432,7 @@
 
   void _verifyOccurrences(
       String fileName, List<Occurrences> expectedOccurrences) {
-    var notification = channel.sentNotification;
-    expect(notification, isNotNull);
+    var notification = channel.sentNotification!;
     expect(notification.event, 'analysis.occurrences');
     var params =
         server.AnalysisOccurrencesParams.fromNotification(notification);
@@ -450,8 +443,7 @@
   }
 
   void _verifyOutlines(String fileName, Outline expectedOutline) {
-    var notification = channel.sentNotification;
-    expect(notification, isNotNull);
+    var notification = channel.sentNotification!;
     expect(notification.event, 'analysis.outline');
     var params = server.AnalysisOutlineParams.fromNotification(notification);
     expect(params, isNotNull);
@@ -461,8 +453,7 @@
   }
 
   void _verifyPluginError(bool isFatal, String message, String stackTrace) {
-    var notification = channel.sentNotification;
-    expect(notification, isNotNull);
+    var notification = channel.sentNotification!;
     expect(notification.event, 'server.error');
     var params = server.ServerErrorParams.fromNotification(notification);
     expect(params, isNotNull);
@@ -474,7 +465,7 @@
 }
 
 class TestChannel implements ServerCommunicationChannel {
-  server.Notification sentNotification;
+  server.Notification? sentNotification;
 
   @override
   void close() {
@@ -483,7 +474,7 @@
 
   @override
   void listen(void Function(server.Request) onRequest,
-      {Function onError, void Function() onDone}) {
+      {Function? onError, void Function()? onDone}) {
     fail('Unexpected invocation of listen');
   }
 
diff --git a/pkg/analysis_server/test/src/plugin/plugin_manager_test.dart b/pkg/analysis_server/test/src/plugin/plugin_manager_test.dart
index ae1ba51..39e4ddc 100644
--- a/pkg/analysis_server/test/src/plugin/plugin_manager_test.dart
+++ b/pkg/analysis_server/test/src/plugin/plugin_manager_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' as io;
 
 import 'package:analysis_server/src/plugin/notification_manager.dart';
@@ -36,12 +34,12 @@
 
 @reflectiveTest
 class BuiltInPluginInfoTest with ResourceProviderMixin, _ContextRoot {
-  TestNotificationManager notificationManager;
-  BuiltInPluginInfo plugin;
+  late TestNotificationManager notificationManager;
+  late BuiltInPluginInfo plugin;
 
   void setUp() {
     notificationManager = TestNotificationManager();
-    plugin = BuiltInPluginInfo(null, 'test plugin', notificationManager,
+    plugin = BuiltInPluginInfo((_) {}, 'test plugin', notificationManager,
         InstrumentationService.NULL_SERVICE);
   }
 
@@ -105,11 +103,11 @@
 
 @reflectiveTest
 class DiscoveredPluginInfoTest with ResourceProviderMixin, _ContextRoot {
-  TestNotificationManager notificationManager;
+  late TestNotificationManager notificationManager;
   String pluginPath = '/pluginDir';
   String executionPath = '/pluginDir/bin/plugin.dart';
   String packagesPath = '/pluginDir/.packages';
-  DiscoveredPluginInfo plugin;
+  late DiscoveredPluginInfo plugin;
 
   void setUp() {
     notificationManager = TestNotificationManager();
@@ -130,7 +128,7 @@
     expect(plugin.contextRoots, [contextRoot1]);
     var sentRequests = channel.sentRequests;
     expect(sentRequests, hasLength(1));
-    List<Map> roots = sentRequests[0].params['roots'];
+    var roots = sentRequests[0].params['roots'] as List<Map>;
     expect(roots[0]['optionsFile'], optionsFile.path);
   }
 
@@ -188,7 +186,7 @@
 @reflectiveTest
 class PluginManagerFromDiskTest extends PluginTestSupport {
   String byteStorePath = '/byteStore';
-  PluginManager manager;
+  late PluginManager manager;
 
   @override
   void setUp() {
@@ -447,10 +445,10 @@
 
 @reflectiveTest
 class PluginManagerTest with ResourceProviderMixin, _ContextRoot {
-  String byteStorePath;
-  String sdkPath;
-  TestNotificationManager notificationManager;
-  PluginManager manager;
+  late String byteStorePath;
+  late String sdkPath;
+  late TestNotificationManager notificationManager;
+  late PluginManager manager;
 
   void setUp() {
     byteStorePath = resourceProvider.convertPath('/byteStore');
@@ -500,7 +498,7 @@
     newFolder('/workspaceRoot/bazel-bin');
     newFolder('/workspaceRoot/bazel-genfiles');
 
-    String newPackage(String packageName, [List<String> dependencies]) {
+    String newPackage(String packageName, [List<String>? dependencies]) {
       var packageRoot =
           newFolder('/workspaceRoot/third_party/dart/$packageName').path;
       newFile('$packageRoot/lib/$packageName.dart');
@@ -579,13 +577,13 @@
 
 @reflectiveTest
 class PluginSessionTest with ResourceProviderMixin {
-  TestNotificationManager notificationManager;
-  String pluginPath;
-  String executionPath;
-  String packagesPath;
-  String sdkPath;
-  PluginInfo plugin;
-  PluginSession session;
+  late TestNotificationManager notificationManager;
+  late String pluginPath;
+  late String executionPath;
+  late String packagesPath;
+  late String sdkPath;
+  late PluginInfo plugin;
+  late PluginSession session;
 
   void setUp() {
     notificationManager = TestNotificationManager();
@@ -655,7 +653,7 @@
   Future<void> test_start_running() async {
     TestServerCommunicationChannel(session);
     try {
-      await session.start(null, '');
+      await session.start('', '');
       fail('Expected a StateError to be thrown');
     } on StateError {
       // Expected behavior
@@ -677,12 +675,12 @@
 /// A class designed to be used as a superclass for test classes that define
 /// tests that require plugins to be created on disk.
 abstract class PluginTestSupport {
-  PhysicalResourceProvider resourceProvider;
-  TestNotificationManager notificationManager;
+  late PhysicalResourceProvider resourceProvider;
+  late TestNotificationManager notificationManager;
 
   /// The content to be used for the '.packages' file, or `null` if the content
   /// has not yet been computed.
-  String _packagesFileContent;
+  String? _packagesFileContent;
 
   void setUp() {
     resourceProvider = PhysicalResourceProvider.INSTANCE;
@@ -705,9 +703,9 @@
   /// The [test] function will be passed the path of the directory that was
   /// created.
   Future<void> withPlugin(
-      {String content,
-      String pluginName,
-      Future<void> Function(String) test}) async {
+      {String? content,
+      String? pluginName,
+      required Future<void> Function(String) test}) async {
     var tempDirectory =
         io.Directory.systemTemp.createTempSync(pluginName ?? 'test_plugin');
     try {
@@ -752,9 +750,9 @@
   /// The [test] function will be passed the path of the directory that was
   /// created.
   Future<void> withPubspecPlugin(
-      {String content,
-      String pluginName,
-      Future<void> Function(String) test}) async {
+      {String? content,
+      String? pluginName,
+      required Future<void> Function(String) test}) async {
     var tempDirectory =
         io.Directory.systemTemp.createTempSync(pluginName ?? 'test_plugin');
     try {
@@ -850,13 +848,14 @@
 
   /// Return the content to be used for the '.packages' file.
   String _getPackagesFileContent() {
-    if (_packagesFileContent == null) {
+    var packagesFileContent = _packagesFileContent;
+    if (packagesFileContent == null) {
       var sdkPackagesFile = io.File(_sdkPackagesPath());
       var sdkPackageMap = sdkPackagesFile.readAsLinesSync();
-      _packagesFileContent =
+      packagesFileContent = _packagesFileContent =
           _convertPackageMap(path.dirname(sdkPackagesFile.path), sdkPackageMap);
     }
-    return _packagesFileContent;
+    return packagesFileContent;
   }
 
   /// Return the content to be used for the 'pubspec.yaml' file.
@@ -926,9 +925,9 @@
   }
 
   @override
-  void listen(void Function(Response) onResponse,
-      void Function(Notification) onNotification,
-      {void Function(dynamic) onError, void Function() onDone}) {
+  void listen(void Function(Response response) onResponse,
+      void Function(Notification notification) onNotification,
+      {void Function(dynamic error)? onError, void Function()? onDone}) {
     fail('Unexpected invocation of listen');
   }
 
diff --git a/pkg/analysis_server/test/src/plugin/plugin_watcher_test.dart b/pkg/analysis_server/test/src/plugin/plugin_watcher_test.dart
index 7906315..62eb89f 100644
--- a/pkg/analysis_server/test/src/plugin/plugin_watcher_test.dart
+++ b/pkg/analysis_server/test/src/plugin/plugin_watcher_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 'package:analysis_server/src/plugin/plugin_locator.dart';
@@ -26,8 +24,8 @@
 
 @reflectiveTest
 class PluginWatcherTest extends AbstractContextTest {
-  TestPluginManager manager;
-  PluginWatcher watcher;
+  late TestPluginManager manager;
+  late PluginWatcher watcher;
 
   @override
   void setUp() {
@@ -88,7 +86,7 @@
 
   void test_removedDriver() {
     var driver = driverFor(testPackageRootPath);
-    var contextRoot = driver.analysisContext.contextRoot;
+    var contextRoot = driver.analysisContext!.contextRoot;
     watcher.addedDriver(driver);
     watcher.removedDriver(driver);
     expect(manager.removedContextRoots, equals([contextRoot]));
diff --git a/pkg/analysis_server/test/src/plugin/test_all.dart b/pkg/analysis_server/test/src/plugin/test_all.dart
index 70d0fd0..9240a5d 100644
--- a/pkg/analysis_server/test/src/plugin/test_all.dart
+++ b/pkg/analysis_server/test/src/plugin/test_all.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 'package:test_reflective_loader/test_reflective_loader.dart';
 
 import 'notification_manager_test.dart' as notification_manager_test;
diff --git a/pkg/analysis_server/test/src/services/correction/assist/add_diagnostic_property_reference_test.dart b/pkg/analysis_server/test/src/services/correction/assist/add_diagnostic_property_reference_test.dart
index 6a79a03..f9b684c 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/add_diagnostic_property_reference_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/add_diagnostic_property_reference_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/add_not_null_assert_test.dart b/pkg/analysis_server/test/src/services/correction/assist/add_not_null_assert_test.dart
index ac70f98..d100c48 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/add_not_null_assert_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/add_not_null_assert_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/add_return_type_test.dart b/pkg/analysis_server/test/src/services/correction/assist/add_return_type_test.dart
index 3224af1..c288dd0 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/add_return_type_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/add_return_type_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analysis_server/src/services/linter/lint_names.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/add_type_annotation_test.dart b/pkg/analysis_server/test/src/services/correction/assist/add_type_annotation_test.dart
index e897474..06724fb 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/add_type_annotation_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/add_type_annotation_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analysis_server/src/services/linter/lint_names.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/assign_to_local_variable_test.dart b/pkg/analysis_server/test/src/services/correction/assist/assign_to_local_variable_test.dart
index 9630000..3fa857a 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/assign_to_local_variable_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/assign_to_local_variable_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/protocol/protocol_common.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/assist_processor.dart b/pkg/analysis_server/test/src/services/correction/assist/assist_processor.dart
index ae5b9a6..9dc4e9f 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/assist_processor.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/assist_processor.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 'package:analysis_server/plugin/edit/assist/assist_core.dart';
 import 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analysis_server/src/services/correction/assist_internal.dart';
@@ -23,11 +21,11 @@
 
 /// A base class defining support for writing assist processor tests.
 abstract class AssistProcessorTest extends AbstractSingleUnitTest {
-  int _offset;
-  int _length;
+  late int _offset;
+  late int _length;
 
-  SourceChange _change;
-  String _resultCode;
+  late SourceChange _change;
+  late String _resultCode;
 
   /// Return the kind of assist expected by this class.
   AssistKind get kind;
@@ -67,9 +65,8 @@
     super.addTestSource(code);
   }
 
-  void assertExitPosition({String before, String after}) {
-    var exitPosition = _change.selection;
-    expect(exitPosition, isNotNull);
+  void assertExitPosition({String? before, String? after}) {
+    var exitPosition = _change.selection!;
     expect(exitPosition.file, testFile);
     if (before != null) {
       expect(exitPosition.offset, _resultCode.indexOf(before));
@@ -88,7 +85,7 @@
   /// pairs of source code: the states of the code before and after the edits
   /// have been applied.
   Future<void> assertHasAssist(String expected,
-      {Map<String, List<String>> additionallyChangedFiles}) async {
+      {Map<String, List<String>>? additionallyChangedFiles}) async {
     if (useLineEndingsForPlatform) {
       expected = normalizeNewlinesForPlatform(expected);
       additionallyChangedFiles = additionallyChangedFiles?.map((key, value) =>
@@ -105,13 +102,14 @@
       expect(_resultCode, expected);
     } else {
       expect(fileEdits, hasLength(additionallyChangedFiles.length + 1));
-      _resultCode = SourceEdit.applySequence(
-          testCode, _change.getFileEdit(testFile).edits);
+      var fileEdit = _change.getFileEdit(testFile)!;
+      _resultCode = SourceEdit.applySequence(testCode, fileEdit.edits);
       expect(_resultCode, expected);
-      for (var filePath in additionallyChangedFiles.keys) {
-        var pair = additionallyChangedFiles[filePath];
-        var resultCode = SourceEdit.applySequence(
-            pair[0], _change.getFileEdit(filePath).edits);
+      for (var additionalEntry in additionallyChangedFiles.entries) {
+        var filePath = additionalEntry.key;
+        var pair = additionalEntry.value;
+        var fileEdit = _change.getFileEdit(filePath)!;
+        var resultCode = SourceEdit.applySequence(pair[0], fileEdit.edits);
         expect(resultCode, pair[1]);
       }
     }
@@ -137,7 +135,7 @@
   }
 
   void assertLinkedGroup(int groupIndex, List<String> expectedStrings,
-      [List<LinkedEditSuggestion> expectedSuggestions]) {
+      [List<LinkedEditSuggestion>? expectedSuggestions]) {
     var group = _change.linkedEditGroups[groupIndex];
     var expectedPositions = _findResultPositions(expectedStrings);
     expect(group.positions, unorderedEquals(expectedPositions));
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_class_to_mixin_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_class_to_mixin_test.dart
index 20b116b..9ccf27d 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_class_to_mixin_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_class_to_mixin_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_documentation_into_block_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_documentation_into_block_test.dart
index b7b2a62..9fe4f87 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_documentation_into_block_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_documentation_into_block_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_documentation_into_line_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_documentation_into_line_test.dart
index 660e128..92a8449 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_documentation_into_line_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_documentation_into_line_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analysis_server/src/services/linter/lint_names.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_into_async_body_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_into_async_body_test.dart
index 353acef..0120636 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_into_async_body_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_into_async_body_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_into_block_body_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_into_block_body_test.dart
index 869228d..db04588 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_into_block_body_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_into_block_body_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_into_expression_body_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_into_expression_body_test.dart
index 612ddfb..6e8152d 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_into_expression_body_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_into_expression_body_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analysis_server/src/services/linter/lint_names.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_into_final_field_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_into_final_field_test.dart
index 5e2aaba..345eda1 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_into_final_field_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_into_final_field_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_into_for_index_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_into_for_index_test.dart
index 6fc9393..d6aca70 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_into_for_index_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_into_for_index_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_into_generic_function_syntax_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_into_generic_function_syntax_test.dart
index 90c02e0..cb80726 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_into_generic_function_syntax_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_into_generic_function_syntax_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_into_getter_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_into_getter_test.dart
index d806251..ffc7664 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_into_getter_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_into_getter_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_into_is_not_empty_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_into_is_not_empty_test.dart
index c34ba7e..ce777b0 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_into_is_not_empty_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_into_is_not_empty_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_into_is_not_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_into_is_not_test.dart
index e66f540..5a68942 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_into_is_not_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_into_is_not_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_part_of_to_uri_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_part_of_to_uri_test.dart
index e9f455e..4f99ef9 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_part_of_to_uri_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_part_of_to_uri_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_to_double_quoted_string_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_to_double_quoted_string_test.dart
index 16bd7b3..813e4bc 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_to_double_quoted_string_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_to_double_quoted_string_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_to_field_parameter_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_to_field_parameter_test.dart
index acb1577..f616eab 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_to_field_parameter_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_to_field_parameter_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_to_for_element_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_to_for_element_test.dart
index e9b0024..80cd6c1 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_to_for_element_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_to_for_element_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analysis_server/src/services/linter/lint_names.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_to_if_element_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_to_if_element_test.dart
index 274f6d4..b277e60 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_to_if_element_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_to_if_element_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analysis_server/src/services/linter/lint_names.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_to_int_literal_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_to_int_literal_test.dart
index 7ebfdae..919ab32 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_to_int_literal_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_to_int_literal_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analysis_server/src/services/linter/lint_names.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_to_list_literal_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_to_list_literal_test.dart
index 68a565d..880a6f1 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_to_list_literal_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_to_list_literal_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_to_map_literal_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_to_map_literal_test.dart
index f2d4e19..9b6b24b 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_to_map_literal_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_to_map_literal_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_to_multiline_string_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_to_multiline_string_test.dart
index 1f3291a..1e52915 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_to_multiline_string_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_to_multiline_string_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_to_normal_parameter_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_to_normal_parameter_test.dart
index c26c19b..90973a6 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_to_normal_parameter_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_to_normal_parameter_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_to_null_aware_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_to_null_aware_test.dart
index 67d578c..7d6b659 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_to_null_aware_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_to_null_aware_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analysis_server/src/services/linter/lint_names.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_to_package_import_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_to_package_import_test.dart
index 417fdcc..1fe3d84 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_to_package_import_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_to_package_import_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analysis_server/src/services/linter/lint_names.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_to_set_literal_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_to_set_literal_test.dart
index 20eeb8c..76079f7 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_to_set_literal_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_to_set_literal_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_to_single_quoted_string_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_to_single_quoted_string_test.dart
index 8515b73..4214de8 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_to_single_quoted_string_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_to_single_quoted_string_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analysis_server/src/services/linter/lint_names.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_to_spread_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_to_spread_test.dart
index 22cf5e0..dc43575 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_to_spread_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_to_spread_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analysis_server/src/services/linter/lint_names.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/encapsulate_field_test.dart b/pkg/analysis_server/test/src/services/correction/assist/encapsulate_field_test.dart
index f359ea9..5817ae2 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/encapsulate_field_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/encapsulate_field_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/exchange_operands_test.dart b/pkg/analysis_server/test/src/services/correction/assist/exchange_operands_test.dart
index 5ea4c1f..c5921f3 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/exchange_operands_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/exchange_operands_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/flutter_convert_to_children_test.dart b/pkg/analysis_server/test/src/services/correction/assist/flutter_convert_to_children_test.dart
index 6241079..1bac364 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/flutter_convert_to_children_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/flutter_convert_to_children_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/flutter_convert_to_stateful_widget_test.dart b/pkg/analysis_server/test/src/services/correction/assist/flutter_convert_to_stateful_widget_test.dart
index 16088e8..426fa2b 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/flutter_convert_to_stateful_widget_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/flutter_convert_to_stateful_widget_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/flutter_move_down_test.dart b/pkg/analysis_server/test/src/services/correction/assist/flutter_move_down_test.dart
index ecab131..3ed98b5 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/flutter_move_down_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/flutter_move_down_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/flutter_move_up_test.dart b/pkg/analysis_server/test/src/services/correction/assist/flutter_move_up_test.dart
index e713017..905d316 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/flutter_move_up_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/flutter_move_up_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/flutter_remove_widget_test.dart b/pkg/analysis_server/test/src/services/correction/assist/flutter_remove_widget_test.dart
index 0cd56e9..f6ed88f 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/flutter_remove_widget_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/flutter_remove_widget_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/flutter_surround_with_set_state_test.dart b/pkg/analysis_server/test/src/services/correction/assist/flutter_surround_with_set_state_test.dart
index 7462d46..d13bb22 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/flutter_surround_with_set_state_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/flutter_surround_with_set_state_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/flutter_swap_with_child_test.dart b/pkg/analysis_server/test/src/services/correction/assist/flutter_swap_with_child_test.dart
index 2cd225e..babc107 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/flutter_swap_with_child_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/flutter_swap_with_child_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/flutter_swap_with_parent_test.dart b/pkg/analysis_server/test/src/services/correction/assist/flutter_swap_with_parent_test.dart
index e9e36b5..197470b 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/flutter_swap_with_parent_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/flutter_swap_with_parent_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_builder_test.dart b/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_builder_test.dart
index 1c8ecdc..0cf2d15 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_builder_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_builder_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_center_test.dart b/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_center_test.dart
index d34de66..877ffb7 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_center_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_center_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_column_test.dart b/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_column_test.dart
index 4b960dd..fc79cb7 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_column_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_column_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_container_test.dart b/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_container_test.dart
index 62aca16..04702fa 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_container_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_container_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_generic_test.dart b/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_generic_test.dart
index 5bc12d6..e8df73f 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_generic_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_generic_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_padding_test.dart b/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_padding_test.dart
index 6e4e119..685b2df 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_padding_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_padding_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_row_test.dart b/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_row_test.dart
index fd16ea4..a9e6554 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_row_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_row_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_sized_box_test.dart b/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_sized_box_test.dart
index 8f7b42b..74c6918 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_sized_box_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_sized_box_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_stream_builder_test.dart b/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_stream_builder_test.dart
index abb6e96..4c32342 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_stream_builder_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_stream_builder_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/import_add_show_test.dart b/pkg/analysis_server/test/src/services/correction/assist/import_add_show_test.dart
index 66bf905..e00ee78 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/import_add_show_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/import_add_show_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/inline_invocation_test.dart b/pkg/analysis_server/test/src/services/correction/assist/inline_invocation_test.dart
index 41352e8..23749ff 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/inline_invocation_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/inline_invocation_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analysis_server/src/services/linter/lint_names.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/introduce_local_cast_type_test.dart b/pkg/analysis_server/test/src/services/correction/assist/introduce_local_cast_type_test.dart
index 29f7c3e..784efb9 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/introduce_local_cast_type_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/introduce_local_cast_type_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/protocol/protocol_common.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/invert_if_statement_test.dart b/pkg/analysis_server/test/src/services/correction/assist/invert_if_statement_test.dart
index 503faef..b86a190 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/invert_if_statement_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/invert_if_statement_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/join_if_with_inner_test.dart b/pkg/analysis_server/test/src/services/correction/assist/join_if_with_inner_test.dart
index c4e4a9a..3c19528 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/join_if_with_inner_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/join_if_with_inner_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/join_if_with_outer_test.dart b/pkg/analysis_server/test/src/services/correction/assist/join_if_with_outer_test.dart
index 56a6a4a..a31c29e 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/join_if_with_outer_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/join_if_with_outer_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/join_variable_declaration_test.dart b/pkg/analysis_server/test/src/services/correction/assist/join_variable_declaration_test.dart
index f22173d..8b885c8 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/join_variable_declaration_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/join_variable_declaration_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/remove_type_annotation_test.dart b/pkg/analysis_server/test/src/services/correction/assist/remove_type_annotation_test.dart
index 62bfeca..a1efc00 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/remove_type_annotation_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/remove_type_annotation_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/replace_conditional_with_if_else_test.dart b/pkg/analysis_server/test/src/services/correction/assist/replace_conditional_with_if_else_test.dart
index 7be0adc..e5f1923 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/replace_conditional_with_if_else_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/replace_conditional_with_if_else_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/replace_if_else_with_conditional_test.dart b/pkg/analysis_server/test/src/services/correction/assist/replace_if_else_with_conditional_test.dart
index cbbf880..7641070 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/replace_if_else_with_conditional_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/replace_if_else_with_conditional_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/replace_with_var_test.dart b/pkg/analysis_server/test/src/services/correction/assist/replace_with_var_test.dart
index d0ab5ce..6ab4ad8 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/replace_with_var_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/replace_with_var_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/shadow_field_test.dart b/pkg/analysis_server/test/src/services/correction/assist/shadow_field_test.dart
index ba8a0e3..f13b966 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/shadow_field_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/shadow_field_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/sort_child_property_last_test.dart b/pkg/analysis_server/test/src/services/correction/assist/sort_child_property_last_test.dart
index 96c39a9..b407482 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/sort_child_property_last_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/sort_child_property_last_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analysis_server/src/services/linter/lint_names.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/split_and_condition_test.dart b/pkg/analysis_server/test/src/services/correction/assist/split_and_condition_test.dart
index 5845e92..2e96ea7 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/split_and_condition_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/split_and_condition_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/split_variable_declaration_test.dart b/pkg/analysis_server/test/src/services/correction/assist/split_variable_declaration_test.dart
index c9e5eb4..255f6e5 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/split_variable_declaration_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/split_variable_declaration_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/surround_with_block_test.dart b/pkg/analysis_server/test/src/services/correction/assist/surround_with_block_test.dart
index 085fec0..54ef449 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/surround_with_block_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/surround_with_block_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/surround_with_do_while_test.dart b/pkg/analysis_server/test/src/services/correction/assist/surround_with_do_while_test.dart
index ff7ca9c..d6ad18f 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/surround_with_do_while_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/surround_with_do_while_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/surround_with_for_in_test.dart b/pkg/analysis_server/test/src/services/correction/assist/surround_with_for_in_test.dart
index ecd4297..6b7ca74 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/surround_with_for_in_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/surround_with_for_in_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/surround_with_for_test.dart b/pkg/analysis_server/test/src/services/correction/assist/surround_with_for_test.dart
index 3ae3580..ca39826 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/surround_with_for_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/surround_with_for_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/surround_with_if_test.dart b/pkg/analysis_server/test/src/services/correction/assist/surround_with_if_test.dart
index 6b77b2c..91ed08c 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/surround_with_if_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/surround_with_if_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/surround_with_try_catch_test.dart b/pkg/analysis_server/test/src/services/correction/assist/surround_with_try_catch_test.dart
index 823ec7a..3fa1377 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/surround_with_try_catch_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/surround_with_try_catch_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/surround_with_try_finally_test.dart b/pkg/analysis_server/test/src/services/correction/assist/surround_with_try_finally_test.dart
index 81a75c4..e6d5010 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/surround_with_try_finally_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/surround_with_try_finally_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/surround_with_while_test.dart b/pkg/analysis_server/test/src/services/correction/assist/surround_with_while_test.dart
index c989ffd..24eb591 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/surround_with_while_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/surround_with_while_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/test_all.dart b/pkg/analysis_server/test/src/services/correction/assist/test_all.dart
index f39e638..1773afd 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/test_all.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/test_all.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 'package:test_reflective_loader/test_reflective_loader.dart';
 
 import 'add_diagnostic_property_reference_test.dart' as add_diagnostic_property;
diff --git a/pkg/analysis_server/test/src/services/correction/assist/use_curly_braces_test.dart b/pkg/analysis_server/test/src/services/correction/assist/use_curly_braces_test.dart
index df54292..93d28d6 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/use_curly_braces_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/use_curly_braces_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 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analysis_server/src/services/linter/lint_names.dart';
 import 'package:analyzer_plugin/utilities/assist/assist.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/fix/data_driven/add_type_parameter_test.dart b/pkg/analysis_server/test/src/services/correction/fix/data_driven/add_type_parameter_test.dart
index 1cb910e..9deceb5 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/data_driven/add_type_parameter_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/data_driven/add_type_parameter_test.dart
@@ -482,6 +482,7 @@
   Transform _add(int index, {List<String> components, String extendedType}) =>
       Transform(
           title: 'title',
+          date: DateTime.now(),
           element: ElementDescriptor(
               libraryUris: [Uri.parse(importUri)],
               kind: ElementKindUtilities.fromName(_kind),
diff --git a/pkg/analysis_server/test/src/services/correction/fix/data_driven/modify_parameters_test.dart b/pkg/analysis_server/test/src/services/correction/fix/data_driven/modify_parameters_test.dart
index bec1da6..3c72b70 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/data_driven/modify_parameters_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/data_driven/modify_parameters_test.dart
@@ -1011,6 +1011,7 @@
           List<ParameterModification> modifications, {String newName}) =>
       Transform(
           title: 'title',
+          date: DateTime.now(),
           element: ElementDescriptor(
               libraryUris: [Uri.parse(importUri)],
               kind: ElementKindUtilities.fromName(_kind),
diff --git a/pkg/analysis_server/test/src/services/correction/fix/data_driven/rename_parameter_test.dart b/pkg/analysis_server/test/src/services/correction/fix/data_driven/rename_parameter_test.dart
index 856d4e0..e846a6a 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/data_driven/rename_parameter_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/data_driven/rename_parameter_test.dart
@@ -333,6 +333,7 @@
   Transform _rename(List<String> components, String oldName, String newName) =>
       Transform(
           title: 'title',
+          date: DateTime.now(),
           element: ElementDescriptor(
               libraryUris: [Uri.parse(importUri)],
               kind: ElementKindUtilities.fromName(_kind),
diff --git a/pkg/analysis_server/test/src/services/correction/fix/data_driven/rename_test.dart b/pkg/analysis_server/test/src/services/correction/fix/data_driven/rename_test.dart
index 0affe38..ecf0e66 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/data_driven/rename_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/data_driven/rename_test.dart
@@ -1235,6 +1235,7 @@
 
   Transform _rename(List<String> components, String newName) => Transform(
       title: 'title',
+      date: DateTime.now(),
       element: ElementDescriptor(
           libraryUris: [Uri.parse(importUri)],
           kind: ElementKindUtilities.fromName(_kind),
diff --git a/pkg/analyzer/lib/dart/analysis/utilities.dart b/pkg/analyzer/lib/dart/analysis/utilities.dart
index 28ff71b..801d224 100644
--- a/pkg/analyzer/lib/dart/analysis/utilities.dart
+++ b/pkg/analyzer/lib/dart/analysis/utilities.dart
@@ -88,11 +88,18 @@
     featureSet: scanner.featureSet,
   );
   var unit = parser.parseCompilationUnit(token);
-  unit.lineInfo = LineInfo(scanner.lineStarts);
+  var lineInfo = LineInfo(scanner.lineStarts);
+  unit.lineInfo = lineInfo;
   ParseStringResult result =
       ParseStringResultImpl(content, unit, errorCollector.errors);
   if (throwIfDiagnostics && result.errors.isNotEmpty) {
-    throw ArgumentError('Content produced diagnostics when parsed');
+    var buffer = StringBuffer();
+    for (var error in result.errors) {
+      var location = lineInfo.getLocation(error.offset);
+      buffer.writeln('  ${error.errorCode.name}: ${error.message} - '
+          '${location.lineNumber}:${location.columnNumber}');
+    }
+    throw ArgumentError('Content produced diagnostics when parsed:\n$buffer');
   }
   return result;
 }
diff --git a/pkg/compiler/lib/src/kernel/dart2js_target.dart b/pkg/compiler/lib/src/kernel/dart2js_target.dart
index d41438e..5d1ae27 100644
--- a/pkg/compiler/lib/src/kernel/dart2js_target.dart
+++ b/pkg/compiler/lib/src/kernel/dart2js_target.dart
@@ -66,8 +66,6 @@
   LateLowering.nonNullableInitializedNonFinalLocal,
   LateLowering.nullableInitializedFinalLocal,
   LateLowering.nonNullableInitializedFinalLocal,
-  LateLowering.uninitializedNonFinalStaticField,
-  LateLowering.uninitializedFinalStaticField,
   LateLowering.initializedNonFinalStaticField,
   LateLowering.initializedFinalStaticField,
   LateLowering.uninitializedNonFinalInstanceField,
diff --git a/pkg/compiler/lib/src/kernel/transformations/late_lowering.dart b/pkg/compiler/lib/src/kernel/transformations/late_lowering.dart
index cf5c62c..3d0d2e0 100644
--- a/pkg/compiler/lib/src/kernel/transformations/late_lowering.dart
+++ b/pkg/compiler/lib/src/kernel/transformations/late_lowering.dart
@@ -9,41 +9,114 @@
 bool _shouldLowerVariable(VariableDeclaration node) =>
     node.initializer == null && node.isLate;
 
+bool _shouldLowerField(Field node) =>
+    node.initializer == null && node.isStatic && node.isLate;
+
+class _Reader {
+  final Procedure _procedure;
+  final FunctionType _type;
+  FunctionType _typeWithoutTypeParameters;
+
+  _Reader(this._procedure) : _type = _procedure.getterType {
+    _typeWithoutTypeParameters = _type.withoutTypeParameters;
+  }
+}
+
 class LateLowering {
   final Class _cellClass;
   final Constructor _cellConstructor;
 
-  final Procedure _readLocal;
-  List<TypeParameter> _readLocalTypeParameters;
-  FunctionType _readLocalTypeWithoutTypeParameters;
+  final _Reader _readLocal;
+  final _Reader _readField;
 
   final Procedure _setValue;
   final Procedure _setFinalLocalValue;
+  final Procedure _setFinalFieldValue;
 
-  final Map<VariableDeclaration, VariableDeclaration> _cells = {};
+  // TODO(fishythefish): Remove cells when exiting their scope.
+  final Map<VariableDeclaration, VariableDeclaration> _variableCells = {};
+  final Map<Field, Field> _fieldCells = {};
 
   Member _contextMember;
 
   LateLowering(LibraryIndex index)
       : _cellClass = index.getClass('dart:_late_helper', '_Cell'),
         _cellConstructor = index.getMember('dart:_late_helper', '_Cell', ''),
-        _readLocal = index.getMember('dart:_late_helper', '_Cell', 'readLocal'),
+        _readLocal =
+            _Reader(index.getMember('dart:_late_helper', '_Cell', 'readLocal')),
+        _readField =
+            _Reader(index.getMember('dart:_late_helper', '_Cell', 'readField')),
         _setValue = index.getMember('dart:_late_helper', '_Cell', 'set:value'),
         _setFinalLocalValue = index.getMember(
-            'dart:_late_helper', '_Cell', 'set:finalLocalValue') {
-    FunctionType _readLocalType = _readLocal.getterType;
-    _readLocalTypeParameters = _readLocalType.typeParameters;
-    _readLocalTypeWithoutTypeParameters = _readLocalType.withoutTypeParameters;
+            'dart:_late_helper', '_Cell', 'set:finalLocalValue'),
+        _setFinalFieldValue = index.getMember(
+            'dart:_late_helper', '_Cell', 'set:finalFieldValue');
+
+  void transformAdditionalExports(Library node) {
+    List<Reference> additionalExports = node.additionalExports;
+    Set<Reference> newExports = {};
+    additionalExports.removeWhere((Reference reference) {
+      Field cell = _fieldCells[reference.node];
+      if (cell == null) return false;
+      newExports.add(cell.getterReference);
+      return true;
+    });
+    additionalExports.addAll(newExports);
   }
 
+  ConstructorInvocation _callCellConstructor(int fileOffset) =>
+      ConstructorInvocation(
+          _cellConstructor, Arguments.empty()..fileOffset = fileOffset)
+        ..fileOffset = fileOffset;
+
+  InstanceInvocation _callReader(
+      _Reader reader, Expression receiver, DartType type, int fileOffset) {
+    Procedure procedure = reader._procedure;
+    List<DartType> typeArguments = [type];
+    return InstanceInvocation(
+        InstanceAccessKind.Instance,
+        receiver,
+        procedure.name,
+        Arguments(const [], types: typeArguments)..fileOffset = fileOffset,
+        interfaceTarget: procedure,
+        functionType:
+            Substitution.fromPairs(reader._type.typeParameters, typeArguments)
+                .substituteType(reader._typeWithoutTypeParameters))
+      ..fileOffset = fileOffset;
+  }
+
+  InstanceInvocation _callReadLocal(
+          Expression receiver, DartType type, int fileOffset) =>
+      _callReader(_readLocal, receiver, type, fileOffset);
+
+  InstanceInvocation _callReadField(
+          Expression receiver, DartType type, int fileOffset) =>
+      _callReader(_readField, receiver, type, fileOffset);
+
+  InstanceSet _callSetter(Procedure _setter, Expression receiver,
+          Expression value, int fileOffset) =>
+      InstanceSet(InstanceAccessKind.Instance, receiver, _setter.name, value,
+          interfaceTarget: _setter)
+        ..fileOffset = fileOffset;
+
+  InstanceSet _callSetValue(
+          Expression receiver, Expression value, int fileOffset) =>
+      _callSetter(_setValue, receiver, value, fileOffset);
+
+  InstanceSet _callSetFinalLocalValue(
+          Expression receiver, Expression value, int fileOffset) =>
+      _callSetter(_setFinalLocalValue, receiver, value, fileOffset);
+
+  InstanceSet _callSetFinalFieldValue(
+          Expression receiver, Expression value, int fileOffset) =>
+      _callSetter(_setFinalFieldValue, receiver, value, fileOffset);
+
   VariableDeclaration _variableCell(VariableDeclaration variable) {
     assert(_shouldLowerVariable(variable));
-    return _cells.putIfAbsent(variable, () {
+    return _variableCells.putIfAbsent(variable, () {
       int fileOffset = variable.fileOffset;
       return VariableDeclaration(variable.name,
-          initializer:
-              ConstructorInvocation(_cellConstructor, Arguments.empty())
-                ..fileOffset = fileOffset,
+          initializer: _callCellConstructor(fileOffset),
           type: InterfaceType(
               _cellClass, _contextMember.enclosingLibrary.nonNullable),
           isFinal: true)
@@ -76,17 +149,7 @@
 
     int fileOffset = node.fileOffset;
     VariableGet cell = _variableCellAccess(variable, fileOffset);
-    List<DartType> typeArguments = [node.promotedType ?? variable.type];
-    return InstanceInvocation(
-        InstanceAccessKind.Instance,
-        cell,
-        _readLocal.name,
-        Arguments(const [], types: typeArguments)..fileOffset = fileOffset,
-        interfaceTarget: _readLocal,
-        functionType:
-            Substitution.fromPairs(_readLocalTypeParameters, typeArguments)
-                .substituteType(_readLocalTypeWithoutTypeParameters))
-      ..fileOffset = fileOffset;
+    return _callReadLocal(cell, node.promotedType ?? variable.type, fileOffset);
   }
 
   TreeNode transformVariableSet(VariableSet node, Member contextMember) {
@@ -97,16 +160,64 @@
 
     int fileOffset = node.fileOffset;
     VariableGet cell = _variableCellAccess(variable, fileOffset);
-    if (variable.isFinal) {
-      return InstanceSet(InstanceAccessKind.Instance, cell,
-          _setFinalLocalValue.name, node.value,
-          interfaceTarget: _setFinalLocalValue)
-        ..fileOffset = fileOffset;
+    return variable.isFinal
+        ? _callSetFinalLocalValue(cell, node.value, fileOffset)
+        : _callSetValue(cell, node.value, fileOffset);
+  }
+
+  Field _fieldCell(Field field) {
+    assert(_shouldLowerField(field));
+    return _fieldCells.putIfAbsent(field, () {
+      int fileOffset = field.fileOffset;
+      field.getterReference.canonicalName?.unbind();
+      field.setterReference?.canonicalName?.unbind();
+      return Field.immutable(field.name,
+          type: InterfaceType(_cellClass, field.enclosingLibrary.nonNullable),
+          initializer: _callCellConstructor(fileOffset),
+          isFinal: true,
+          isStatic: true,
+          fileUri: field.fileUri)
+        ..fileOffset = fileOffset
+        ..isNonNullableByDefault = true;
+    });
+  }
+
+  StaticGet _fieldCellAccess(Field field, int fileOffset) =>
+      StaticGet(_fieldCell(field))..fileOffset = fileOffset;
+
+  TreeNode transformField(Field node, Member contextMember) {
+    _contextMember = contextMember;
+
+    if (!_shouldLowerField(node)) return node;
+
+    return _fieldCell(node);
+  }
+
+  TreeNode transformStaticGet(StaticGet node, Member contextMember) {
+    _contextMember = contextMember;
+
+    Member target = node.target;
+    if (target is Field && _shouldLowerField(target)) {
+      int fileOffset = node.fileOffset;
+      StaticGet cell = _fieldCellAccess(target, fileOffset);
+      return _callReadField(cell, target.type, fileOffset);
     } else {
-      return InstanceSet(
-          InstanceAccessKind.Instance, cell, _setValue.name, node.value,
-          interfaceTarget: _setValue)
-        ..fileOffset = fileOffset;
+      return node;
+    }
+  }
+
+  TreeNode transformStaticSet(StaticSet node, Member contextMember) {
+    _contextMember = contextMember;
+
+    Member target = node.target;
+    if (target is Field && _shouldLowerField(target)) {
+      int fileOffset = node.fileOffset;
+      StaticGet cell = _fieldCellAccess(target, fileOffset);
+      return target.isFinal
+          ? _callSetFinalFieldValue(cell, node.value, fileOffset)
+          : _callSetValue(cell, node.value, fileOffset);
+    } else {
+      return node;
     }
   }
 }
diff --git a/pkg/compiler/lib/src/kernel/transformations/lowering.dart b/pkg/compiler/lib/src/kernel/transformations/lowering.dart
index 915c5fb..ccc4d7e 100644
--- a/pkg/compiler/lib/src/kernel/transformations/lowering.dart
+++ b/pkg/compiler/lib/src/kernel/transformations/lowering.dart
@@ -17,6 +17,12 @@
     List<Library> libraries, CoreTypes coreTypes, ClassHierarchy hierarchy) {
   final transformer = _Lowering(coreTypes, hierarchy);
   libraries.forEach(transformer.visitLibrary);
+
+  // Do a second pass to remove/replace now-unused nodes.
+
+  // Since the transformer API doesn't visit `Library.additionalExports`, we
+  // have to manually replace references to transformed nodes.
+  libraries.forEach(transformer.transformAdditionalExports);
 }
 
 class _Lowering extends Transformer {
@@ -29,6 +35,10 @@
       : factorySpecializer = FactorySpecializer(coreTypes, hierarchy),
         _lateLowering = LateLowering(coreTypes.index);
 
+  void transformAdditionalExports(Library node) {
+    _lateLowering.transformAdditionalExports(node);
+  }
+
   @override
   TreeNode defaultMember(Member node) {
     _currentMember = node;
@@ -58,4 +68,22 @@
     node.transformChildren(this);
     return _lateLowering.transformVariableSet(node, _currentMember);
   }
+
+  @override
+  TreeNode visitField(Field node) {
+    node.transformChildren(this);
+    return _lateLowering.transformField(node, _currentMember);
+  }
+
+  @override
+  TreeNode visitStaticGet(StaticGet node) {
+    node.transformChildren(this);
+    return _lateLowering.transformStaticGet(node, _currentMember);
+  }
+
+  @override
+  TreeNode visitStaticSet(StaticSet node) {
+    node.transformChildren(this);
+    return _lateLowering.transformStaticSet(node, _currentMember);
+  }
 }
diff --git a/pkg/front_end/testcases/dart2js/late_statics.dart b/pkg/front_end/testcases/dart2js/late_statics.dart
index 1030ef4..4abe4c5 100644
--- a/pkg/front_end/testcases/dart2js/late_statics.dart
+++ b/pkg/front_end/testcases/dart2js/late_statics.dart
@@ -2,11 +2,18 @@
 // 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 'late_statics_lib.dart' as lib;
+export 'late_statics_lib.dart';
+
 void main() {
   testUninitializedNonFinalStaticField();
   testUninitializedFinalStaticField();
   testInitializedNonFinalStaticField();
   testInitializedFinalStaticField();
+  testUninitializedNonFinalTopLevelField();
+  testUninitializedFinalTopLevelField();
+  testInitializedNonFinalTopLevelField();
+  testInitializedFinalTopLevelField();
 }
 
 class Statics {
@@ -37,3 +44,25 @@
 void testInitializedFinalStaticField() {
   print(Statics.d);
 }
+
+void testUninitializedNonFinalTopLevelField() {
+  print(lib.a);
+  lib.a = 42;
+  print(lib.a);
+}
+
+void testUninitializedFinalTopLevelField() {
+  print(lib.b);
+  lib.b = 42;
+  print(lib.b);
+}
+
+void testInitializedNonFinalTopLevelField() {
+  print(lib.c);
+  lib.c = 42;
+  print(lib.c);
+}
+
+void testInitializedFinalTopLevelField() {
+  print(lib.d);
+}
diff --git a/pkg/front_end/testcases/dart2js/late_statics.dart.strong.expect b/pkg/front_end/testcases/dart2js/late_statics.dart.strong.expect
index f41ebf9..0a73391 100644
--- a/pkg/front_end/testcases/dart2js/late_statics.dart.strong.expect
+++ b/pkg/front_end/testcases/dart2js/late_statics.dart.strong.expect
@@ -2,38 +2,42 @@
 import self as self;
 import "dart:core" as core;
 import "dart:_internal" as _in;
+import "late_statics_lib.dart" as lat;
+additionalExports = (lat::a,
+  lat::a,
+  lat::b,
+  lat::b,
+  lat::c,
+  lat::c,
+  lat::d)
+
+import "org-dartlang-testcase:///late_statics_lib.dart" as lib;
+export "org-dartlang-testcase:///late_statics_lib.dart";
 
 class Statics extends core::Object {
-  static field core::int? _#a = null;
-  static field core::int? _#b = null;
+  late static field core::int a;
+  late static final [setter] field core::int b;
   static field core::int? _#c = null;
   static field core::int? _#d = null;
   synthetic constructor •() → self::Statics
     : super core::Object::•()
     ;
-  static get a() → core::int
-    return let final core::int? #t1 = self::Statics::_#a in #t1 == null ?{core::int} throw new _in::LateError::fieldNI("a") : #t1{core::int};
-  static set a(core::int #t2) → void
-    self::Statics::_#a = #t2;
-  static get b() → core::int
-    return let final core::int? #t3 = self::Statics::_#b in #t3 == null ?{core::int} throw new _in::LateError::fieldNI("b") : #t3{core::int};
-  static set b(core::int #t4) → void
-    if(self::Statics::_#b == null)
-      self::Statics::_#b = #t4;
-    else
-      throw new _in::LateError::fieldAI("b");
   static get c() → core::int
-    return let final core::int? #t5 = self::Statics::_#c in #t5 == null ?{core::int} self::Statics::_#c = 1.{core::int::unary-}(){() → core::int} : #t5{core::int};
-  static set c(core::int #t6) → void
-    self::Statics::_#c = #t6;
+    return let final core::int? #t1 = self::Statics::_#c in #t1 == null ?{core::int} self::Statics::_#c = 1.{core::int::unary-}(){() → core::int} : #t1{core::int};
+  static set c(core::int #t2) → void
+    self::Statics::_#c = #t2;
   static get d() → core::int
-    return let final core::int? #t7 = self::Statics::_#d in #t7 == null ?{core::int} let final core::int #t8 = 1.{core::int::unary-}(){() → core::int} in self::Statics::_#d == null ?{core::int} self::Statics::_#d = #t8 : throw new _in::LateError::fieldADI("d") : #t7{core::int};
+    return let final core::int? #t3 = self::Statics::_#d in #t3 == null ?{core::int} let final core::int #t4 = 1.{core::int::unary-}(){() → core::int} in self::Statics::_#d == null ?{core::int} self::Statics::_#d = #t4 : throw new _in::LateError::fieldADI("d") : #t3{core::int};
 }
 static method main() → void {
   self::testUninitializedNonFinalStaticField();
   self::testUninitializedFinalStaticField();
   self::testInitializedNonFinalStaticField();
   self::testInitializedFinalStaticField();
+  self::testUninitializedNonFinalTopLevelField();
+  self::testUninitializedFinalTopLevelField();
+  self::testInitializedNonFinalTopLevelField();
+  self::testInitializedFinalTopLevelField();
 }
 static method testUninitializedNonFinalStaticField() → void {
   core::print(self::Statics::a);
@@ -53,3 +57,37 @@
 static method testInitializedFinalStaticField() → void {
   core::print(self::Statics::d);
 }
+static method testUninitializedNonFinalTopLevelField() → void {
+  core::print(lat::a);
+  lat::a = 42;
+  core::print(lat::a);
+}
+static method testUninitializedFinalTopLevelField() → void {
+  core::print(lat::b);
+  lat::b = 42;
+  core::print(lat::b);
+}
+static method testInitializedNonFinalTopLevelField() → void {
+  core::print(lat::c);
+  lat::c = 42;
+  core::print(lat::c);
+}
+static method testInitializedFinalTopLevelField() → void {
+  core::print(lat::d);
+}
+
+library /*isNonNullableByDefault*/;
+import self as lat;
+import "dart:core" as core;
+import "dart:_internal" as _in;
+
+late static field core::int a;
+late static final [setter] field core::int b;
+static field core::int? _#c = null;
+static field core::int? _#d = null;
+static get c() → core::int
+  return let final core::int? #t5 = lat::_#c in #t5 == null ?{core::int} lat::_#c = 1.{core::int::unary-}(){() → core::int} : #t5{core::int};
+static set c(core::int #t6) → void
+  lat::_#c = #t6;
+static get d() → core::int
+  return let final core::int? #t7 = lat::_#d in #t7 == null ?{core::int} let final core::int #t8 = 1.{core::int::unary-}(){() → core::int} in lat::_#d == null ?{core::int} lat::_#d = #t8 : throw new _in::LateError::fieldADI("d") : #t7{core::int};
diff --git a/pkg/front_end/testcases/dart2js/late_statics.dart.strong.transformed.expect b/pkg/front_end/testcases/dart2js/late_statics.dart.strong.transformed.expect
index 1a4e13b..f251c18 100644
--- a/pkg/front_end/testcases/dart2js/late_statics.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/dart2js/late_statics.dart.strong.transformed.expect
@@ -2,48 +2,51 @@
 import self as self;
 import "dart:core" as core;
 import "dart:_internal" as _in;
+import "dart:_late_helper" as _la;
+import "late_statics_lib.dart" as lat;
+additionalExports = (lat::c,
+  lat::c,
+  lat::d,
+  lat::a,
+  lat::b)
+
+import "org-dartlang-testcase:///late_statics_lib.dart" as lib;
+export "org-dartlang-testcase:///late_statics_lib.dart";
 
 class Statics extends core::Object {
-  static field core::int? _#a = null;
-  static field core::int? _#b = null;
+  static final field _la::_Cell a = new _la::_Cell::•();
+  static final field _la::_Cell b = new _la::_Cell::•();
   static field core::int? _#c = null;
   static field core::int? _#d = null;
   synthetic constructor •() → self::Statics
     : super core::Object::•()
     ;
-  static get a() → core::int
-    return let final core::int? #t1 = self::Statics::_#a in #t1 == null ?{core::int} throw new _in::LateError::fieldNI("a") : #t1{core::int};
-  static set a(core::int #t2) → void
-    self::Statics::_#a = #t2;
-  static get b() → core::int
-    return let final core::int? #t3 = self::Statics::_#b in #t3 == null ?{core::int} throw new _in::LateError::fieldNI("b") : #t3{core::int};
-  static set b(core::int #t4) → void
-    if(self::Statics::_#b == null)
-      self::Statics::_#b = #t4;
-    else
-      throw new _in::LateError::fieldAI("b");
   static get c() → core::int
-    return let final core::int? #t5 = self::Statics::_#c in #t5 == null ?{core::int} self::Statics::_#c = 1.{core::int::unary-}(){() → core::int} : #t5{core::int};
-  static set c(core::int #t6) → void
-    self::Statics::_#c = #t6;
+    return let final core::int? #t1 = self::Statics::_#c in #t1 == null ?{core::int} self::Statics::_#c = 1.{core::int::unary-}(){() → core::int} : #t1{core::int};
+  static set c(core::int #t2) → void
+    self::Statics::_#c = #t2;
   static get d() → core::int
-    return let final core::int? #t7 = self::Statics::_#d in #t7 == null ?{core::int} let final core::int #t8 = 1.{core::int::unary-}(){() → core::int} in self::Statics::_#d == null ?{core::int} self::Statics::_#d = #t8 : throw new _in::LateError::fieldADI("d") : #t7{core::int};
+    return let final core::int? #t3 = self::Statics::_#d in #t3 == null ?{core::int} let final core::int #t4 = 1.{core::int::unary-}(){() → core::int} in self::Statics::_#d == null ?{core::int} self::Statics::_#d = #t4 : throw new _in::LateError::fieldADI("d") : #t3{core::int};
 }
 static method main() → void {
   self::testUninitializedNonFinalStaticField();
   self::testUninitializedFinalStaticField();
   self::testInitializedNonFinalStaticField();
   self::testInitializedFinalStaticField();
+  self::testUninitializedNonFinalTopLevelField();
+  self::testUninitializedFinalTopLevelField();
+  self::testInitializedNonFinalTopLevelField();
+  self::testInitializedFinalTopLevelField();
 }
 static method testUninitializedNonFinalStaticField() → void {
-  core::print(self::Statics::a);
-  self::Statics::a = 42;
-  core::print(self::Statics::a);
+  core::print(self::Statics::a.{_la::_Cell::readField}<core::int>(){() → core::int});
+  self::Statics::a.{_la::_Cell::value} = 42;
+  core::print(self::Statics::a.{_la::_Cell::readField}<core::int>(){() → core::int});
 }
 static method testUninitializedFinalStaticField() → void {
-  core::print(self::Statics::b);
-  self::Statics::b = 42;
-  core::print(self::Statics::b);
+  core::print(self::Statics::b.{_la::_Cell::readField}<core::int>(){() → core::int});
+  self::Statics::b.{_la::_Cell::finalFieldValue} = 42;
+  core::print(self::Statics::b.{_la::_Cell::readField}<core::int>(){() → core::int});
 }
 static method testInitializedNonFinalStaticField() → void {
   core::print(self::Statics::c);
@@ -53,10 +56,48 @@
 static method testInitializedFinalStaticField() → void {
   core::print(self::Statics::d);
 }
+static method testUninitializedNonFinalTopLevelField() → void {
+  core::print(lat::a.{_la::_Cell::readField}<core::int>(){() → core::int});
+  lat::a.{_la::_Cell::value} = 42;
+  core::print(lat::a.{_la::_Cell::readField}<core::int>(){() → core::int});
+}
+static method testUninitializedFinalTopLevelField() → void {
+  core::print(lat::b.{_la::_Cell::readField}<core::int>(){() → core::int});
+  lat::b.{_la::_Cell::finalFieldValue} = 42;
+  core::print(lat::b.{_la::_Cell::readField}<core::int>(){() → core::int});
+}
+static method testInitializedNonFinalTopLevelField() → void {
+  core::print(lat::c);
+  lat::c = 42;
+  core::print(lat::c);
+}
+static method testInitializedFinalTopLevelField() → void {
+  core::print(lat::d);
+}
+
+library /*isNonNullableByDefault*/;
+import self as lat;
+import "dart:core" as core;
+import "dart:_internal" as _in;
+import "dart:_late_helper" as _la;
+
+static final field _la::_Cell a = new _la::_Cell::•();
+static final field _la::_Cell b = new _la::_Cell::•();
+static field core::int? _#c = null;
+static field core::int? _#d = null;
+static get c() → core::int
+  return let final core::int? #t5 = lat::_#c in #t5 == null ?{core::int} lat::_#c = 1.{core::int::unary-}(){() → core::int} : #t5{core::int};
+static set c(core::int #t6) → void
+  lat::_#c = #t6;
+static get d() → core::int
+  return let final core::int? #t7 = lat::_#d in #t7 == null ?{core::int} let final core::int #t8 = 1.{core::int::unary-}(){() → core::int} in lat::_#d == null ?{core::int} lat::_#d = #t8 : throw new _in::LateError::fieldADI("d") : #t7{core::int};
 
 
 Extra constant evaluation status:
-Evaluated: InstanceInvocation @ org-dartlang-testcase:///late_statics.dart:15:23 -> DoubleConstant(-1.0)
-Evaluated: InstanceInvocation @ org-dartlang-testcase:///late_statics.dart:16:29 -> DoubleConstant(-1.0)
-Evaluated: VariableGet @ org-dartlang-testcase:///late_statics.dart:16:25 -> DoubleConstant(-1.0)
-Extra constant evaluation: evaluated: 70, effectively constant: 3
+Evaluated: InstanceInvocation @ org-dartlang-testcase:///late_statics.dart:22:23 -> DoubleConstant(-1.0)
+Evaluated: InstanceInvocation @ org-dartlang-testcase:///late_statics.dart:23:29 -> DoubleConstant(-1.0)
+Evaluated: VariableGet @ org-dartlang-testcase:///late_statics.dart:23:25 -> DoubleConstant(-1.0)
+Evaluated: InstanceInvocation @ org-dartlang-testcase:///late_statics_lib.dart:7:14 -> DoubleConstant(-1.0)
+Evaluated: InstanceInvocation @ org-dartlang-testcase:///late_statics_lib.dart:8:20 -> DoubleConstant(-1.0)
+Evaluated: VariableGet @ org-dartlang-testcase:///late_statics_lib.dart:8:16 -> DoubleConstant(-1.0)
+Extra constant evaluation: evaluated: 108, effectively constant: 6
diff --git a/pkg/front_end/testcases/dart2js/late_statics.dart.textual_outline.expect b/pkg/front_end/testcases/dart2js/late_statics.dart.textual_outline.expect
index c9f0b3d..37ed746 100644
--- a/pkg/front_end/testcases/dart2js/late_statics.dart.textual_outline.expect
+++ b/pkg/front_end/testcases/dart2js/late_statics.dart.textual_outline.expect
@@ -1,3 +1,5 @@
+import 'late_statics_lib.dart' as lib;
+export 'late_statics_lib.dart';
 void main() {}
 class Statics {
   static late int ;
@@ -13,3 +15,7 @@
 void testUninitializedFinalStaticField() {}
 void testInitializedNonFinalStaticField() {}
 void testInitializedFinalStaticField() {}
+void testUninitializedNonFinalTopLevelField() {}
+void testUninitializedFinalTopLevelField() {}
+void testInitializedNonFinalTopLevelField() {}
+void testInitializedFinalTopLevelField() {}
diff --git a/pkg/front_end/testcases/dart2js/late_statics.dart.weak.expect b/pkg/front_end/testcases/dart2js/late_statics.dart.weak.expect
index fb7425e..c53c058 100644
--- a/pkg/front_end/testcases/dart2js/late_statics.dart.weak.expect
+++ b/pkg/front_end/testcases/dart2js/late_statics.dart.weak.expect
@@ -2,38 +2,42 @@
 import self as self;
 import "dart:core" as core;
 import "dart:_internal" as _in;
+import "late_statics_lib.dart" as lat;
+additionalExports = (lat::a,
+  lat::a,
+  lat::b,
+  lat::b,
+  lat::c,
+  lat::c,
+  lat::d)
+
+import "org-dartlang-testcase:///late_statics_lib.dart" as lib;
+export "org-dartlang-testcase:///late_statics_lib.dart";
 
 class Statics extends core::Object {
-  static field core::int? _#a = _in::createSentinel<core::int>();
-  static field core::int? _#b = _in::createSentinel<core::int>();
+  late static field core::int a;
+  late static final [setter] field core::int b;
   static field core::int? _#c = _in::createSentinel<core::int>();
   static field core::int? _#d = _in::createSentinel<core::int>();
   synthetic constructor •() → self::Statics
     : super core::Object::•()
     ;
-  static get a() → core::int
-    return let final core::int? #t1 = self::Statics::_#a in _in::isSentinel(#t1) ?{core::int} throw new _in::LateError::fieldNI("a") : #t1{core::int};
-  static set a(core::int #t2) → void
-    self::Statics::_#a = #t2;
-  static get b() → core::int
-    return let final core::int? #t3 = self::Statics::_#b in _in::isSentinel(#t3) ?{core::int} throw new _in::LateError::fieldNI("b") : #t3{core::int};
-  static set b(core::int #t4) → void
-    if(_in::isSentinel(self::Statics::_#b))
-      self::Statics::_#b = #t4;
-    else
-      throw new _in::LateError::fieldAI("b");
   static get c() → core::int
-    return let final core::int? #t5 = self::Statics::_#c in _in::isSentinel(#t5) ?{core::int} self::Statics::_#c = 1.{core::int::unary-}(){() → core::int} : #t5{core::int};
-  static set c(core::int #t6) → void
-    self::Statics::_#c = #t6;
+    return let final core::int? #t1 = self::Statics::_#c in _in::isSentinel(#t1) ?{core::int} self::Statics::_#c = 1.{core::int::unary-}(){() → core::int} : #t1{core::int};
+  static set c(core::int #t2) → void
+    self::Statics::_#c = #t2;
   static get d() → core::int
-    return let final core::int #t7 = self::Statics::_#d in _in::isSentinel(#t7) ?{core::int} let final core::int #t8 = 1.{core::int::unary-}(){() → core::int} in _in::isSentinel(self::Statics::_#d) ?{core::int} self::Statics::_#d = #t8 : throw new _in::LateError::fieldADI("d") : #t7;
+    return let final core::int #t3 = self::Statics::_#d in _in::isSentinel(#t3) ?{core::int} let final core::int #t4 = 1.{core::int::unary-}(){() → core::int} in _in::isSentinel(self::Statics::_#d) ?{core::int} self::Statics::_#d = #t4 : throw new _in::LateError::fieldADI("d") : #t3;
 }
 static method main() → void {
   self::testUninitializedNonFinalStaticField();
   self::testUninitializedFinalStaticField();
   self::testInitializedNonFinalStaticField();
   self::testInitializedFinalStaticField();
+  self::testUninitializedNonFinalTopLevelField();
+  self::testUninitializedFinalTopLevelField();
+  self::testInitializedNonFinalTopLevelField();
+  self::testInitializedFinalTopLevelField();
 }
 static method testUninitializedNonFinalStaticField() → void {
   core::print(self::Statics::a);
@@ -53,3 +57,37 @@
 static method testInitializedFinalStaticField() → void {
   core::print(self::Statics::d);
 }
+static method testUninitializedNonFinalTopLevelField() → void {
+  core::print(lat::a);
+  lat::a = 42;
+  core::print(lat::a);
+}
+static method testUninitializedFinalTopLevelField() → void {
+  core::print(lat::b);
+  lat::b = 42;
+  core::print(lat::b);
+}
+static method testInitializedNonFinalTopLevelField() → void {
+  core::print(lat::c);
+  lat::c = 42;
+  core::print(lat::c);
+}
+static method testInitializedFinalTopLevelField() → void {
+  core::print(lat::d);
+}
+
+library /*isNonNullableByDefault*/;
+import self as lat;
+import "dart:core" as core;
+import "dart:_internal" as _in;
+
+late static field core::int a;
+late static final [setter] field core::int b;
+static field core::int? _#c = _in::createSentinel<core::int>();
+static field core::int? _#d = _in::createSentinel<core::int>();
+static get c() → core::int
+  return let final core::int? #t5 = lat::_#c in _in::isSentinel(#t5) ?{core::int} lat::_#c = 1.{core::int::unary-}(){() → core::int} : #t5{core::int};
+static set c(core::int #t6) → void
+  lat::_#c = #t6;
+static get d() → core::int
+  return let final core::int #t7 = lat::_#d in _in::isSentinel(#t7) ?{core::int} let final core::int #t8 = 1.{core::int::unary-}(){() → core::int} in _in::isSentinel(lat::_#d) ?{core::int} lat::_#d = #t8 : throw new _in::LateError::fieldADI("d") : #t7;
diff --git a/pkg/front_end/testcases/dart2js/late_statics.dart.weak.outline.expect b/pkg/front_end/testcases/dart2js/late_statics.dart.weak.outline.expect
index 7f9136d..21ef816 100644
--- a/pkg/front_end/testcases/dart2js/late_statics.dart.weak.outline.expect
+++ b/pkg/front_end/testcases/dart2js/late_statics.dart.weak.outline.expect
@@ -1,20 +1,27 @@
 library /*isNonNullableByDefault*/;
 import self as self;
 import "dart:core" as core;
+import "late_statics_lib.dart" as lat;
+additionalExports = (lat::a,
+  lat::a,
+  lat::b,
+  lat::b,
+  lat::c,
+  lat::c,
+  lat::d)
+
+import "org-dartlang-testcase:///late_statics_lib.dart" as lib;
+export "org-dartlang-testcase:///late_statics_lib.dart";
 
 class Statics extends core::Object {
-  static field core::int? _#a;
-  static field core::int? _#b;
+  late static field core::int a;
+  late static final [setter] field core::int b;
   static field core::int? _#c;
   static field core::int? _#d;
   synthetic constructor •() → self::Statics
     ;
-  static get a() → core::int;
-  static set a(core::int #t1) → void;
-  static get b() → core::int;
-  static set b(core::int #t2) → void;
   static get c() → core::int;
-  static set c(core::int #t3) → void;
+  static set c(core::int #t1) → void;
   static get d() → core::int;
 }
 static method main() → void
@@ -27,3 +34,23 @@
   ;
 static method testInitializedFinalStaticField() → void
   ;
+static method testUninitializedNonFinalTopLevelField() → void
+  ;
+static method testUninitializedFinalTopLevelField() → void
+  ;
+static method testInitializedNonFinalTopLevelField() → void
+  ;
+static method testInitializedFinalTopLevelField() → void
+  ;
+
+library /*isNonNullableByDefault*/;
+import self as lat;
+import "dart:core" as core;
+
+late static field core::int a;
+late static final [setter] field core::int b;
+static field core::int? _#c;
+static field core::int? _#d;
+static get c() → core::int;
+static set c(core::int #t2) → void;
+static get d() → core::int;
diff --git a/pkg/front_end/testcases/dart2js/late_statics.dart.weak.transformed.expect b/pkg/front_end/testcases/dart2js/late_statics.dart.weak.transformed.expect
index 68a4534..3806163 100644
--- a/pkg/front_end/testcases/dart2js/late_statics.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/dart2js/late_statics.dart.weak.transformed.expect
@@ -2,48 +2,51 @@
 import self as self;
 import "dart:core" as core;
 import "dart:_internal" as _in;
+import "dart:_late_helper" as _la;
+import "late_statics_lib.dart" as lat;
+additionalExports = (lat::c,
+  lat::c,
+  lat::d,
+  lat::a,
+  lat::b)
+
+import "org-dartlang-testcase:///late_statics_lib.dart" as lib;
+export "org-dartlang-testcase:///late_statics_lib.dart";
 
 class Statics extends core::Object {
-  static field core::int? _#a = _in::createSentinel<core::int>();
-  static field core::int? _#b = _in::createSentinel<core::int>();
+  static final field _la::_Cell a = new _la::_Cell::•();
+  static final field _la::_Cell b = new _la::_Cell::•();
   static field core::int? _#c = _in::createSentinel<core::int>();
   static field core::int? _#d = _in::createSentinel<core::int>();
   synthetic constructor •() → self::Statics
     : super core::Object::•()
     ;
-  static get a() → core::int
-    return let final core::int? #t1 = self::Statics::_#a in _in::isSentinel(#t1) ?{core::int} throw new _in::LateError::fieldNI("a") : #t1{core::int};
-  static set a(core::int #t2) → void
-    self::Statics::_#a = #t2;
-  static get b() → core::int
-    return let final core::int? #t3 = self::Statics::_#b in _in::isSentinel(#t3) ?{core::int} throw new _in::LateError::fieldNI("b") : #t3{core::int};
-  static set b(core::int #t4) → void
-    if(_in::isSentinel(self::Statics::_#b))
-      self::Statics::_#b = #t4;
-    else
-      throw new _in::LateError::fieldAI("b");
   static get c() → core::int
-    return let final core::int? #t5 = self::Statics::_#c in _in::isSentinel(#t5) ?{core::int} self::Statics::_#c = 1.{core::int::unary-}(){() → core::int} : #t5{core::int};
-  static set c(core::int #t6) → void
-    self::Statics::_#c = #t6;
+    return let final core::int? #t1 = self::Statics::_#c in _in::isSentinel(#t1) ?{core::int} self::Statics::_#c = 1.{core::int::unary-}(){() → core::int} : #t1{core::int};
+  static set c(core::int #t2) → void
+    self::Statics::_#c = #t2;
   static get d() → core::int
-    return let final core::int #t7 = self::Statics::_#d in _in::isSentinel(#t7) ?{core::int} let final core::int #t8 = 1.{core::int::unary-}(){() → core::int} in _in::isSentinel(self::Statics::_#d) ?{core::int} self::Statics::_#d = #t8 : throw new _in::LateError::fieldADI("d") : #t7;
+    return let final core::int #t3 = self::Statics::_#d in _in::isSentinel(#t3) ?{core::int} let final core::int #t4 = 1.{core::int::unary-}(){() → core::int} in _in::isSentinel(self::Statics::_#d) ?{core::int} self::Statics::_#d = #t4 : throw new _in::LateError::fieldADI("d") : #t3;
 }
 static method main() → void {
   self::testUninitializedNonFinalStaticField();
   self::testUninitializedFinalStaticField();
   self::testInitializedNonFinalStaticField();
   self::testInitializedFinalStaticField();
+  self::testUninitializedNonFinalTopLevelField();
+  self::testUninitializedFinalTopLevelField();
+  self::testInitializedNonFinalTopLevelField();
+  self::testInitializedFinalTopLevelField();
 }
 static method testUninitializedNonFinalStaticField() → void {
-  core::print(self::Statics::a);
-  self::Statics::a = 42;
-  core::print(self::Statics::a);
+  core::print(self::Statics::a.{_la::_Cell::readField}<core::int>(){() → core::int});
+  self::Statics::a.{_la::_Cell::value} = 42;
+  core::print(self::Statics::a.{_la::_Cell::readField}<core::int>(){() → core::int});
 }
 static method testUninitializedFinalStaticField() → void {
-  core::print(self::Statics::b);
-  self::Statics::b = 42;
-  core::print(self::Statics::b);
+  core::print(self::Statics::b.{_la::_Cell::readField}<core::int>(){() → core::int});
+  self::Statics::b.{_la::_Cell::finalFieldValue} = 42;
+  core::print(self::Statics::b.{_la::_Cell::readField}<core::int>(){() → core::int});
 }
 static method testInitializedNonFinalStaticField() → void {
   core::print(self::Statics::c);
@@ -53,10 +56,48 @@
 static method testInitializedFinalStaticField() → void {
   core::print(self::Statics::d);
 }
+static method testUninitializedNonFinalTopLevelField() → void {
+  core::print(lat::a.{_la::_Cell::readField}<core::int>(){() → core::int});
+  lat::a.{_la::_Cell::value} = 42;
+  core::print(lat::a.{_la::_Cell::readField}<core::int>(){() → core::int});
+}
+static method testUninitializedFinalTopLevelField() → void {
+  core::print(lat::b.{_la::_Cell::readField}<core::int>(){() → core::int});
+  lat::b.{_la::_Cell::finalFieldValue} = 42;
+  core::print(lat::b.{_la::_Cell::readField}<core::int>(){() → core::int});
+}
+static method testInitializedNonFinalTopLevelField() → void {
+  core::print(lat::c);
+  lat::c = 42;
+  core::print(lat::c);
+}
+static method testInitializedFinalTopLevelField() → void {
+  core::print(lat::d);
+}
+
+library /*isNonNullableByDefault*/;
+import self as lat;
+import "dart:core" as core;
+import "dart:_internal" as _in;
+import "dart:_late_helper" as _la;
+
+static final field _la::_Cell a = new _la::_Cell::•();
+static final field _la::_Cell b = new _la::_Cell::•();
+static field core::int? _#c = _in::createSentinel<core::int>();
+static field core::int? _#d = _in::createSentinel<core::int>();
+static get c() → core::int
+  return let final core::int? #t5 = lat::_#c in _in::isSentinel(#t5) ?{core::int} lat::_#c = 1.{core::int::unary-}(){() → core::int} : #t5{core::int};
+static set c(core::int #t6) → void
+  lat::_#c = #t6;
+static get d() → core::int
+  return let final core::int #t7 = lat::_#d in _in::isSentinel(#t7) ?{core::int} let final core::int #t8 = 1.{core::int::unary-}(){() → core::int} in _in::isSentinel(lat::_#d) ?{core::int} lat::_#d = #t8 : throw new _in::LateError::fieldADI("d") : #t7;
 
 
 Extra constant evaluation status:
-Evaluated: InstanceInvocation @ org-dartlang-testcase:///late_statics.dart:15:23 -> DoubleConstant(-1.0)
-Evaluated: InstanceInvocation @ org-dartlang-testcase:///late_statics.dart:16:29 -> DoubleConstant(-1.0)
-Evaluated: VariableGet @ org-dartlang-testcase:///late_statics.dart:16:25 -> DoubleConstant(-1.0)
-Extra constant evaluation: evaluated: 74, effectively constant: 3
+Evaluated: InstanceInvocation @ org-dartlang-testcase:///late_statics.dart:22:23 -> DoubleConstant(-1.0)
+Evaluated: InstanceInvocation @ org-dartlang-testcase:///late_statics.dart:23:29 -> DoubleConstant(-1.0)
+Evaluated: VariableGet @ org-dartlang-testcase:///late_statics.dart:23:25 -> DoubleConstant(-1.0)
+Evaluated: InstanceInvocation @ org-dartlang-testcase:///late_statics_lib.dart:7:14 -> DoubleConstant(-1.0)
+Evaluated: InstanceInvocation @ org-dartlang-testcase:///late_statics_lib.dart:8:20 -> DoubleConstant(-1.0)
+Evaluated: VariableGet @ org-dartlang-testcase:///late_statics_lib.dart:8:16 -> DoubleConstant(-1.0)
+Extra constant evaluation: evaluated: 112, effectively constant: 6
diff --git a/pkg/front_end/testcases/dart2js/late_statics_lib.dart b/pkg/front_end/testcases/dart2js/late_statics_lib.dart
new file mode 100644
index 0000000..853ea39
--- /dev/null
+++ b/pkg/front_end/testcases/dart2js/late_statics_lib.dart
@@ -0,0 +1,8 @@
+// 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.
+
+late int a;
+late final int b;
+late int c = -1;
+late final int d = -1;
diff --git a/tools/VERSION b/tools/VERSION
index c7caf78..0f39adc 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
 MAJOR 2
 MINOR 13
 PATCH 0
-PRERELEASE 232
+PRERELEASE 233
 PRERELEASE_PATCH 0
\ No newline at end of file