Version 2.12.0-258.0.dev

Merge commit '91b0f166637e750966b52bc942487c4dafd32ccf' into 'dev'
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 8446ae0..9841ec8 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
@@ -22,7 +22,8 @@
   /// Return the transform sets associated with the [library].
   List<TransformSet> forLibrary(LibraryElement library) {
     var transformSets = <TransformSet>[];
-    var workspace = library.session.analysisContext.workspace;
+    var analysisContext = library.session.analysisContext;
+    var workspace = analysisContext.workspace;
     var libraryPath = library.source.fullName;
     var package = workspace.findPackageFor(libraryPath);
     if (package == null) {
@@ -37,14 +38,12 @@
         transformSets.add(transformSet);
       }
     }
-    var sdkRoot = library.session.analysisContext.sdkRoot;
+    var sdkRoot = analysisContext.sdkRoot;
     if (sdkRoot != null) {
       var file = sdkRoot.getChildAssumingFile('lib/_internal/$dataFileName');
-      if (file.exists) {
-        var transformSet = _loadTransformSet(file);
-        if (transformSet != null) {
-          transformSets.add(transformSet);
-        }
+      var transformSet = _loadTransformSet(file);
+      if (transformSet != null) {
+        transformSets.add(transformSet);
       }
     }
     return transformSets;
diff --git a/pkg/analysis_server/lib/src/status/diagnostics.dart b/pkg/analysis_server/lib/src/status/diagnostics.dart
index 8f04747..c64abed 100644
--- a/pkg/analysis_server/lib/src/status/diagnostics.dart
+++ b/pkg/analysis_server/lib/src/status/diagnostics.dart
@@ -482,6 +482,8 @@
     buf.writeln(writeOption('Context location', escape(contextPath)));
     buf.writeln(writeOption('Analysis options path',
         escape(driver.contextRoot.optionsFilePath ?? 'none')));
+    buf.writeln(
+        writeOption('SDK root', escape(driver.analysisContext.sdkRoot.path)));
 
     buf.writeln('<div class="columns">');
 
diff --git a/pkg/dev_compiler/lib/js/legacy/dart_library.js b/pkg/dev_compiler/lib/js/legacy/dart_library.js
index 9be3935..ac7b2b2 100644
--- a/pkg/dev_compiler/lib/js/legacy/dart_library.js
+++ b/pkg/dev_compiler/lib/js/legacy/dart_library.js
@@ -7,314 +7,316 @@
 if (!dart_library) {
   dart_library = typeof module != "undefined" && module.exports || {};
 
-(function (dart_library) {
-  'use strict';
+  (function (dart_library) {
+    'use strict';
 
-  // Throws an error related to module loading.
-  //
-  // This does not throw a Dart error because the Dart SDK may not have loaded
-  // yet, and module loading errors cannot be caught by Dart code.
-  function throwLibraryError(message) {
-    // Dispatch event to allow others to react to the load error without
-    // capturing the exception.
-    if (!!self.dispatchEvent) {
-      self.dispatchEvent(
-        new CustomEvent('dartLoadException', { detail: message }));
-    }
-    throw Error(message);
-  }
-
-  const libraryImports = Symbol('libraryImports');
-  dart_library.libraryImports = libraryImports;
-
-  // Module support.  This is a simplified module system for Dart.
-  // Longer term, we can easily migrate to an existing JS module system:
-  // ES6, AMD, RequireJS, ....
-
-  // Returns a proxy that delegates to the underlying loader.
-  // This defers loading of a module until a library is actually used.
-  const loadedModule = Symbol('loadedModule');
-  dart_library.defer = function (module, name, patch) {
-    let done = false;
-    function loadDeferred() {
-      done = true;
-      let mod = module[loadedModule];
-      let lib = mod[name];
-      // Install unproxied module and library in caller's context.
-      patch(mod, lib);
-    }
-    // The deferred library object.  Note, the only legal operations on a Dart
-    // library object should be get (to read a top-level variable, method, or
-    // Class) or set (to write a top-level variable).
-    return new Proxy({}, {
-      get: function (o, p) {
-        if (!done) loadDeferred();
-        return module[name][p];
-      },
-      set: function (o, p, value) {
-        if (!done) loadDeferred();
-        module[name][p] = value;
-        return true;
-      },
-    });
-  };
-
-  let _reverseImports = new Map();
-  class LibraryLoader {
-
-    constructor(name, defaultValue, imports, loader) {
-      imports.forEach(function (i) {
-        let deps = _reverseImports.get(i);
-        if (!deps) {
-          deps = new Set();
-          _reverseImports.set(i, deps);
-        }
-        deps.add(name);
-      });
-      this._name = name;
-      this._library = defaultValue ? defaultValue : {};
-      this._imports = imports;
-      this._loader = loader;
-
-      // Cyclic import detection
-      this._state = LibraryLoader.NOT_LOADED;
-    }
-
-    loadImports() {
-      let results = [];
-      for (let name of this._imports) {
-        results.push(import_(name));
+    // Throws an error related to module loading.
+    //
+    // This does not throw a Dart error because the Dart SDK may not have loaded
+    // yet, and module loading errors cannot be caught by Dart code.
+    function throwLibraryError(message) {
+      // Dispatch event to allow others to react to the load error without
+      // capturing the exception.
+      if (!!self.dispatchEvent) {
+        self.dispatchEvent(
+          new CustomEvent('dartLoadException', {detail: message}));
       }
-      return results;
+      throw Error(message);
     }
 
-    load() {
-      // Check for cycles
-      if (this._state == LibraryLoader.LOADING) {
-        throwLibraryError('Circular dependence on library: ' + this._name);
-      } else if (this._state >= LibraryLoader.READY) {
+    const libraryImports = Symbol('libraryImports');
+    dart_library.libraryImports = libraryImports;
+
+    // Module support.  This is a simplified module system for Dart.
+    // Longer term, we can easily migrate to an existing JS module system:
+    // ES6, AMD, RequireJS, ....
+
+    // Returns a proxy that delegates to the underlying loader.
+    // This defers loading of a module until a library is actually used.
+    const loadedModule = Symbol('loadedModule');
+    dart_library.defer = function (module, name, patch) {
+      let done = false;
+      function loadDeferred() {
+        done = true;
+        let mod = module[loadedModule];
+        let lib = mod[name];
+        // Install unproxied module and library in caller's context.
+        patch(mod, lib);
+      }
+      // The deferred library object.  Note, the only legal operations on a Dart
+      // library object should be get (to read a top-level variable, method, or
+      // Class) or set (to write a top-level variable).
+      return new Proxy({}, {
+        get: function (o, p) {
+          if (!done) loadDeferred();
+          return module[name][p];
+        },
+        set: function (o, p, value) {
+          if (!done) loadDeferred();
+          module[name][p] = value;
+          return true;
+        },
+      });
+    };
+
+    let _reverseImports = new Map();
+    class LibraryLoader {
+
+      constructor(name, defaultValue, imports, loader) {
+        imports.forEach(function (i) {
+          let deps = _reverseImports.get(i);
+          if (!deps) {
+            deps = new Set();
+            _reverseImports.set(i, deps);
+          }
+          deps.add(name);
+        });
+        this._name = name;
+        this._library = defaultValue ? defaultValue : {};
+        this._imports = imports;
+        this._loader = loader;
+
+        // Cyclic import detection
+        this._state = LibraryLoader.NOT_LOADED;
+      }
+
+      loadImports() {
+        let results = [];
+        for (let name of this._imports) {
+          results.push(import_(name));
+        }
+        return results;
+      }
+
+      load() {
+        // Check for cycles
+        if (this._state == LibraryLoader.LOADING) {
+          throwLibraryError('Circular dependence on library: ' + this._name);
+        } else if (this._state >= LibraryLoader.READY) {
+          return this._library;
+        }
+        this._state = LibraryLoader.LOADING;
+
+        // Handle imports
+        let args = this.loadImports();
+
+        // Load the library
+        let loader = this;
+        let library = this._library;
+
+        library[libraryImports] = this._imports;
+        library[loadedModule] = library;
+        args.unshift(library);
+
+        if (this._name == 'dart_sdk') {
+          // Eagerly load the SDK.
+          this._loader.apply(null, args);
+        } else {
+          // Load / parse other modules on demand.
+          let done = false;
+          this._library = new Proxy(library, {
+            get: function (o, name) {
+              if (!done) {
+                done = true;
+                loader._loader.apply(null, args);
+              }
+              return o[name];
+            }
+          });
+        }
+
+        this._state = LibraryLoader.READY;
         return this._library;
       }
-      this._state = LibraryLoader.LOADING;
 
-      // Handle imports
-      let args = this.loadImports();
+      stub() {
+        return this._library;
+      }
+    }
+    LibraryLoader.NOT_LOADED = 0;
+    LibraryLoader.LOADING = 1;
+    LibraryLoader.READY = 2;
 
-      // Load the library
-      let loader = this;
-      let library = this._library;
+    // Map from name to LibraryLoader
+    let _libraries = new Map();
+    dart_library.libraries = function () {
+      return _libraries.keys();
+    };
+    dart_library.debuggerLibraries = function () {
+      let debuggerLibraries = [];
+      _libraries.forEach(function (value, key, map) {
+        debuggerLibraries.push(value.load());
+      });
+      debuggerLibraries.__proto__ = null;
+      return debuggerLibraries;
+    };
 
-      library[libraryImports] = this._imports;
-      library[loadedModule] = library;
-      args.unshift(library);
+    // Invalidate a library and all things that depend on it
+    function _invalidateLibrary(name) {
+      let lib = _libraries.get(name);
+      if (lib._state == LibraryLoader.NOT_LOADED) return;
+      lib._state = LibraryLoader.NOT_LOADED;
+      lib._library = {};
+      let deps = _reverseImports.get(name);
+      if (!deps) return;
+      deps.forEach(_invalidateLibrary);
+    }
 
-      if (this._name == 'dart_sdk') {
-        // Eagerly load the SDK.
-        this._loader.apply(null, args);
-      } else {
-        // Load / parse other modules on demand.
-        let done = false;
-        this._library = new Proxy(library, {
-          get: function (o, name) {
-            if (!done) {
-              done = true;
-              loader._loader.apply(null, args);
-            }
-            return o[name];
+    function library(name, defaultValue, imports, loader) {
+      let result = _libraries.get(name);
+      if (result) {
+        console.log('Re-loading ' + name);
+        _invalidateLibrary(name);
+      }
+      result = new LibraryLoader(name, defaultValue, imports, loader);
+      _libraries.set(name, result);
+      return result;
+    }
+    dart_library.library = library;
+
+    // Maintain a stack of active imports.  If a requested library/module is not
+    // available, print the stack to show where/how it was requested.
+    let _stack = [];
+    function import_(name) {
+      let lib = _libraries.get(name);
+      if (!lib) {
+        let message = 'Module ' + name + ' not loaded in the browser.';
+        if (_stack != []) {
+          message += '\nDependency via:';
+          let indent = '';
+          for (let last = _stack.length - 1; last >= 0; last--) {
+            indent += ' ';
+            message += '\n' + indent + '- ' + _stack[last];
           }
+        }
+        throwLibraryError(message);
+      }
+      _stack.push(name);
+      let result = lib.load();
+      _stack.pop();
+      return result;
+    }
+    dart_library.import = import_;
+
+    let _debuggerInitialized = false;
+
+    // Called to initiate a hot restart of the application.
+    //
+    // "Hot restart" means all application state is cleared, the newly compiled
+    // modules are loaded, and `main()` is called.
+    //
+    // Note: `onReloadEnd()` can be provided, and if so will be used instead of
+    // `main()` for hot restart.
+    //
+    // This happens in the following sequence:
+    //
+    // 1. Look for `onReloadStart()` in the same library that has `main()`, and
+    //    call it if present. This function is implemented by the application to
+    //    ensure any global browser/DOM state is cleared, so the application can
+    //    restart.
+    // 2. Wait for `onReloadStart()` to complete (either synchronously, or async
+    //    if it returned a `Future`).
+    // 3. Call dart:_runtime's `hotRestart()` function to clear any state that
+    //    `dartdevc` is tracking, such as initialized static fields and type
+    //    caches.
+    // 4. Call `window.$dartWarmReload()` (provided by the HTML page) to reload
+    //    the relevant JS modules, passing a callback that will invoke `main()`.
+    // 5. `$dartWarmReload` calls the callback to rerun main.
+    //
+    function reload(clearState) {
+      // TODO(jmesserly): once we've rolled out `clearState` make it the default,
+      // and eventually remove the parameter.
+      if (clearState == null) clearState = true;
+
+
+      // TODO(jmesserly): we may want to change these APIs to use the
+      // "hot restart" terminology for consistency with Flutter. In Flutter,
+      // "hot reload" refers to keeping the application state and attempting to
+      // patch the code for the application while it is executing
+      // (https://flutter.io/hot-reload/), whereas "hot restart" refers to what
+      // dartdevc supports: tear down the app, update the code, and rerun the app.
+      if (!self || !self.$dartWarmReload) {
+        console.warn('Hot restart not supported in this environment.');
+        return;
+      }
+
+      // Call the application's `onReloadStart()` function, if provided.
+      let result;
+      if (_lastLibrary && _lastLibrary.onReloadStart) {
+        result = _lastLibrary.onReloadStart();
+      }
+
+      let sdk = _libraries.get("dart_sdk");
+
+      /// Once the `onReloadStart()` completes, this finishes the restart.
+      function finishHotRestart() {
+        self.console.clear();
+        if (clearState) {
+          // This resets all initialized fields and clears type caches and other
+          // temporary data structures used by the compiler/SDK.
+          sdk.dart.hotRestart();
+        }
+        // Call the module loader to reload the necessary modules.
+        self.$dartWarmReload(() => {
+          // Once the modules are loaded, rerun `main()`.
+          start(_lastModuleName, _lastLibraryName, true);
         });
       }
 
-      this._state = LibraryLoader.READY;
-      return this._library;
-    }
-
-    stub() {
-      return this._library;
-    }
-  }
-  LibraryLoader.NOT_LOADED = 0;
-  LibraryLoader.LOADING = 1;
-  LibraryLoader.READY = 2;
-
-  // Map from name to LibraryLoader
-  let _libraries = new Map();
-  dart_library.libraries = function () { return _libraries.keys(); };
-  dart_library.debuggerLibraries = function () {
-    let debuggerLibraries = [];
-    _libraries.forEach(function (value, key, map) {
-      debuggerLibraries.push(value.load());
-    });
-    debuggerLibraries.__proto__ = null;
-    return debuggerLibraries;
-  };
-
-  // Invalidate a library and all things that depend on it
-  function _invalidateLibrary(name) {
-    let lib = _libraries.get(name);
-    if (lib._state == LibraryLoader.NOT_LOADED) return;
-    lib._state = LibraryLoader.NOT_LOADED;
-    lib._library = {};
-    let deps = _reverseImports.get(name);
-    if (!deps) return;
-    deps.forEach(_invalidateLibrary);
-  }
-
-  function library(name, defaultValue, imports, loader) {
-    let result = _libraries.get(name);
-    if (result) {
-      console.log('Re-loading ' + name);
-      _invalidateLibrary(name);
-    }
-    result = new LibraryLoader(name, defaultValue, imports, loader);
-    _libraries.set(name, result);
-    return result;
-  }
-  dart_library.library = library;
-
-  // Maintain a stack of active imports.  If a requested library/module is not
-  // available, print the stack to show where/how it was requested.
-  let _stack = [];
-  function import_(name) {
-    let lib = _libraries.get(name);
-    if (!lib) {
-      let message = 'Module ' + name + ' not loaded in the browser.';
-      if (_stack != []) {
-        message += '\nDependency via:';
-        let indent = '';
-        for (let last = _stack.length - 1; last >= 0; last--) {
-          indent += ' ';
-          message += '\n' + indent + '- ' + _stack[last];
-        }
-      }
-      throwLibraryError(message);
-    }
-    _stack.push(name);
-    let result = lib.load();
-    _stack.pop();
-    return result;
-  }
-  dart_library.import = import_;
-
-  let _debuggerInitialized = false;
-
-  // Called to initiate a hot restart of the application.
-  //
-  // "Hot restart" means all application state is cleared, the newly compiled
-  // modules are loaded, and `main()` is called.
-  //
-  // Note: `onReloadEnd()` can be provided, and if so will be used instead of
-  // `main()` for hot restart.
-  //
-  // This happens in the following sequence:
-  //
-  // 1. Look for `onReloadStart()` in the same library that has `main()`, and
-  //    call it if present. This function is implemented by the application to
-  //    ensure any global browser/DOM state is cleared, so the application can
-  //    restart.
-  // 2. Wait for `onReloadStart()` to complete (either synchronously, or async
-  //    if it returned a `Future`).
-  // 3. Call dart:_runtime's `hotRestart()` function to clear any state that
-  //    `dartdevc` is tracking, such as initialized static fields and type
-  //    caches.
-  // 4. Call `window.$dartWarmReload()` (provided by the HTML page) to reload
-  //    the relevant JS modules, passing a callback that will invoke `main()`.
-  // 5. `$dartWarmReload` calls the callback to rerun main.
-  //
-  function reload(clearState) {
-    // TODO(jmesserly): once we've rolled out `clearState` make it the default,
-    // and eventually remove the parameter.
-    if (clearState == null) clearState = true;
-
-
-    // TODO(jmesserly): we may want to change these APIs to use the
-    // "hot restart" terminology for consistency with Flutter. In Flutter,
-    // "hot reload" refers to keeping the application state and attempting to
-    // patch the code for the application while it is executing
-    // (https://flutter.io/hot-reload/), whereas "hot restart" refers to what
-    // dartdevc supports: tear down the app, update the code, and rerun the app.
-    if (!self || !self.$dartWarmReload) {
-      console.warn('Hot restart not supported in this environment.');
-      return;
-    }
-
-    // Call the application's `onReloadStart()` function, if provided.
-    let result;
-    if (_lastLibrary && _lastLibrary.onReloadStart) {
-      result = _lastLibrary.onReloadStart();
-    }
-
-    let sdk = _libraries.get("dart_sdk");
-
-    /// Once the `onReloadStart()` completes, this finishes the restart.
-    function finishHotRestart() {
-      self.console.clear();
-      if (clearState) {
-        // This resets all initialized fields and clears type caches and other
-        // temporary data structures used by the compiler/SDK.
-        sdk.dart.hotRestart();
-      }
-      // Call the module loader to reload the necessary modules.
-      self.$dartWarmReload(() => {
-        // Once the modules are loaded, rerun `main()`.
-        start(_lastModuleName, _lastLibraryName, true);
-      });
-    }
-
-    if (result && result.then) {
-      result.then(sdk._library.dart.Dynamic)(finishHotRestart);
-    } else {
-      finishHotRestart();
-    }
-  }
-  dart_library.reload = reload;
-
-
-  let _lastModuleName;
-  let _lastLibraryName;
-  let _lastLibrary;
-  let _originalBody;
-
-  function start(moduleName, libraryName, isReload) {
-    if (libraryName == null) libraryName = moduleName;
-    _lastModuleName = moduleName;
-    _lastLibraryName = libraryName;
-    let library = import_(moduleName)[libraryName];
-    _lastLibrary = library;
-    let dart_sdk = import_('dart_sdk');
-
-    if (!_debuggerInitialized) {
-      // This import is only needed for chrome debugging. We should provide an
-      // option to compile without it.
-      dart_sdk._debugger.registerDevtoolsFormatter();
-
-      // Create isolate.
-      _debuggerInitialized = true;
-    }
-    if (isReload) {
-      if (library.onReloadEnd) {
-        library.onReloadEnd();
-        return;
+      if (result && result.then) {
+        result.then(sdk._library.dart.Dynamic)(finishHotRestart);
       } else {
-        if (!!self.document) {
-          // Note: we expect _originalBody to be undefined in non-browser
-          // environments, but in that case so is the body.
-          if (!_originalBody && !!self.document.body) {
-            self.console.warn('No body saved to update on reload');
-          } else {
-            self.document.body = _originalBody;
+        finishHotRestart();
+      }
+    }
+    dart_library.reload = reload;
+
+
+    let _lastModuleName;
+    let _lastLibraryName;
+    let _lastLibrary;
+    let _originalBody;
+
+    function start(moduleName, libraryName, isReload) {
+      if (libraryName == null) libraryName = moduleName;
+      _lastModuleName = moduleName;
+      _lastLibraryName = libraryName;
+      let library = import_(moduleName)[libraryName];
+      _lastLibrary = library;
+      let dart_sdk = import_('dart_sdk');
+
+      if (!_debuggerInitialized) {
+        // This import is only needed for chrome debugging. We should provide an
+        // option to compile without it.
+        dart_sdk._debugger.registerDevtoolsFormatter();
+
+        // Create isolate.
+        _debuggerInitialized = true;
+      }
+      if (isReload) {
+        if (library.onReloadEnd) {
+          library.onReloadEnd();
+          return;
+        } else {
+          if (!!self.document) {
+            // Note: we expect _originalBody to be undefined in non-browser
+            // environments, but in that case so is the body.
+            if (!_originalBody && !!self.document.body) {
+              self.console.warn('No body saved to update on reload');
+            } else {
+              self.document.body = _originalBody;
+            }
           }
         }
+      } else {
+        // If not a reload then store the initial html to reset it on reload.
+        if (!!self.document && !!self.document.body) {
+          _originalBody = self.document.body.cloneNode(true);
+        }
       }
-    } else {
-      // If not a reload then store the initial html to reset it on reload.
-      if (!!self.document && !!self.document.body) {
-        _originalBody = self.document.body.cloneNode(true);
-      }
+      library.main([]);
     }
-    library.main([]);
-  }
-  dart_library.start = start;
+    dart_library.start = start;
 
-})(dart_library);
+  })(dart_library);
 }
diff --git a/samples/sample_extension/sample_asynchronous_extension.dart b/samples/sample_extension/sample_asynchronous_extension.dart
index 541652d..7d18902 100644
--- a/samples/sample_extension/sample_asynchronous_extension.dart
+++ b/samples/sample_extension/sample_asynchronous_extension.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
-
 library sample_asynchronous_extension;
 
 import 'dart:async';
@@ -12,15 +10,12 @@
 
 // A class caches the native port used to call an asynchronous extension.
 class RandomArray {
-  static SendPort _port;
+  static SendPort? _port;
 
   Future<List<int>> randomArray(int seed, int length) {
     var completer = new Completer<List<int>>();
     var replyPort = new RawReceivePort();
-    var args = new List(3);
-    args[0] = seed;
-    args[1] = length;
-    args[2] = replyPort.sendPort;
+    var args = [seed, length, replyPort.sendPort];
     _servicePort.send(args);
     replyPort.handler = (result) {
       replyPort.close();
@@ -37,7 +32,7 @@
     if (_port == null) {
       _port = _newServicePort();
     }
-    return _port;
+    return _port!;
   }
 
   SendPort _newServicePort() native "RandomArray_ServicePort";
diff --git a/samples/sample_extension/sample_synchronous_extension.dart b/samples/sample_extension/sample_synchronous_extension.dart
index e5ad660..727cd4c 100644
--- a/samples/sample_extension/sample_synchronous_extension.dart
+++ b/samples/sample_extension/sample_synchronous_extension.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
-
 library sample_synchronous_extension;
 
 import 'dart-ext:sample_extension';
diff --git a/samples/sample_extension/test/sample_extension_app_snapshot_test.dart b/samples/sample_extension/test/sample_extension_app_snapshot_test.dart
index b2eb204..558b108 100644
--- a/samples/sample_extension/test/sample_extension_app_snapshot_test.dart
+++ b/samples/sample_extension/test/sample_extension_app_snapshot_test.dart
@@ -4,8 +4,6 @@
 //
 // Dart test program for testing native extensions.
 
-// @dart = 2.9
-
 // OtherResources=../sample_synchronous_extension.dart
 // OtherResources=../sample_asynchronous_extension.dart
 // OtherResources=../test_sample_synchronous_extension.dart
diff --git a/samples/sample_extension/test/sample_extension_test.dart b/samples/sample_extension/test/sample_extension_test.dart
index 393463b..4311ff5 100644
--- a/samples/sample_extension/test/sample_extension_test.dart
+++ b/samples/sample_extension/test/sample_extension_test.dart
@@ -4,8 +4,6 @@
 //
 // Dart test program for testing native extensions.
 
-// @dart = 2.9
-
 import 'sample_extension_test_helper.dart';
 
 void main() {
diff --git a/samples/sample_extension/test/sample_extension_test_helper.dart b/samples/sample_extension/test/sample_extension_test_helper.dart
index 9c701bf..d4cae3d 100644
--- a/samples/sample_extension/test/sample_extension_test_helper.dart
+++ b/samples/sample_extension/test/sample_extension_test_helper.dart
@@ -4,8 +4,6 @@
 //
 // Dart test program for testing native extensions.
 
-// @dart = 2.9
-
 import 'dart:async';
 import 'dart:io';
 import 'dart:isolate';
@@ -26,7 +24,7 @@
       result = await Process.run('cmd.exe', ['/C', 'copy $src $dst']);
       break;
     default:
-      Expect.fail('Unknown operating system ${Platform.operatingSystem}');
+      throw 'Unknown operating system ${Platform.operatingSystem}';
   }
   if (result.exitCode != 0) {
     print(result.stdout);
@@ -46,7 +44,7 @@
   }
 }
 
-Future testNativeExtensions(String snapshotKind) async {
+Future testNativeExtensions(String? snapshotKind) async {
   String buildDirectory = dirname(Platform.executable);
   Directory tempDirectory =
       Directory.systemTemp.createTempSync('sample_extension_');
diff --git a/samples/sample_extension/test_sample_asynchronous_extension.dart b/samples/sample_extension/test_sample_asynchronous_extension.dart
index 5ceb7c8..b1fd419 100644
--- a/samples/sample_extension/test_sample_asynchronous_extension.dart
+++ b/samples/sample_extension/test_sample_asynchronous_extension.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
-
 library test_sample_extension;
 
 import 'sample_asynchronous_extension.dart';
@@ -32,16 +30,16 @@
 void checkNormal(List l) {
   // Count how many times each byte value occurs.  Assert that the counts
   // are all within a reasonable (six-sigma) range.
-  List counts = new List<int>.filled(256, 0);
+  List<int> counts = new List<int>.filled(256, 0);
   for (var e in l) {
     counts[e]++;
   }
   new RandomArray().randomArray(18, 256000).then(checkCorrelation(counts));
 }
 
-Function checkCorrelation(List counts) {
-  return (List l) {
-    List counts_2 = new List<int>.filled(256, 0);
+dynamic Function(List<int>) checkCorrelation(List<int> counts) {
+  return (List<int> l) {
+    List<int> counts_2 = new List<int>.filled(256, 0);
     for (var e in l) {
       counts_2[e]++;
     }
diff --git a/samples/sample_extension/test_sample_synchronous_extension.dart b/samples/sample_extension/test_sample_synchronous_extension.dart
index 77d2fc3..ac17724 100644
--- a/samples/sample_extension/test_sample_synchronous_extension.dart
+++ b/samples/sample_extension/test_sample_synchronous_extension.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
-
 library test_sample_extension;
 
 import 'sample_synchronous_extension.dart';
diff --git a/tools/VERSION b/tools/VERSION
index 382c739..881e000 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
 MAJOR 2
 MINOR 12
 PATCH 0
-PRERELEASE 257
+PRERELEASE 258
 PRERELEASE_PATCH 0
\ No newline at end of file