Version 2.17.0-67.0.dev

Merge commit '985d476218d29d4abccddece7d8fe141211c42ed' into 'dev'
diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json
index fa43a6c..e47664f 100644
--- a/.dart_tool/package_config.json
+++ b/.dart_tool/package_config.json
@@ -244,7 +244,7 @@
       "name": "dartdev",
       "rootUri": "../pkg/dartdev",
       "packageUri": "lib/",
-      "languageVersion": "2.6"
+      "languageVersion": "2.12"
     },
     {
       "name": "dartdoc",
diff --git a/CHANGELOG.md b/CHANGELOG.md
index aa16e28..f525e29 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,6 +17,13 @@
 - `IdbFactory.supportsDatabaseNames` has been deprecated. It will always return
   `false`.
 
+#### `dart:io`
+
+- **Breaking Change** [#45410](https://github.com/dart-lang/sdk/issues/45410):
+  `HttpClient` no longer transmits some headers (i.e. `authorization`,
+  `www-authenticate`, `cookie`, `cookie2`) when processing redirects to
+  a different domain.
+
 ### Tools
 
 #### Dart command line
@@ -26,9 +33,20 @@
   marked deprecated as previously announced.
   Its replacement is the `dart compile js` command.
   Should you find any issues, or missing features, in the replacement
-  command, kindly file [an issue][].
+  command, kindly file [an issue](https://github.com/dart-lang/sdk/issues/new).
 
-[an issue]: https://github.com/dart-lang/sdk/issues/new
+- **Breaking Change** [#46100](https://github.com/dart-lang/sdk/issues/46100):
+  The standalone `dartdevc` tool has been marked deprecated as previously
+  announced and will be deleted in a future Dart stable relase.  This tool
+  was intended for use only by build systems like bazel, `build_web_compilers`
+  and `flutter_tools`. The functionality remains available for those systems,
+  but it is no longer exposed as a command-line tool in the SDK.
+  Please share any concerns in the 
+  [breaking change tracking issue](https://github.com/dart-lang/sdk/issues/46100).
+
+- **Breaking Change** [#46100](https://github.com/dart-lang/sdk/issues/46100):
+  The standalone `dartdoc` tool has been removed as
+  previously announced. Its replacement is the `dart doc` command.
 
 ## 2.16.0
 
@@ -79,6 +97,17 @@
 
 [an issue]: https://github.com/dart-lang/sdk/issues/new
 
+#### Pub
+
+- Fixed race conditions in `dart pub get`, `dart run` and `dart pub global run`.
+  It should now be safe to run these concurrently.
+- If (when) Pub crashes it will save a verbose log in
+  `$PUB_CACHE/log/pub_log.txt` This can be used for filing issues to the issue
+  tracker.
+
+  `dart --verbose pub [command]` will also cause the log file to be written.
+- `dart pub add` can now add multiple packages in one command.
+
 #### Linter
 
 Updated the Linter to `1.18.0`, which includes changes that
diff --git a/DEPS b/DEPS
index 1fbea5c..56ed123 100644
--- a/DEPS
+++ b/DEPS
@@ -141,7 +141,7 @@
   "pool_rev": "7abe634002a1ba8a0928eded086062f1307ccfae",
   "process_rev": "56ece43b53b64c63ae51ec184b76bd5360c28d0b",
   "protobuf_rev": "c1eb6cb51af39ccbaa1a8e19349546586a5c8e31",
-  "pub_rev": "dcb6abac2d7d43258c03b348be42bf4aab9529b1",
+  "pub_rev": "8f5ab7b1aba3b9f66b56246d77e167990339d317",
   "pub_semver_rev": "a43ad72fb6b7869607581b5fedcb186d1e74276a",
   "root_certificates_rev": "692f6d6488af68e0121317a9c2c9eb393eb0ee50",
   "rust_revision": "b7856f695d65a8ebc846754f97d15814bcb1c244",
diff --git a/benchmarks/FfiMemory/dart/FfiMemory.dart b/benchmarks/FfiMemory/dart/FfiMemory.dart
index 881eff2..6178f24 100644
--- a/benchmarks/FfiMemory/dart/FfiMemory.dart
+++ b/benchmarks/FfiMemory/dart/FfiMemory.dart
@@ -15,36 +15,6 @@
 import 'package:ffi/ffi.dart';
 import 'package:benchmark_harness/benchmark_harness.dart';
 
-/// Represents a native unsigned pointer-sized integer in C.
-///
-/// [UintPtr] is not constructible in the Dart code and serves purely as marker in
-/// type signatures.
-@AbiSpecificIntegerMapping({
-  Abi.androidArm: Uint32(),
-  Abi.androidArm64: Uint64(),
-  Abi.androidIA32: Uint32(),
-  Abi.androidX64: Uint64(),
-  Abi.fuchsiaArm64: Uint64(),
-  Abi.fuchsiaX64: Uint64(),
-  Abi.iosArm: Uint32(),
-  Abi.iosArm64: Uint64(),
-  Abi.iosX64: Uint64(),
-  Abi.linuxArm: Uint32(),
-  Abi.linuxArm64: Uint64(),
-  Abi.linuxIA32: Uint32(),
-  Abi.linuxX64: Uint64(),
-  Abi.linuxRiscv32: Uint32(),
-  Abi.linuxRiscv64: Uint64(),
-  Abi.macosArm64: Uint64(),
-  Abi.macosX64: Uint64(),
-  Abi.windowsArm64: Uint64(),
-  Abi.windowsIA32: Uint32(),
-  Abi.windowsX64: Uint64(),
-})
-class UintPtr extends AbiSpecificInteger {
-  const UintPtr();
-}
-
 //
 // Pointer store.
 //
diff --git a/benchmarks/FfiMemory/dart2/FfiMemory.dart b/benchmarks/FfiMemory/dart2/FfiMemory.dart
index 86f7e1f..b3a6cf9 100644
--- a/benchmarks/FfiMemory/dart2/FfiMemory.dart
+++ b/benchmarks/FfiMemory/dart2/FfiMemory.dart
@@ -17,36 +17,6 @@
 import 'package:ffi/ffi.dart';
 import 'package:benchmark_harness/benchmark_harness.dart';
 
-/// Represents a native unsigned pointer-sized integer in C.
-///
-/// [UintPtr] is not constructible in the Dart code and serves purely as marker in
-/// type signatures.
-@AbiSpecificIntegerMapping({
-  Abi.androidArm: Uint32(),
-  Abi.androidArm64: Uint64(),
-  Abi.androidIA32: Uint32(),
-  Abi.androidX64: Uint64(),
-  Abi.fuchsiaArm64: Uint64(),
-  Abi.fuchsiaX64: Uint64(),
-  Abi.iosArm: Uint32(),
-  Abi.iosArm64: Uint64(),
-  Abi.iosX64: Uint64(),
-  Abi.linuxArm: Uint32(),
-  Abi.linuxArm64: Uint64(),
-  Abi.linuxIA32: Uint32(),
-  Abi.linuxX64: Uint64(),
-  Abi.linuxRiscv32: Uint32(),
-  Abi.linuxRiscv64: Uint64(),
-  Abi.macosArm64: Uint64(),
-  Abi.macosX64: Uint64(),
-  Abi.windowsArm64: Uint64(),
-  Abi.windowsIA32: Uint32(),
-  Abi.windowsX64: Uint64(),
-})
-class UintPtr extends AbiSpecificInteger {
-  const UintPtr();
-}
-
 //
 // Pointer store.
 //
diff --git a/benchmarks/SDKArtifactSizes/dart/SDKArtifactSizes.dart b/benchmarks/SDKArtifactSizes/dart/SDKArtifactSizes.dart
index b7c18d1..733b711 100644
--- a/benchmarks/SDKArtifactSizes/dart/SDKArtifactSizes.dart
+++ b/benchmarks/SDKArtifactSizes/dart/SDKArtifactSizes.dart
@@ -23,7 +23,6 @@
   'dartanalyzer',
   'dartdev',
   'dartdevc',
-  'dartdoc',
   'dds',
   'frontend_server',
   'gen_kernel',
diff --git a/compile_output.txt b/compile_output.txt
new file mode 100644
index 0000000..c3420dd
--- /dev/null
+++ b/compile_output.txt
@@ -0,0 +1,8 @@
+Info: The --categories flag is deprecated, see the usage for details.
+Info: Compiling with sound null safety
+Error: Error when reading 'benchmarks-internal/DeltaBlueBase/dart2/deltablue.dart': Error reading 'benchmarks-internal/DeltaBlueBase/dart2/deltablue.dart'  (No such file or directory)
+Error: No 'main' method found.
+Error: Compilation failed.
+real 1.14
+user 0.59
+sys 0.84
diff --git a/pkg/_fe_analyzer_shared/lib/src/macros/api/builders.dart b/pkg/_fe_analyzer_shared/lib/src/macros/api/builders.dart
index 868e62f..f10269c 100644
--- a/pkg/_fe_analyzer_shared/lib/src/macros/api/builders.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/macros/api/builders.dart
@@ -15,10 +15,8 @@
   void declareType(DeclarationCode typeDeclaration);
 }
 
-/// The interface to resolve a [TypeAnnotation] to a [StaticType].
-///
-/// The [StaticType]s can be compared against other [StaticType]s to see how
-/// they relate to each other.
+/// The interface used to create [StaticType] instances, which are used to
+/// examine type relationships.
 ///
 /// This api is only available to the declaration and definition phases of
 /// macro expansion.
@@ -30,7 +28,14 @@
   /// may be asked to run in this state during the development cycle. It is
   /// helpful for users if macros provide a best effort implementation in that
   /// case or handle the error in a useful way.
-  Future<StaticType> resolve(covariant TypeAnnotation typeAnnotation);
+  Future<StaticType> instantiateType(covariant TypeAnnotation typeAnnotation);
+
+  /// Instantiates a new [StaticType] for a given [code] expression, which must
+  /// be a type expression.
+  ///
+  /// All type identifiers in [code] must be instances of [Identifier] and not
+  /// bare strings.
+  Future<StaticType> instantiateCode(ExpressionCode code);
 }
 
 /// The api used to introspect on a [ClassDeclaration].
@@ -87,13 +92,16 @@
   void declareInClass(DeclarationCode declaration);
 }
 
-/// The interface used by [Macro]s to resolve any [NamedStaticType] to its
-/// declaration.
+/// The interface used by [Macro]s to resolve any [Identifier]s pointing to
+/// types to their type declarations.
 ///
 /// Only available in the definition phase of macro expansion.
 abstract class TypeDeclarationResolver {
-  /// Resolves a [NamedStaticType] to its [TypeDeclaration].
-  Future<TypeDeclaration> declarationOf(covariant NamedStaticType annotation);
+  /// Resolves an [identifier] to its [TypeDeclaration].
+  ///
+  /// If [identifier] does resolve to a [TypeDeclaration], then an
+  /// [ArgumentError] is thrown.
+  Future<TypeDeclaration> declarationOf(covariant Identifier identifier);
 }
 
 /// The base class for builders in the definition phase. These can convert
@@ -109,20 +117,24 @@
 /// The apis used by [Macro]s that run on classes, to fill in the definitions
 /// of any external declarations within that class.
 abstract class ClassDefinitionBuilder implements DefinitionBuilder {
-  /// Retrieve a [VariableDefinitionBuilder] for a field by [name].
+  /// Retrieve a [VariableDefinitionBuilder] for a field by [identifier].
   ///
-  /// Throws an [ArgumentError] if there is no field by that name.
-  Future<VariableDefinitionBuilder> buildField(String name);
+  /// Throws an [ArgumentError] if [identifier] does not refer to a field in
+  /// this class.
+  Future<VariableDefinitionBuilder> buildField(Identifier identifier);
 
-  /// Retrieve a [FunctionDefinitionBuilder] for a method by [name].
+  /// Retrieve a [FunctionDefinitionBuilder] for a method by [identifier].
   ///
-  /// Throws an [ArgumentError] if there is no method by that name.
-  Future<FunctionDefinitionBuilder> buildMethod(String name);
+  /// Throws an [ArgumentError] if [identifier] does not refer to a method in
+  /// this class.
+  Future<FunctionDefinitionBuilder> buildMethod(Identifier identifier);
 
-  /// Retrieve a [ConstructorDefinitionBuilder] for a constructor by [name].
+  /// Retrieve a [ConstructorDefinitionBuilder] for a constructor by
+  /// [identifier].
   ///
-  /// Throws an [ArgumentError] if there is no constructor by that name.
-  Future<ConstructorDefinitionBuilder> buildConstructor(String name);
+  /// Throws an [ArgumentError] if [identifier] does not refer to a constructor
+  /// in this class.
+  Future<ConstructorDefinitionBuilder> buildConstructor(Identifier identifier);
 }
 
 /// The apis used by [Macro]s to define the body of a constructor
diff --git a/pkg/_fe_analyzer_shared/lib/src/macros/api/code.dart b/pkg/_fe_analyzer_shared/lib/src/macros/api/code.dart
index 1486d1c..e7af1bd 100644
--- a/pkg/_fe_analyzer_shared/lib/src/macros/api/code.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/macros/api/code.dart
@@ -7,7 +7,7 @@
 /// The base class representing an arbitrary chunk of Dart code, which may or
 /// may not be syntactically or semantically valid yet.
 class Code {
-  /// All the chunks of [Code], raw [String]s, or [TypeAnnotation]s that
+  /// All the chunks of [Code], raw [String]s, or [Identifier]s that
   /// comprise this [Code] object.
   final List<Object> parts;
 
@@ -17,7 +17,9 @@
 
   Code.fromString(String code) : parts = [code];
 
-  Code.fromParts(this.parts);
+  Code.fromParts(this.parts)
+      : assert(parts.every((element) =>
+            element is String || element is Code || element is Identifier));
 }
 
 /// A piece of code representing a syntactically valid declaration.
@@ -67,16 +69,6 @@
   FunctionBodyCode.fromParts(List<Object> parts) : super.fromParts(parts);
 }
 
-/// A piece of code representing a syntactically valid identifier.
-class IdentifierCode extends Code {
-  @override
-  CodeKind get kind => CodeKind.identifier;
-
-  IdentifierCode.fromString(String code) : super.fromString(code);
-
-  IdentifierCode.fromParts(List<Object> parts) : super.fromParts(parts);
-}
-
 /// A piece of code identifying a named argument.
 ///
 /// This should not include any trailing commas.
@@ -137,7 +129,6 @@
   element,
   expression,
   functionBody,
-  identifier,
   namedArgument,
   parameter,
   statement,
diff --git a/pkg/_fe_analyzer_shared/lib/src/macros/api/introspection.dart b/pkg/_fe_analyzer_shared/lib/src/macros/api/introspection.dart
index 0749150..11fd6c3 100644
--- a/pkg/_fe_analyzer_shared/lib/src/macros/api/introspection.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/macros/api/introspection.dart
@@ -4,6 +4,18 @@
 
 part of '../api.dart';
 
+/// A concrete reference to a named declaration, which may or may not yet be
+/// resolved.
+///
+/// These can be passed directly to [Code] objects, which will automatically do
+/// any necessary prefixing when emitting references.
+///
+/// Concrete implementations should override `==` so that identifiers can be
+/// reliably compared against each other.
+abstract class Identifier {
+  String get name;
+}
+
 /// The base class for an unresolved reference to a type.
 ///
 /// See the subtypes [FunctionTypeAnnotation] and [NamedTypeAnnotation].
@@ -12,7 +24,9 @@
   /// trailing `?`)
   bool get isNullable;
 
-  /// A [Code] object representation of this type annotation.
+  /// A convenience method to get a [Code] object representation of this full
+  /// type annotation, including support for generic type arguments as well as
+  /// function types.
   Code get code;
 }
 
@@ -36,8 +50,8 @@
 /// These can be resolved to a [TypeDeclaration] using the `builder` classes
 /// depending on the phase a macro is running in.
 abstract class NamedTypeAnnotation implements TypeAnnotation {
-  /// The name of the type as it exists in the type annotation.
-  String get name;
+  /// An identifier pointing to this named type.
+  Identifier get identifier;
 
   /// The type arguments, if applicable.
   Iterable<TypeAnnotation> get typeArguments;
@@ -61,36 +75,22 @@
 
 /// The base class for all declarations.
 abstract class Declaration {
-  /// The name of this declaration.
-  String get name;
+  ///  An identifier pointing to this named declaration.
+  Identifier get identifier;
 }
 
 /// Base class for all Declarations which have a surrounding class.
 abstract class ClassMemberDeclaration implements Declaration {
   /// The class that defines this method.
-  NamedTypeAnnotation get definingClass;
+  Identifier get definingClass;
 }
 
 /// A declaration that defines a new type in the program.
 ///
 /// See subtypes [ClassDeclaration] and [TypeAliasDeclaration].
 abstract class TypeDeclaration implements Declaration {
-  // TODO: Change this to a [StaticType]? https://github.com/dart-lang/language/issues/2072
-  TypeAnnotation get type;
-
   /// The type parameters defined for this type declaration.
   Iterable<TypeParameterDeclaration> get typeParameters;
-
-  /// Create a static type representing this type with [typeArguments].
-  ///
-  /// If [isNullable] is `true`, then this type will behave as if it has a
-  /// trailing `?`.
-  ///
-  /// Throws an exception if the type could not be instantiated, typically due
-  /// to one of the type arguments not matching the bounds of the corresponding
-  /// type parameter.
-  Future<StaticType> instantiate(
-      {required List<StaticType> typeArguments, required bool isNullable});
 }
 
 /// Class (and enum) introspection information.
@@ -120,7 +120,7 @@
 /// Type alias introspection information.
 abstract class TypeAliasDeclaration extends TypeDeclaration {
   /// The type annotation this is an alias for.
-  TypeAnnotation get type;
+  TypeAnnotation get aliasedType;
 }
 
 /// Function introspection information.
diff --git a/pkg/_fe_analyzer_shared/lib/src/macros/executor_shared/builder_impls.dart b/pkg/_fe_analyzer_shared/lib/src/macros/executor_shared/builder_impls.dart
index c423331..099c58e 100644
--- a/pkg/_fe_analyzer_shared/lib/src/macros/executor_shared/builder_impls.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/macros/executor_shared/builder_impls.dart
@@ -4,6 +4,8 @@
 
 import 'dart:async';
 
+import 'package:_fe_analyzer_shared/src/macros/executor_shared/introspection_impls.dart';
+
 import '../executor.dart';
 import '../api.dart';
 import 'response_impls.dart';
@@ -66,8 +68,12 @@
       classIntrospector.superclassOf(clazz);
 
   @override
-  Future<StaticType> resolve(TypeAnnotation typeAnnotation) =>
-      typeResolver.resolve(typeAnnotation);
+  Future<StaticType> instantiateCode(ExpressionCode code) =>
+      typeResolver.instantiateCode(code);
+
+  @override
+  Future<StaticType> instantiateType(TypeAnnotation typeAnnotation) =>
+      typeResolver.instantiateType(typeAnnotation);
 }
 
 class DeclarationBuilderImpl extends DeclarationBuilderBase
@@ -84,7 +90,7 @@
 
 class ClassMemberDeclarationBuilderImpl extends DeclarationBuilderImpl
     implements ClassMemberDeclarationBuilder {
-  final TypeAnnotation definingClass;
+  final Identifier definingClass;
 
   ClassMemberDeclarationBuilderImpl(this.definingClass,
       ClassIntrospector classIntrospector, TypeResolver typeResolver)
@@ -108,8 +114,8 @@
             parentAugmentations: parentAugmentations);
 
   @override
-  Future<TypeDeclaration> declarationOf(NamedStaticType annotation) =>
-      typeDeclarationResolver.declarationOf(annotation);
+  Future<TypeDeclaration> declarationOf(IdentifierImpl identifier) =>
+      typeDeclarationResolver.declarationOf(identifier);
 }
 
 class ClassDefinitionBuilderImpl extends DefinitionBuilderBase
@@ -127,28 +133,29 @@
             parentAugmentations: parentAugmentations);
 
   @override
-  Future<ConstructorDefinitionBuilder> buildConstructor(String name) async {
+  Future<ConstructorDefinitionBuilder> buildConstructor(
+      Identifier identifier) async {
     ConstructorDeclaration constructor =
         (await classIntrospector.constructorsOf(declaration))
-            .firstWhere((constructor) => constructor.name == name);
+            .firstWhere((constructor) => constructor.identifier == identifier);
     return new ConstructorDefinitionBuilderImpl(
         constructor, classIntrospector, typeResolver, typeDeclarationResolver,
         parentAugmentations: _augmentations);
   }
 
   @override
-  Future<VariableDefinitionBuilder> buildField(String name) async {
+  Future<VariableDefinitionBuilder> buildField(Identifier identifier) async {
     FieldDeclaration field = (await classIntrospector.fieldsOf(declaration))
-        .firstWhere((field) => field.name == name);
+        .firstWhere((field) => field.identifier == identifier);
     return new VariableDefinitionBuilderImpl(
         field, classIntrospector, typeResolver, typeDeclarationResolver,
         parentAugmentations: _augmentations);
   }
 
   @override
-  Future<FunctionDefinitionBuilder> buildMethod(String name) async {
+  Future<FunctionDefinitionBuilder> buildMethod(Identifier identifier) async {
     MethodDeclaration method = (await classIntrospector.methodsOf(declaration))
-        .firstWhere((method) => method.name == name);
+        .firstWhere((method) => method.identifier == identifier);
     return new FunctionDefinitionBuilderImpl(
         method, classIntrospector, typeResolver, typeDeclarationResolver,
         parentAugmentations: _augmentations);
@@ -243,7 +250,7 @@
 
 /// Creates an augmentation of [clazz] with member [augmentations].
 DeclarationCode _buildClassAugmentation(
-        TypeAnnotation clazz, List<DeclarationCode> augmentations) =>
+        Identifier clazz, List<DeclarationCode> augmentations) =>
     new DeclarationCode.fromParts([
       'augment class ',
       clazz,
@@ -275,9 +282,9 @@
     augmentations.add(new DeclarationCode.fromParts([
       'augment ',
       if (declaration.isFinal) 'final ',
-      declaration.type,
+      declaration.type.code,
       ' ',
-      declaration.name,
+      declaration.identifier,
       ' = ',
       initializer,
       ';',
@@ -300,18 +307,18 @@
   return new DeclarationCode.fromParts([
     'augment ',
     if (declaration is ConstructorDeclaration) ...[
-      declaration.definingClass.name,
-      if (declaration.name.isNotEmpty) '.',
+      declaration.definingClass,
+      if (declaration.identifier.name.isNotEmpty) '.',
     ] else ...[
       declaration.returnType.code,
       ' ',
     ],
-    declaration.name.trimEquals(),
+    declaration.identifier,
     if (declaration.typeParameters.isNotEmpty) ...[
       '<',
       for (TypeParameterDeclaration typeParam
           in declaration.typeParameters) ...[
-        typeParam.name,
+        typeParam.identifier,
         if (typeParam.bounds != null) ...['extends ', typeParam.bounds!.code],
         if (typeParam != declaration.typeParameters.last) ', ',
       ],
@@ -323,7 +330,7 @@
       new ParameterCode.fromParts([
         positionalRequired.type.code,
         ' ',
-        positionalRequired.name,
+        positionalRequired.identifier,
       ]),
       ', '
     ],
@@ -334,7 +341,7 @@
         new ParameterCode.fromParts([
           positionalOptional.type.code,
           ' ',
-          positionalOptional.name,
+          positionalOptional.identifier,
         ]),
         ', ',
       ],
@@ -347,7 +354,7 @@
           if (named.isRequired) 'required ',
           named.type.code,
           ' ',
-          named.name,
+          named.identifier,
           if (named.defaultValue != null) ...[
             ' = ',
             named.defaultValue!,
@@ -369,7 +376,3 @@
     body,
   ]);
 }
-
-extension _ on String {
-  String trimEquals() => endsWith('=') ? substring(0, length - 1) : this;
-}
diff --git a/pkg/_fe_analyzer_shared/lib/src/macros/executor_shared/execute_macro.dart b/pkg/_fe_analyzer_shared/lib/src/macros/executor_shared/execute_macro.dart
index c1367a2..7488445 100644
--- a/pkg/_fe_analyzer_shared/lib/src/macros/executor_shared/execute_macro.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/macros/executor_shared/execute_macro.dart
@@ -47,7 +47,7 @@
   if (declaration is ClassDeclaration && macro is ClassDeclarationsMacro) {
     ClassMemberDeclarationBuilderImpl builder =
         new ClassMemberDeclarationBuilderImpl(
-            declaration.type, classIntrospector, typeResolver);
+            declaration.identifier, classIntrospector, typeResolver);
     await macro.buildDeclarationsForClass(declaration, builder);
     return builder.result;
   } else if (declaration is ClassMemberDeclaration) {
diff --git a/pkg/_fe_analyzer_shared/lib/src/macros/executor_shared/introspection_impls.dart b/pkg/_fe_analyzer_shared/lib/src/macros/executor_shared/introspection_impls.dart
index 9bdd740..64e5e4f 100644
--- a/pkg/_fe_analyzer_shared/lib/src/macros/executor_shared/introspection_impls.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/macros/executor_shared/introspection_impls.dart
@@ -7,6 +7,26 @@
 import 'serialization_extensions.dart';
 import '../api.dart';
 
+class IdentifierImpl extends RemoteInstance implements Identifier {
+  final String name;
+
+  @override
+  RemoteInstanceKind get kind => RemoteInstanceKind.identifier;
+
+  IdentifierImpl({required int id, required this.name}) : super(id);
+
+  @override
+  void serialize(Serializer serializer) {
+    super.serialize(serializer);
+    // Client side we don't encode anything but the ID.
+    if (serializationMode == SerializationMode.client) {
+      return;
+    }
+
+    serializer.addString(name);
+  }
+}
+
 abstract class TypeAnnotationImpl extends RemoteInstance
     implements TypeAnnotation {
   final bool isNullable;
@@ -29,18 +49,18 @@
     implements NamedTypeAnnotation {
   @override
   Code get code => new Code.fromParts([
-        name,
+        identifier,
         if (typeArguments.isNotEmpty) ...[
           '<',
-          typeArguments.first,
-          for (TypeAnnotation arg in typeArguments.skip(1)) ...[', ', arg],
+          typeArguments.first.code,
+          for (TypeAnnotation arg in typeArguments.skip(1)) ...[', ', arg.code],
           '>',
         ],
         if (isNullable) '?',
       ]);
 
   @override
-  final String name;
+  final IdentifierImpl identifier;
 
   @override
   final List<TypeAnnotationImpl> typeArguments;
@@ -51,7 +71,7 @@
   NamedTypeAnnotationImpl({
     required int id,
     required bool isNullable,
-    required this.name,
+    required this.identifier,
     required this.typeArguments,
   }) : super(id: id, isNullable: isNullable);
 
@@ -63,7 +83,7 @@
       return;
     }
 
-    serializer.addString(name);
+    identifier.serialize(serializer);
     serializer.startList();
     for (TypeAnnotationImpl typeArg in typeArguments) {
       typeArg.serialize(serializer);
@@ -76,32 +96,32 @@
     implements FunctionTypeAnnotation {
   @override
   Code get code => new Code.fromParts([
-        returnType,
+        returnType.code,
         'Function',
         if (typeParameters.isNotEmpty) ...[
           '<',
-          typeParameters.first.name,
+          typeParameters.first.identifier.name,
           if (typeParameters.first.bounds != null) ...[
             ' extends ',
-            typeParameters.first.bounds!
+            typeParameters.first.bounds!.code,
           ],
           for (TypeParameterDeclaration arg in typeParameters.skip(1)) ...[
             ', ',
-            arg.name,
-            if (arg.bounds != null) ...[' extends ', arg.bounds!],
+            arg.identifier.name,
+            if (arg.bounds != null) ...[' extends ', arg.bounds!.code],
           ],
           '>',
         ],
         '(',
         for (ParameterDeclaration positional in positionalParameters) ...[
-          positional.type,
-          ' ${positional.name}',
+          positional.type.code,
+          ' ${positional.identifier.name}',
         ],
         if (namedParameters.isNotEmpty) ...[
           '{',
           for (ParameterDeclaration named in namedParameters) ...[
-            named.type,
-            ' ${named.name}',
+            named.type.code,
+            ' ${named.identifier.name}',
           ],
           '}',
         ],
@@ -164,9 +184,9 @@
 }
 
 abstract class DeclarationImpl extends RemoteInstance implements Declaration {
-  final String name;
+  final IdentifierImpl identifier;
 
-  DeclarationImpl({required int id, required this.name}) : super(id);
+  DeclarationImpl({required int id, required this.identifier}) : super(id);
 
   @override
   void serialize(Serializer serializer) {
@@ -176,7 +196,7 @@
       return;
     }
 
-    serializer.addString(name);
+    identifier.serialize(serializer);
   }
 }
 
@@ -199,12 +219,12 @@
 
   ParameterDeclarationImpl({
     required int id,
-    required String name,
+    required IdentifierImpl identifier,
     required this.defaultValue,
     required this.isNamed,
     required this.isRequired,
     required this.type,
-  }) : super(id: id, name: name);
+  }) : super(id: id, identifier: identifier);
 
   @override
   void serialize(Serializer serializer) {
@@ -235,9 +255,9 @@
 
   TypeParameterDeclarationImpl({
     required int id,
-    required String name,
+    required IdentifierImpl identifier,
     required this.bounds,
-  }) : super(id: id, name: name);
+  }) : super(id: id, identifier: identifier);
 
   @override
   void serialize(Serializer serializer) {
@@ -287,7 +307,7 @@
 
   FunctionDeclarationImpl({
     required int id,
-    required String name,
+    required IdentifierImpl identifier,
     required this.isAbstract,
     required this.isExternal,
     required this.isGetter,
@@ -296,7 +316,7 @@
     required this.positionalParameters,
     required this.returnType,
     required this.typeParameters,
-  }) : super(id: id, name: name);
+  }) : super(id: id, identifier: identifier);
 
   @override
   void serialize(Serializer serializer) {
@@ -334,7 +354,7 @@
 class MethodDeclarationImpl extends FunctionDeclarationImpl
     implements MethodDeclaration {
   @override
-  final NamedTypeAnnotationImpl definingClass;
+  final IdentifierImpl definingClass;
 
   @override
   RemoteInstanceKind get kind => RemoteInstanceKind.methodDeclaration;
@@ -342,7 +362,7 @@
   MethodDeclarationImpl({
     // Declaration fields
     required int id,
-    required String name,
+    required IdentifierImpl identifier,
     // Function fields
     required bool isAbstract,
     required bool isExternal,
@@ -356,7 +376,7 @@
     required this.definingClass,
   }) : super(
           id: id,
-          name: name,
+          identifier: identifier,
           isAbstract: isAbstract,
           isExternal: isExternal,
           isGetter: isGetter,
@@ -390,7 +410,7 @@
   ConstructorDeclarationImpl({
     // Declaration fields
     required int id,
-    required String name,
+    required IdentifierImpl identifier,
     // Function fields
     required bool isAbstract,
     required bool isExternal,
@@ -401,12 +421,12 @@
     required TypeAnnotationImpl returnType,
     required List<TypeParameterDeclarationImpl> typeParameters,
     // Method fields
-    required NamedTypeAnnotationImpl definingClass,
+    required IdentifierImpl definingClass,
     // Constructor fields
     required this.isFactory,
   }) : super(
           id: id,
-          name: name,
+          identifier: identifier,
           isAbstract: isAbstract,
           isExternal: isExternal,
           isGetter: isGetter,
@@ -452,13 +472,13 @@
 
   VariableDeclarationImpl({
     required int id,
-    required String name,
+    required IdentifierImpl identifier,
     required this.initializer,
     required this.isExternal,
     required this.isFinal,
     required this.isLate,
     required this.type,
-  }) : super(id: id, name: name);
+  }) : super(id: id, identifier: identifier);
 
   @override
   void serialize(Serializer serializer) {
@@ -480,12 +500,12 @@
 class FieldDeclarationImpl extends VariableDeclarationImpl
     implements FieldDeclaration {
   @override
-  final NamedTypeAnnotationImpl definingClass;
+  final IdentifierImpl definingClass;
 
   FieldDeclarationImpl({
     // Declaration fields
     required int id,
-    required String name,
+    required IdentifierImpl identifier,
     // Variable fields
     required ExpressionCode? initializer,
     required bool isExternal,
@@ -496,7 +516,7 @@
     required this.definingClass,
   }) : super(
             id: id,
-            name: name,
+            identifier: identifier,
             initializer: initializer,
             isExternal: isExternal,
             isFinal: isFinal,
@@ -520,24 +540,13 @@
 abstract class TypeDeclarationImpl extends DeclarationImpl
     implements TypeDeclaration {
   @override
-  final TypeAnnotationImpl type;
-
-  @override
   final List<TypeParameterDeclarationImpl> typeParameters;
 
   TypeDeclarationImpl({
     required int id,
-    required String name,
-    required this.type,
+    required IdentifierImpl identifier,
     required this.typeParameters,
-  }) : super(id: id, name: name);
-
-  @override
-  Future<StaticType> instantiate(
-      {required List<StaticType> typeArguments, required bool isNullable}) {
-    // TODO: implement instantiate
-    throw new UnimplementedError('instantiate');
-  }
+  }) : super(id: id, identifier: identifier);
 
   void serialize(Serializer serializer) {
     super.serialize(serializer);
@@ -546,7 +555,6 @@
       return;
     }
 
-    type.serialize(serializer);
     serializer..startList();
     for (TypeParameterDeclarationImpl param in typeParameters) {
       param.serialize(serializer);
@@ -578,9 +586,8 @@
   ClassDeclarationImpl({
     // Declaration fields
     required int id,
-    required String name,
+    required IdentifierImpl identifier,
     // TypeDeclaration fields
-    required TypeAnnotationImpl type,
     required List<TypeParameterDeclarationImpl> typeParameters,
     // ClassDeclaration fields
     required this.interfaces,
@@ -588,7 +595,7 @@
     required this.isExternal,
     required this.mixins,
     required this.superclass,
-  }) : super(id: id, name: name, type: type, typeParameters: typeParameters);
+  }) : super(id: id, identifier: identifier, typeParameters: typeParameters);
 
   @override
   void serialize(Serializer serializer) {
@@ -626,13 +633,12 @@
   TypeAliasDeclarationImpl({
     // Declaration fields
     required int id,
-    required String name,
+    required IdentifierImpl identifier,
     // TypeDeclaration fields
-    required TypeAnnotationImpl type,
     required List<TypeParameterDeclarationImpl> typeParameters,
     // TypeAlias fields
     required this.aliasedType,
-  }) : super(id: id, name: name, type: type, typeParameters: typeParameters);
+  }) : super(id: id, identifier: identifier, typeParameters: typeParameters);
 
   @override
   void serialize(Serializer serializer) {
diff --git a/pkg/_fe_analyzer_shared/lib/src/macros/executor_shared/protocol.dart b/pkg/_fe_analyzer_shared/lib/src/macros/executor_shared/protocol.dart
index 00b3787..0577fa2 100644
--- a/pkg/_fe_analyzer_shared/lib/src/macros/executor_shared/protocol.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/macros/executor_shared/protocol.dart
@@ -337,24 +337,24 @@
 }
 
 /// A request to reflect on a type annotation
-class ResolveTypeRequest extends Request {
+class InstantiateTypeRequest extends Request {
   final TypeAnnotationImpl typeAnnotation;
   final RemoteInstanceImpl typeResolver;
 
-  ResolveTypeRequest(this.typeAnnotation, this.typeResolver,
+  InstantiateTypeRequest(this.typeAnnotation, this.typeResolver,
       {required int serializationZoneId})
       : super(serializationZoneId: serializationZoneId);
 
   /// When deserializing we have already consumed the message type, so we don't
   /// consume it again.
-  ResolveTypeRequest.deserialize(
+  InstantiateTypeRequest.deserialize(
       Deserializer deserializer, int serializationZoneId)
       : typeAnnotation = RemoteInstance.deserialize(deserializer),
         typeResolver = RemoteInstance.deserialize(deserializer),
         super.deserialize(deserializer, serializationZoneId);
 
   void serialize(Serializer serializer) {
-    serializer.addNum(MessageType.resolveTypeRequest.index);
+    serializer.addNum(MessageType.instantiateTypeRequest.index);
     typeAnnotation.serialize(serializer);
     typeResolver.serialize(serializer);
     super.serialize(serializer);
@@ -442,10 +442,10 @@
 
 /// A request to get a [TypeDeclaration] for a [StaticType].
 class DeclarationOfRequest extends Request {
-  final RemoteInstanceImpl type;
+  final IdentifierImpl identifier;
   final RemoteInstanceImpl typeDeclarationResolver;
 
-  DeclarationOfRequest(this.type, this.typeDeclarationResolver,
+  DeclarationOfRequest(this.identifier, this.typeDeclarationResolver,
       {required int serializationZoneId})
       : super(serializationZoneId: serializationZoneId);
 
@@ -453,14 +453,14 @@
   /// consume it again.
   DeclarationOfRequest.deserialize(
       Deserializer deserializer, int serializationZoneId)
-      : type = RemoteInstance.deserialize(deserializer),
+      : identifier = RemoteInstance.deserialize(deserializer),
         typeDeclarationResolver = RemoteInstance.deserialize(deserializer),
         super.deserialize(deserializer, serializationZoneId);
 
   @override
   void serialize(Serializer serializer) {
     serializer.addNum(MessageType.declarationOfRequest.index);
-    type.serialize(serializer);
+    identifier.serialize(serializer);
     typeDeclarationResolver.serialize(serializer);
     super.serialize(serializer);
   }
@@ -484,8 +484,8 @@
       {required this.remoteInstance, required this.serializationZoneId});
 
   @override
-  Future<StaticType> resolve(TypeAnnotationImpl typeAnnotation) async {
-    ResolveTypeRequest request = new ResolveTypeRequest(
+  Future<StaticType> instantiateType(TypeAnnotationImpl typeAnnotation) async {
+    InstantiateTypeRequest request = new InstantiateTypeRequest(
         typeAnnotation, remoteInstance,
         serializationZoneId: serializationZoneId);
     RemoteInstanceImpl remoteType =
@@ -505,6 +505,12 @@
             '${remoteType.kind}');
     }
   }
+
+  @override
+  Future<StaticType> instantiateCode(ExpressionCode code) {
+    // TODO: implement instantiateCode
+    throw new UnimplementedError();
+  }
 }
 
 class ClientStaticTypeImpl implements StaticType {
@@ -648,9 +654,9 @@
       {required this.remoteInstance, required this.serializationZoneId});
 
   @override
-  Future<TypeDeclaration> declarationOf(ClientNamedStaticTypeImpl type) async {
+  Future<TypeDeclaration> declarationOf(IdentifierImpl identifier) async {
     DeclarationOfRequest request = new DeclarationOfRequest(
-        type.remoteInstance, remoteInstance,
+        identifier, remoteInstance,
         serializationZoneId: serializationZoneId);
     return _handleResponse<TypeDeclaration>(await sendRequest(request));
   }
@@ -692,11 +698,11 @@
   executeDefinitionsPhaseRequest,
   executeTypesPhaseRequest,
   instantiateMacroRequest,
+  instantiateTypeRequest,
   isExactlyTypeRequest,
   isSubtypeOfRequest,
   loadMacroRequest,
   remoteInstance,
-  resolveTypeRequest,
   macroClassIdentifier,
   macroInstanceIdentifier,
   macroExecutionResult,
diff --git a/pkg/_fe_analyzer_shared/lib/src/macros/executor_shared/remote_instance.dart b/pkg/_fe_analyzer_shared/lib/src/macros/executor_shared/remote_instance.dart
index 411f2aa..7ba94f8 100644
--- a/pkg/_fe_analyzer_shared/lib/src/macros/executor_shared/remote_instance.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/macros/executor_shared/remote_instance.dart
@@ -68,6 +68,9 @@
         return;
     }
   }
+
+  @override
+  bool operator ==(Object other) => other is RemoteInstance && id == other.id;
 }
 
 /// A remote instance which is just a pointer to some server side instance of
@@ -96,6 +99,7 @@
   fieldDeclaration,
   functionDeclaration,
   functionTypeAnnotation,
+  identifier,
   namedStaticType,
   methodDeclaration,
   namedTypeAnnotation,
diff --git a/pkg/_fe_analyzer_shared/lib/src/macros/executor_shared/serialization_extensions.dart b/pkg/_fe_analyzer_shared/lib/src/macros/executor_shared/serialization_extensions.dart
index 33464d7..ff8a0b2 100644
--- a/pkg/_fe_analyzer_shared/lib/src/macros/executor_shared/serialization_extensions.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/macros/executor_shared/serialization_extensions.dart
@@ -34,6 +34,9 @@
           case RemoteInstanceKind.functionTypeAnnotation:
             moveNext();
             return _expectFunctionTypeAnnotation(id) as T;
+          case RemoteInstanceKind.identifier:
+            moveNext();
+            return _expectIdentifier(id) as T;
           case RemoteInstanceKind.methodDeclaration:
             moveNext();
             return _expectMethodDeclaration(id) as T;
@@ -71,7 +74,7 @@
       new NamedTypeAnnotationImpl(
         id: id,
         isNullable: expectBool(),
-        name: (this..moveNext()).expectString(),
+        identifier: RemoteInstance.deserialize(this),
         typeArguments: (this..moveNext())._expectRemoteInstanceList(),
       );
 
@@ -85,10 +88,15 @@
         typeParameters: (this..moveNext())._expectRemoteInstanceList(),
       );
 
+  Identifier _expectIdentifier(int id) => new IdentifierImpl(
+        id: id,
+        name: expectString(),
+      );
+
   ParameterDeclaration _expectParameterDeclaration(int id) =>
       new ParameterDeclarationImpl(
         id: id,
-        name: expectString(),
+        identifier: expectRemoteInstance(),
         defaultValue: (this..moveNext()).checkNull() ? null : expectCode(),
         isNamed: (this..moveNext()).expectBool(),
         isRequired: (this..moveNext()).expectBool(),
@@ -98,14 +106,14 @@
   TypeParameterDeclaration _expectTypeParameterDeclaration(int id) =>
       new TypeParameterDeclarationImpl(
         id: id,
-        name: expectString(),
+        identifier: expectRemoteInstance(),
         bounds: (this..moveNext()).checkNull() ? null : expectRemoteInstance(),
       );
 
   FunctionDeclaration _expectFunctionDeclaration(int id) =>
       new FunctionDeclarationImpl(
         id: id,
-        name: expectString(),
+        identifier: expectRemoteInstance(),
         isAbstract: (this..moveNext()).expectBool(),
         isExternal: (this..moveNext()).expectBool(),
         isGetter: (this..moveNext()).expectBool(),
@@ -119,7 +127,7 @@
   MethodDeclaration _expectMethodDeclaration(int id) =>
       new MethodDeclarationImpl(
         id: id,
-        name: expectString(),
+        identifier: expectRemoteInstance(),
         isAbstract: (this..moveNext()).expectBool(),
         isExternal: (this..moveNext()).expectBool(),
         isGetter: (this..moveNext()).expectBool(),
@@ -134,7 +142,7 @@
   ConstructorDeclaration _expectConstructorDeclaration(int id) =>
       new ConstructorDeclarationImpl(
         id: id,
-        name: expectString(),
+        identifier: expectRemoteInstance(),
         isAbstract: (this..moveNext()).expectBool(),
         isExternal: (this..moveNext()).expectBool(),
         isGetter: (this..moveNext()).expectBool(),
@@ -150,7 +158,7 @@
   VariableDeclaration _expectVariableDeclaration(int id) =>
       new VariableDeclarationImpl(
         id: id,
-        name: expectString(),
+        identifier: expectRemoteInstance(),
         initializer: (this..moveNext()).expectNullableCode(),
         isExternal: (this..moveNext()).expectBool(),
         isFinal: (this..moveNext()).expectBool(),
@@ -160,7 +168,7 @@
 
   FieldDeclaration _expectFieldDeclaration(int id) => new FieldDeclarationImpl(
         id: id,
-        name: expectString(),
+        identifier: expectRemoteInstance(),
         initializer: (this..moveNext()).expectNullableCode(),
         isExternal: (this..moveNext()).expectBool(),
         isFinal: (this..moveNext()).expectBool(),
@@ -171,8 +179,7 @@
 
   ClassDeclaration _expectClassDeclaration(int id) => new ClassDeclarationImpl(
         id: id,
-        name: expectString(),
-        type: RemoteInstance.deserialize(this),
+        identifier: expectRemoteInstance(),
         typeParameters: (this..moveNext())._expectRemoteInstanceList(),
         interfaces: (this..moveNext())._expectRemoteInstanceList(),
         isAbstract: (this..moveNext()).expectBool(),
@@ -185,8 +192,7 @@
   TypeAliasDeclaration _expectTypeAliasDeclaration(int id) =>
       new TypeAliasDeclarationImpl(
         id: id,
-        name: expectString(),
-        type: RemoteInstance.deserialize(this),
+        identifier: expectRemoteInstance(),
         typeParameters: (this..moveNext())._expectRemoteInstanceList(),
         aliasedType: RemoteInstance.deserialize(this),
       );
@@ -206,7 +212,7 @@
         case CodePartKind.string:
           parts.add(expectString());
           break;
-        case CodePartKind.typeAnnotation:
+        case CodePartKind.identifier:
           parts.add(expectRemoteInstance());
           break;
       }
@@ -223,8 +229,6 @@
         return new ExpressionCode.fromParts(parts) as T;
       case CodeKind.functionBody:
         return new FunctionBodyCode.fromParts(parts) as T;
-      case CodeKind.identifier:
-        return new IdentifierCode.fromParts(parts) as T;
       case CodeKind.namedArgument:
         return new NamedArgumentCode.fromParts(parts) as T;
       case CodeKind.parameter:
@@ -277,8 +281,8 @@
       } else if (part is Code) {
         serializer.addNum(CodePartKind.code.index);
         part.serialize(serializer);
-      } else if (part is TypeAnnotationImpl) {
-        serializer.addNum(CodePartKind.typeAnnotation.index);
+      } else if (part is IdentifierImpl) {
+        serializer.addNum(CodePartKind.identifier.index);
         part.serialize(serializer);
       } else {
         throw new StateError('Unrecognized code part $part');
@@ -291,5 +295,5 @@
 enum CodePartKind {
   string,
   code,
-  typeAnnotation,
+  identifier,
 }
diff --git a/pkg/_fe_analyzer_shared/lib/src/macros/isolated_executor/isolated_executor.dart b/pkg/_fe_analyzer_shared/lib/src/macros/isolated_executor/isolated_executor.dart
index 210469e..cfe6602 100644
--- a/pkg/_fe_analyzer_shared/lib/src/macros/isolated_executor/isolated_executor.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/macros/isolated_executor/isolated_executor.dart
@@ -156,12 +156,12 @@
               }
               completer.complete(response);
               break;
-            case MessageType.resolveTypeRequest:
-              ResolveTypeRequest request =
-                  new ResolveTypeRequest.deserialize(deserializer, zoneId);
+            case MessageType.instantiateTypeRequest:
+              InstantiateTypeRequest request =
+                  new InstantiateTypeRequest.deserialize(deserializer, zoneId);
               StaticType instance =
                   await (request.typeResolver.instance as TypeResolver)
-                      .resolve(request.typeAnnotation);
+                      .instantiateType(request.typeAnnotation);
               SerializableResponse response = new SerializableResponse(
                   response: new RemoteInstanceImpl(
                       id: RemoteInstance.uniqueId,
@@ -211,13 +211,12 @@
             case MessageType.declarationOfRequest:
               DeclarationOfRequest request =
                   new DeclarationOfRequest.deserialize(deserializer, zoneId);
-              NamedStaticType type = request.type.instance as NamedStaticType;
               TypeDeclarationResolver resolver = request
                   .typeDeclarationResolver.instance as TypeDeclarationResolver;
               SerializableResponse response = new SerializableResponse(
                   requestId: request.id,
                   responseType: MessageType.remoteInstance,
-                  response: (await resolver.declarationOf(type)
+                  response: (await resolver.declarationOf(request.identifier)
                       // TODO: Consider refactoring to avoid the need for this.
                       as TypeDeclarationImpl),
                   serializationZoneId: zoneId);
diff --git a/pkg/_fe_analyzer_shared/test/inheritance/data/object_opt_in/core.dart b/pkg/_fe_analyzer_shared/test/inheritance/data/object_opt_in/core.dart
index 79f1f75..ceda8df 100644
--- a/pkg/_fe_analyzer_shared/test/inheritance/data/object_opt_in/core.dart
+++ b/pkg/_fe_analyzer_shared/test/inheritance/data/object_opt_in/core.dart
@@ -27,6 +27,9 @@
 /*class: Enum:Enum,Object*/
 abstract class Enum {}
 
+/*class: _Enum:Enum,Object,_Enum*/
+abstract class _Enum implements Enum {}
+
 /*class: Null:Null,Object*/
 class Null {
   factory Null._uninstantiable() {
diff --git a/pkg/_fe_analyzer_shared/test/inheritance/data/object_opt_out/core.dart b/pkg/_fe_analyzer_shared/test/inheritance/data/object_opt_out/core.dart
index 2682390..f3d77df 100644
--- a/pkg/_fe_analyzer_shared/test/inheritance/data/object_opt_out/core.dart
+++ b/pkg/_fe_analyzer_shared/test/inheritance/data/object_opt_out/core.dart
@@ -29,6 +29,9 @@
 /*class: Enum:Enum,Object*/
 abstract class Enum {}
 
+/*class: _Enum:Enum,Object,_Enum*/
+abstract class _Enum implements Enum {}
+
 /*class: Null:Null,Object*/
 class Null {
   factory Null._uninstantiable() {
diff --git a/pkg/_fe_analyzer_shared/test/macros/executor_shared/serialization_test.dart b/pkg/_fe_analyzer_shared/test/macros/executor_shared/serialization_test.dart
index b9efa16..502f9f9 100644
--- a/pkg/_fe_analyzer_shared/test/macros/executor_shared/serialization_test.dart
+++ b/pkg/_fe_analyzer_shared/test/macros/executor_shared/serialization_test.dart
@@ -85,12 +85,13 @@
       var string = NamedTypeAnnotationImpl(
           id: RemoteInstance.uniqueId,
           isNullable: false,
-          name: 'String',
+          identifier:
+              IdentifierImpl(id: RemoteInstance.uniqueId, name: 'String'),
           typeArguments: const []);
       var foo = NamedTypeAnnotationImpl(
           id: RemoteInstance.uniqueId,
           isNullable: false,
-          name: 'Foo',
+          identifier: IdentifierImpl(id: RemoteInstance.uniqueId, name: 'Foo'),
           typeArguments: [string]);
       Object? serializedFoo;
       var serializer = JsonSerializer();
@@ -109,12 +110,12 @@
       final barType = NamedTypeAnnotationImpl(
           id: RemoteInstance.uniqueId,
           isNullable: false,
-          name: 'Bar',
+          identifier: IdentifierImpl(id: RemoteInstance.uniqueId, name: 'Bar'),
           typeArguments: []);
       final fooType = NamedTypeAnnotationImpl(
           id: RemoteInstance.uniqueId,
           isNullable: true,
-          name: 'Foo',
+          identifier: IdentifierImpl(id: RemoteInstance.uniqueId, name: 'Foo'),
           typeArguments: [barType]);
 
       test('NamedTypeAnnotation', () {
@@ -126,7 +127,7 @@
           defaultValue: null,
           isNamed: true,
           isRequired: true,
-          name: 'foo',
+          identifier: IdentifierImpl(id: RemoteInstance.uniqueId, name: 'foo'),
           type: fooType);
 
       final barPositionalParam = ParameterDeclarationImpl(
@@ -134,11 +135,13 @@
           defaultValue: Code.fromString('const Bar()'),
           isNamed: false,
           isRequired: false,
-          name: 'bar',
+          identifier: IdentifierImpl(id: RemoteInstance.uniqueId, name: 'bar'),
           type: barType);
 
       final zapTypeParam = TypeParameterDeclarationImpl(
-          id: RemoteInstance.uniqueId, name: 'Zap', bounds: barType);
+          id: RemoteInstance.uniqueId,
+          identifier: IdentifierImpl(id: RemoteInstance.uniqueId, name: 'Zap'),
+          bounds: barType);
 
       // Transitively tests `TypeParameterDeclaration` and
       // `ParameterDeclaration`.
@@ -157,7 +160,8 @@
       test('FunctionDeclaration', () {
         var function = FunctionDeclarationImpl(
             id: RemoteInstance.uniqueId,
-            name: 'name',
+            identifier:
+                IdentifierImpl(id: RemoteInstance.uniqueId, name: 'name'),
             isAbstract: true,
             isExternal: false,
             isGetter: true,
@@ -172,7 +176,8 @@
       test('MethodDeclaration', () {
         var method = MethodDeclarationImpl(
             id: RemoteInstance.uniqueId,
-            name: 'zorp',
+            identifier:
+                IdentifierImpl(id: RemoteInstance.uniqueId, name: 'zorp'),
             isAbstract: false,
             isExternal: false,
             isGetter: false,
@@ -181,14 +186,14 @@
             positionalParameters: [barPositionalParam],
             returnType: fooType,
             typeParameters: [zapTypeParam],
-            definingClass: fooType);
+            definingClass: fooType.identifier);
         expectSerializationEquality(method);
       });
 
       test('ConstructorDeclaration', () {
         var constructor = ConstructorDeclarationImpl(
           id: RemoteInstance.uniqueId,
-          name: 'new',
+          identifier: IdentifierImpl(id: RemoteInstance.uniqueId, name: 'new'),
           isAbstract: false,
           isExternal: false,
           isGetter: false,
@@ -197,7 +202,7 @@
           positionalParameters: [barPositionalParam],
           returnType: fooType,
           typeParameters: [zapTypeParam],
-          definingClass: fooType,
+          definingClass: fooType.identifier,
           isFactory: true,
         );
         expectSerializationEquality(constructor);
@@ -206,7 +211,7 @@
       test('VariableDeclaration', () {
         var bar = VariableDeclarationImpl(
           id: RemoteInstance.uniqueId,
-          name: 'bar',
+          identifier: IdentifierImpl(id: RemoteInstance.uniqueId, name: 'bar'),
           isExternal: true,
           isFinal: false,
           isLate: true,
@@ -219,26 +224,27 @@
       test('FieldDeclaration', () {
         var bar = FieldDeclarationImpl(
           id: RemoteInstance.uniqueId,
-          name: 'bar',
+          identifier: IdentifierImpl(id: RemoteInstance.uniqueId, name: 'bar'),
           isExternal: false,
           isFinal: true,
           isLate: false,
           initializer: null,
           type: barType,
-          definingClass: fooType,
+          definingClass: fooType.identifier,
         );
         expectSerializationEquality(bar);
       });
 
       var objectType = NamedTypeAnnotationImpl(
         id: RemoteInstance.uniqueId,
-        name: 'Object',
+        identifier: IdentifierImpl(id: RemoteInstance.uniqueId, name: 'Object'),
         isNullable: false,
         typeArguments: [],
       );
       var serializableType = NamedTypeAnnotationImpl(
         id: RemoteInstance.uniqueId,
-        name: 'Serializable',
+        identifier:
+            IdentifierImpl(id: RemoteInstance.uniqueId, name: 'Serializable'),
         isNullable: false,
         typeArguments: [],
       );
@@ -246,13 +252,12 @@
       test('ClassDeclaration', () {
         var fooClass = ClassDeclarationImpl(
           id: RemoteInstance.uniqueId,
-          name: 'Foo',
+          identifier: IdentifierImpl(id: RemoteInstance.uniqueId, name: 'Foo'),
           interfaces: [barType],
           isAbstract: true,
           isExternal: false,
           mixins: [serializableType],
           superclass: objectType,
-          type: fooType,
           typeParameters: [zapTypeParam],
         );
         expectSerializationEquality(fooClass);
@@ -261,17 +266,14 @@
       test('TypeAliasDeclaration', () {
         var typeAlias = TypeAliasDeclarationImpl(
           id: RemoteInstance.uniqueId,
-          name: 'FooOfBar',
-          type: NamedTypeAnnotationImpl(
-              id: RemoteInstance.uniqueId,
-              isNullable: false,
-              name: 'FooOfBar',
-              typeArguments: []),
+          identifier:
+              IdentifierImpl(id: RemoteInstance.uniqueId, name: 'FooOfBar'),
           typeParameters: [zapTypeParam],
           aliasedType: NamedTypeAnnotationImpl(
               id: RemoteInstance.uniqueId,
               isNullable: false,
-              name: 'Foo',
+              identifier:
+                  IdentifierImpl(id: RemoteInstance.uniqueId, name: 'Foo'),
               typeArguments: [barType]),
         );
         expectSerializationEquality(typeAlias);
diff --git a/pkg/_fe_analyzer_shared/test/macros/isolate_mirror_executor/isolate_mirror_executor_test.dart b/pkg/_fe_analyzer_shared/test/macros/isolate_mirror_executor/isolate_mirror_executor_test.dart
index 0614b4f..80136bd 100644
--- a/pkg/_fe_analyzer_shared/test/macros/isolate_mirror_executor/isolate_mirror_executor_test.dart
+++ b/pkg/_fe_analyzer_shared/test/macros/isolate_mirror_executor/isolate_mirror_executor_test.dart
@@ -58,7 +58,7 @@
 
     var returnType = NamedTypeAnnotationImpl(
         id: RemoteInstance.uniqueId,
-        name: 'String',
+        identifier: IdentifierImpl(id: RemoteInstance.uniqueId, name: 'String'),
         isNullable: false,
         typeArguments: const []);
     var definitionResult = await executor.executeDefinitionsPhase(
@@ -69,14 +69,16 @@
           isExternal: false,
           isGetter: false,
           isSetter: false,
-          name: 'foo',
+          identifier: IdentifierImpl(id: RemoteInstance.uniqueId, name: 'foo'),
           namedParameters: [],
           positionalParameters: [],
           returnType: returnType,
           typeParameters: [],
         ),
-        TestTypeResolver(
-            {returnType: TestNamedStaticType('dart:core', 'String', [])}),
+        TestTypeResolver({
+          returnType:
+              TestNamedStaticType(returnType.identifier, 'dart:core', [])
+        }),
         FakeClassIntrospector(),
         FakeTypeDeclarationResolver());
     expect(definitionResult.augmentations, hasLength(1));
diff --git a/pkg/_fe_analyzer_shared/test/macros/isolate_mirror_executor/simple_macro.dart b/pkg/_fe_analyzer_shared/test/macros/isolate_mirror_executor/simple_macro.dart
index ff31b12..7972041 100644
--- a/pkg/_fe_analyzer_shared/test/macros/isolate_mirror_executor/simple_macro.dart
+++ b/pkg/_fe_analyzer_shared/test/macros/isolate_mirror_executor/simple_macro.dart
@@ -27,7 +27,7 @@
     }
 
     // Test the type resolver and static type interfaces
-    var staticReturnType = await builder.resolve(method.returnType);
+    var staticReturnType = await builder.instantiateType(method.returnType);
     if (!(await staticReturnType.isExactly(staticReturnType))) {
       throw StateError('The return type should be exactly equal to itself!');
     }
diff --git a/pkg/_fe_analyzer_shared/test/macros/isolated_executor/simple_macro.dart b/pkg/_fe_analyzer_shared/test/macros/isolated_executor/simple_macro.dart
index 40ad337..610c83e 100644
--- a/pkg/_fe_analyzer_shared/test/macros/isolated_executor/simple_macro.dart
+++ b/pkg/_fe_analyzer_shared/test/macros/isolated_executor/simple_macro.dart
@@ -45,7 +45,7 @@
     var fields = await builder.fieldsOf(clazz);
     builder.declareInClass(DeclarationCode.fromParts([
       'static const List<String> fieldNames = [',
-      for (var field in fields) "'${field.name}',",
+      for (var field in fields) "'${field.identifier.name}',",
       '];',
     ]));
   }
@@ -59,10 +59,11 @@
       throw new UnsupportedError(
           'Can only run on constructors with no parameters!');
     }
-    builder.declareInClass(
-        DeclarationCode.fromString('factory ${constructor.definingClass.name}'
-            '.${constructor.name}Delegate() => '
-            '${constructor.definingClass.name}.${constructor.name}();'));
+    var className = constructor.definingClass.name;
+    var constructorName = constructor.identifier.name;
+    builder.declareInClass(DeclarationCode.fromString(
+        'factory $className.${constructorName}Delegate() => '
+        '$className.$constructorName();'));
   }
 
   @override
@@ -74,19 +75,20 @@
       throw new UnsupportedError(
           'Can only run on functions with no parameters!');
     }
+    var functionName = function.identifier.name;
     builder.declareInLibrary(DeclarationCode.fromParts([
-      function.returnType,
+      function.returnType.code,
       if (function.isGetter) ' get' else if (function.isSetter) ' set ',
-      ' delegate${function.name.capitalize().trimEquals()}',
+      ' delegate${functionName.capitalize()}',
       if (!function.isGetter) ...[
         '(',
         if (function.isSetter) ...[
-          function.positionalParameters.first.type,
+          function.positionalParameters.first.type.code,
           ' value',
         ],
         ')',
       ],
-      ' => ${function.name.trimEquals()}',
+      ' => ${functionName}',
       function.isGetter
           ? ''
           : function.isSetter
@@ -103,27 +105,30 @@
         method.namedParameters.isNotEmpty) {
       throw new UnsupportedError('Can only run on method with no parameters!');
     }
+    var methodName = method.identifier.name;
     builder.declareInLibrary(DeclarationCode.fromParts([
-      method.returnType,
-      ' delegateMember${method.name.capitalize()}() => ${method.name}();',
+      method.returnType.code,
+      ' delegateMember${methodName.capitalize()}() => $methodName();',
     ]));
   }
 
   @override
   FutureOr<void> buildDeclarationsForVariable(
       VariableDeclaration variable, DeclarationBuilder builder) {
+    var variableName = variable.identifier.name;
     builder.declareInLibrary(DeclarationCode.fromParts([
-      variable.type,
-      ' get delegate${variable.name.capitalize()} => ${variable.name};',
+      variable.type.code,
+      ' get delegate${variableName.capitalize()} => $variableName;',
     ]));
   }
 
   @override
   FutureOr<void> buildDeclarationsForField(
       FieldDeclaration field, ClassMemberDeclarationBuilder builder) {
+    var fieldName = field.identifier.name;
     builder.declareInClass(DeclarationCode.fromParts([
-      field.type,
-      ' get delegate${field.name.capitalize()} => ${field.name};',
+      field.type.code,
+      ' get delegate${fieldName.capitalize()} => $fieldName;',
     ]));
   }
 
@@ -134,25 +139,24 @@
     var fields = (await builder.fieldsOf(clazz));
     for (var field in fields) {
       await buildDefinitionForField(
-          field, await builder.buildField(field.name));
+          field, await builder.buildField(field.identifier));
     }
     var methods = (await builder.methodsOf(clazz));
     for (var method in methods) {
       await buildDefinitionForMethod(
-          method, await builder.buildMethod(method.name));
+          method, await builder.buildMethod(method.identifier));
     }
     var constructors = (await builder.constructorsOf(clazz));
     for (var constructor in constructors) {
       await buildDefinitionForConstructor(
-          constructor, await builder.buildConstructor(constructor.name));
+          constructor, await builder.buildConstructor(constructor.identifier));
     }
   }
 
   @override
   Future<void> buildDefinitionForConstructor(ConstructorDeclaration constructor,
       ConstructorDefinitionBuilder builder) async {
-    var clazz = await builder.declarationOf(
-            await builder.resolve(constructor.definingClass) as NamedStaticType)
+    var clazz = await builder.declarationOf(constructor.definingClass)
         as ClassDeclaration;
     var fields = (await builder.fieldsOf(clazz));
 
@@ -162,8 +166,8 @@
         for (var field in fields)
           // TODO: Compare against actual `int` type.
           if (field.isFinal &&
-              (field.type as NamedTypeAnnotation).name == 'int')
-            Code.fromString('${field.name} = ${x!}'),
+              (field.type as NamedTypeAnnotation).identifier.name == 'int')
+            Code.fromParts([field.identifier, ' = ${x!}']),
       ],
     );
   }
@@ -184,31 +188,12 @@
       MethodDeclaration method, FunctionDefinitionBuilder builder) async {
     await buildDefinitionForFunction(method, builder);
 
-    // Test the type resolver and static type interfaces
-    var staticReturnType = await builder.resolve(method.returnType);
-    if (!(await staticReturnType.isExactly(staticReturnType))) {
-      throw StateError('The return type should be exactly equal to itself!');
-    }
-    if (!(await staticReturnType.isSubtypeOf(staticReturnType))) {
-      throw StateError('The return type should be a subtype of itself!');
-    }
-    var classType =
-        await builder.resolve(method.definingClass) as NamedStaticType;
-    if (await staticReturnType.isExactly(classType)) {
-      throw StateError(
-          'The return type should not be exactly equal to the class type');
-    }
-    if (await staticReturnType.isSubtypeOf(classType)) {
-      throw StateError(
-          'The return type should not be a subtype of the class type!');
-    }
-
     // Test the type declaration resolver
     var parentClass =
-        await builder.declarationOf(classType) as ClassDeclaration;
+        await builder.declarationOf(method.definingClass) as ClassDeclaration;
     // Should be able to find ourself in the methods of the parent class.
     (await builder.methodsOf(parentClass))
-        .singleWhere((m) => m.name == method.name);
+        .singleWhere((m) => m.identifier == method.identifier);
 
     // Test the class introspector
     var superClass = (await builder.superclassOf(parentClass))!;
@@ -218,18 +203,42 @@
     var methods = (await builder.methodsOf(parentClass));
     var constructors = (await builder.constructorsOf(parentClass));
 
+    // Test the type resolver and static type interfaces
+    var staticReturnType = await builder.instantiateType(method.returnType);
+    if (!(await staticReturnType.isExactly(staticReturnType))) {
+      throw StateError('The return type should be exactly equal to itself!');
+    }
+    if (!(await staticReturnType.isSubtypeOf(staticReturnType))) {
+      throw StateError('The return type should be a subtype of itself!');
+    }
+
+    // TODO: Use `builder.instantiateCode` instead once implemented.
+    var classType =
+        await builder.instantiateType(constructors.first.returnType);
+    if (await staticReturnType.isExactly(classType)) {
+      throw StateError(
+          'The return type should not be exactly equal to the class type');
+    }
+    if (await staticReturnType.isSubtypeOf(classType)) {
+      throw StateError(
+          'The return type should not be a subtype of the class type!');
+    }
+
     builder.augment(FunctionBodyCode.fromParts([
       '''{
       print('x: $x, y: $y');
-      print('parentClass: ${parentClass.name}');
-      print('superClass: ${superClass.name}');''',
+      print('parentClass: ${parentClass.identifier.name}');
+      print('superClass: ${superClass.identifier.name}');''',
       for (var interface in interfaces)
-        "\n      print('interface: ${interface.name}');",
-      for (var mixin in mixins) "\n      print('mixin: ${mixin.name}');",
-      for (var field in fields) "\n      print('field: ${field.name}');",
-      for (var method in methods) "\n      print('method: ${method.name}');",
+        "\n      print('interface: ${interface.identifier.name}');",
+      for (var mixin in mixins)
+        "\n      print('mixin: ${mixin.identifier.name}');",
+      for (var field in fields)
+        "\n      print('field: ${field.identifier.name}');",
+      for (var method in methods)
+        "\n      print('method: ${method.identifier.name}');",
       for (var constructor in constructors)
-        "\n      print('constructor: ${constructor.name}');",
+        "\n      print('constructor: ${constructor.identifier.name}');",
       '''
 \n      return augment super();
     }''',
@@ -243,9 +252,9 @@
         variable is FieldDeclaration ? variable.definingClass.name : '';
     builder.augment(
       getter: DeclarationCode.fromParts([
-        variable.type,
+        variable.type.code,
         ' get ',
-        variable.name,
+        variable.identifier.name,
         ''' {
           print('parentClass: $definingClass');
           print('isExternal: ${variable.isExternal}');
@@ -256,9 +265,9 @@
       ]),
       setter: DeclarationCode.fromParts([
         'set ',
-        variable.name,
+        variable.identifier.name,
         '(',
-        variable.type,
+        variable.type.code,
         ' value) { augment super = value; }'
       ]),
       initializer: variable.initializer,
@@ -272,16 +281,16 @@
         TypeParameterDeclaration typeParam, bool isFirst) {
       return [
         if (!isFirst) ', ',
-        typeParam.name,
+        typeParam.identifier.name,
         if (typeParam.bounds != null) ...[
           ' extends ',
-          typeParam.bounds!,
+          typeParam.bounds!.code,
         ]
       ];
     }
 
     builder.declareType(DeclarationCode.fromParts([
-      'class ${clazz.name}Builder',
+      'class ${clazz.identifier.name}Builder',
       if (clazz.typeParameters.isNotEmpty) ...[
         '<',
         ..._buildTypeParam(clazz.typeParameters.first, true),
@@ -290,11 +299,12 @@
         '>',
       ],
       ' implements Builder<',
-      clazz.type,
+      clazz.identifier,
       if (clazz.typeParameters.isNotEmpty) ...[
         '<',
-        clazz.typeParameters.first,
-        for (var typeParam in clazz.typeParameters) ', ${typeParam.name}',
+        clazz.typeParameters.first.identifier.name,
+        for (var typeParam in clazz.typeParameters)
+          ', ${typeParam.identifier.name}',
         '>',
       ],
       '> {}'
@@ -305,14 +315,14 @@
   FutureOr<void> buildTypesForConstructor(
       ConstructorDeclaration constructor, TypeBuilder builder) {
     builder.declareType(DeclarationCode.fromString(
-        'class GeneratedBy${constructor.name.capitalize()} {}'));
+        'class GeneratedBy${constructor.identifier.name.capitalize()} {}'));
   }
 
   @override
   FutureOr<void> buildTypesForField(
       FieldDeclaration field, TypeBuilder builder) {
     builder.declareType(DeclarationCode.fromString(
-        'class GeneratedBy${field.name.capitalize()} {}'));
+        'class GeneratedBy${field.identifier.name.capitalize()} {}'));
   }
 
   @override
@@ -324,7 +334,7 @@
             ? 'Setter'
             : '';
     builder.declareType(DeclarationCode.fromString(
-        'class GeneratedBy${function.name.capitalize().trimEquals()}'
+        'class GeneratedBy${function.identifier.name.capitalize()}'
         '$suffix {}'));
   }
 
@@ -332,14 +342,14 @@
   FutureOr<void> buildTypesForMethod(
       MethodDeclaration method, TypeBuilder builder) {
     builder.declareType(DeclarationCode.fromString(
-        'class GeneratedBy${method.name.capitalize()} {}'));
+        'class GeneratedBy${method.identifier.name.capitalize()} {}'));
   }
 
   @override
   FutureOr<void> buildTypesForVariable(
       VariableDeclaration variable, TypeBuilder builder) {
     builder.declareType(DeclarationCode.fromString(
-        'class GeneratedBy${variable.name.capitalize()} {}'));
+        'class GeneratedBy${variable.identifier.name.capitalize()} {}'));
   }
 }
 
@@ -356,38 +366,37 @@
       print('isGetter: ${function.isGetter}');
       print('isSetter: ${function.isSetter}');
       print('returnType: ''',
-      function.returnType,
+      function.returnType.code,
       "');\n",
       for (var param in function.positionalParameters) ...[
         "print('positionalParam: ",
-        param.type,
-        ' ${param.name}',
+        param.type.code,
+        ' ${param.identifier.name}',
         if (param.defaultValue != null) ...[' = ', param.defaultValue!],
         "');\n",
       ],
       for (var param in function.namedParameters) ...[
         "print('namedParam: ",
-        param.type,
-        ' ${param.name}',
+        param.type.code,
+        ' ${param.identifier.name}',
         if (param.defaultValue != null) ...[' = ', param.defaultValue!],
         "');\n",
       ],
       for (var param in function.typeParameters) ...[
-        "print('typeParam: ${param.name} ",
-        if (param.bounds != null) param.bounds!,
+        "print('typeParam: ${param.identifier.name} ",
+        if (param.bounds != null) param.bounds!.code,
         "');\n",
       ],
       'return augment super',
-      if (function.isSetter)
-        ' = ${function.positionalParameters.first.name}'
-      else if (!function.isGetter)
-        '()',
+      if (function.isSetter) ...[
+        ' = ',
+        function.positionalParameters.first.identifier,
+      ],
+      if (!function.isGetter && !function.isSetter) '()',
       ''';
     }''',
     ]);
 
 extension _ on String {
   String capitalize() => '${this[0].toUpperCase()}${substring(1)}';
-
-  String trimEquals() => endsWith('=') ? substring(0, length - 1) : this;
 }
diff --git a/pkg/_fe_analyzer_shared/test/macros/util.dart b/pkg/_fe_analyzer_shared/test/macros/util.dart
index b4749fc..831a4f8 100644
--- a/pkg/_fe_analyzer_shared/test/macros/util.dart
+++ b/pkg/_fe_analyzer_shared/test/macros/util.dart
@@ -65,14 +65,14 @@
     implements TypeDeclarationResolver {}
 
 class TestTypeDeclarationResolver implements TypeDeclarationResolver {
-  final Map<NamedStaticType, TypeDeclaration> typeDeclarations;
+  final Map<Identifier, TypeDeclaration> typeDeclarations;
 
   TestTypeDeclarationResolver(this.typeDeclarations);
 
   @override
   Future<TypeDeclaration> declarationOf(
-          covariant NamedStaticType annotation) async =>
-      typeDeclarations[annotation]!;
+          covariant Identifier identifier) async =>
+      typeDeclarations[identifier]!;
 }
 
 class TestTypeResolver implements TypeResolver {
@@ -81,18 +81,25 @@
   TestTypeResolver(this.staticTypes);
 
   @override
-  Future<StaticType> resolve(covariant TypeAnnotation typeAnnotation) async {
+  Future<StaticType> instantiateType(
+      covariant TypeAnnotation typeAnnotation) async {
     return staticTypes[typeAnnotation]!;
   }
+
+  @override
+  Future<StaticType> instantiateCode(ExpressionCode code) {
+    // TODO: implement instantiateCode
+    throw UnimplementedError();
+  }
 }
 
 // Doesn't handle generics etc but thats ok for now
 class TestNamedStaticType implements NamedStaticType {
+  final IdentifierImpl identifier;
   final String library;
-  final String name;
   final List<TestNamedStaticType> superTypes;
 
-  TestNamedStaticType(this.library, this.name, this.superTypes);
+  TestNamedStaticType(this.identifier, this.library, this.superTypes);
 
   @override
   Future<bool> isExactly(TestNamedStaticType other) async => _isExactly(other);
@@ -104,7 +111,7 @@
 
   bool _isExactly(TestNamedStaticType other) =>
       identical(other, this) ||
-      (library == other.library && name == other.name);
+      (library == other.library && identifier.name == other.identifier.name);
 }
 
 extension DebugCodeString on Code {
@@ -113,10 +120,10 @@
     for (var part in parts) {
       if (part is Code) {
         part.debugString(buffer);
-      } else if (part is TypeAnnotation) {
-        part.code.debugString(buffer);
+      } else if (part is IdentifierImpl) {
+        buffer.write(part.name);
       } else {
-        buffer.write(part.toString());
+        buffer.write(part as String);
       }
     }
     return buffer;
@@ -219,19 +226,20 @@
 class Fixtures {
   static final stringType = NamedTypeAnnotationImpl(
       id: RemoteInstance.uniqueId,
-      name: 'String',
+      identifier: IdentifierImpl(id: RemoteInstance.uniqueId, name: 'String'),
       isNullable: false,
       typeArguments: const []);
   static final voidType = NamedTypeAnnotationImpl(
       id: RemoteInstance.uniqueId,
-      name: 'void',
+      identifier: IdentifierImpl(id: RemoteInstance.uniqueId, name: 'void'),
       isNullable: false,
       typeArguments: const []);
 
   // Top level, non-class declarations.
   static final myFunction = FunctionDeclarationImpl(
       id: RemoteInstance.uniqueId,
-      name: 'myFunction',
+      identifier:
+          IdentifierImpl(id: RemoteInstance.uniqueId, name: 'myFunction'),
       isAbstract: false,
       isExternal: false,
       isGetter: false,
@@ -242,7 +250,8 @@
       typeParameters: []);
   static final myVariable = VariableDeclarationImpl(
       id: RemoteInstance.uniqueId,
-      name: '_myVariable',
+      identifier:
+          IdentifierImpl(id: RemoteInstance.uniqueId, name: '_myVariable'),
       initializer: ExpressionCode.fromString("''"),
       isExternal: false,
       isFinal: true,
@@ -250,7 +259,8 @@
       type: stringType);
   static final myVariableGetter = FunctionDeclarationImpl(
       id: RemoteInstance.uniqueId,
-      name: 'myVariable',
+      identifier:
+          IdentifierImpl(id: RemoteInstance.uniqueId, name: 'myVariable'),
       isAbstract: false,
       isExternal: false,
       isGetter: true,
@@ -261,7 +271,8 @@
       typeParameters: []);
   static final myVariableSetter = FunctionDeclarationImpl(
       id: RemoteInstance.uniqueId,
-      name: 'myVariable=',
+      identifier:
+          IdentifierImpl(id: RemoteInstance.uniqueId, name: 'myVariable'),
       isAbstract: false,
       isExternal: false,
       isGetter: false,
@@ -270,7 +281,8 @@
       positionalParameters: [
         ParameterDeclarationImpl(
             id: RemoteInstance.uniqueId,
-            name: 'value',
+            identifier:
+                IdentifierImpl(id: RemoteInstance.uniqueId, name: 'value'),
             defaultValue: null,
             isNamed: false,
             isRequired: true,
@@ -282,28 +294,29 @@
   // Class and member declarations
   static final myInterfaceType = NamedTypeAnnotationImpl(
       id: RemoteInstance.uniqueId,
-      name: 'MyInterface',
+      identifier:
+          IdentifierImpl(id: RemoteInstance.uniqueId, name: 'MyInterface'),
       isNullable: false,
       typeArguments: const []);
   static final myMixinType = NamedTypeAnnotationImpl(
       id: RemoteInstance.uniqueId,
-      name: 'MyMixin',
+      identifier: IdentifierImpl(id: RemoteInstance.uniqueId, name: 'MyMixin'),
       isNullable: false,
       typeArguments: const []);
   static final mySuperclassType = NamedTypeAnnotationImpl(
       id: RemoteInstance.uniqueId,
-      name: 'MySuperclass',
+      identifier:
+          IdentifierImpl(id: RemoteInstance.uniqueId, name: 'MySuperclass'),
       isNullable: false,
       typeArguments: const []);
   static final myClassType = NamedTypeAnnotationImpl(
       id: RemoteInstance.uniqueId,
-      name: 'MyClass',
+      identifier: IdentifierImpl(id: RemoteInstance.uniqueId, name: 'MyClass'),
       isNullable: false,
       typeArguments: const []);
   static final myClass = ClassDeclarationImpl(
       id: RemoteInstance.uniqueId,
-      name: myClassType.name,
-      type: myClassType,
+      identifier: myClassType.identifier,
       typeParameters: [],
       interfaces: [myInterfaceType],
       isAbstract: false,
@@ -312,7 +325,8 @@
       superclass: mySuperclassType);
   static final myConstructor = ConstructorDeclarationImpl(
       id: RemoteInstance.uniqueId,
-      name: 'myConstructor',
+      identifier:
+          IdentifierImpl(id: RemoteInstance.uniqueId, name: 'myConstructor'),
       isAbstract: false,
       isExternal: false,
       isGetter: false,
@@ -321,21 +335,20 @@
       positionalParameters: [],
       returnType: myClassType,
       typeParameters: [],
-      definingClass: myClassType,
+      definingClass: myClassType.identifier,
       isFactory: false);
   static final myField = FieldDeclarationImpl(
       id: RemoteInstance.uniqueId,
-      name: 'myField',
+      identifier: IdentifierImpl(id: RemoteInstance.uniqueId, name: 'myField'),
       initializer: null,
       isExternal: false,
       isFinal: false,
       isLate: false,
       type: stringType,
-      definingClass: myClassType);
+      definingClass: myClassType.identifier);
   static final myInterface = ClassDeclarationImpl(
       id: RemoteInstance.uniqueId,
-      name: myInterfaceType.name,
-      type: myInterfaceType,
+      identifier: myInterfaceType.identifier,
       typeParameters: [],
       interfaces: [],
       isAbstract: false,
@@ -344,7 +357,7 @@
       superclass: null);
   static final myMethod = MethodDeclarationImpl(
       id: RemoteInstance.uniqueId,
-      name: 'myMethod',
+      identifier: IdentifierImpl(id: RemoteInstance.uniqueId, name: 'myMethod'),
       isAbstract: false,
       isExternal: false,
       isGetter: false,
@@ -353,11 +366,10 @@
       positionalParameters: [],
       returnType: stringType,
       typeParameters: [],
-      definingClass: myClassType);
+      definingClass: myClassType.identifier);
   static final myMixin = ClassDeclarationImpl(
       id: RemoteInstance.uniqueId,
-      name: myMixinType.name,
-      type: myMixinType,
+      identifier: myMixinType.identifier,
       typeParameters: [],
       interfaces: [],
       isAbstract: false,
@@ -366,8 +378,7 @@
       superclass: null);
   static final mySuperclass = ClassDeclarationImpl(
       id: RemoteInstance.uniqueId,
-      name: mySuperclassType.name,
-      type: mySuperclassType,
+      identifier: mySuperclassType.identifier,
       typeParameters: [],
       interfaces: [],
       isAbstract: false,
@@ -376,10 +387,10 @@
       superclass: null);
 
   static final myClassStaticType = TestNamedStaticType(
-      'package:my_package/my_package.dart', myClassType.name, []);
+      myClassType.identifier, 'package:my_package/my_package.dart', []);
 
   static final testTypeResolver = TestTypeResolver({
-    stringType: TestNamedStaticType('dart:core', stringType.name, []),
+    stringType: TestNamedStaticType(stringType.identifier, 'dart:core', []),
     myClassType: myClassStaticType,
   });
   static final testClassIntrospector = TestClassIntrospector(
@@ -403,5 +414,5 @@
     },
   );
   static final testTypeDeclarationResolver =
-      TestTypeDeclarationResolver({myClassStaticType: myClass});
+      TestTypeDeclarationResolver({myClass.identifier: myClass});
 }
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_initialize.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_initialize.dart
index 146b2c1..290bdc4 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/handler_initialize.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_initialize.dart
@@ -29,7 +29,7 @@
       params.initializationOptions,
     );
 
-    final openWorkspacePaths = <String>[];
+    final unnormalisedWorkspacePaths = <String>[];
     final workspaceFolders = params.workspaceFolders;
     final rootUri = params.rootUri;
     final rootPath = params.rootPath;
@@ -43,23 +43,30 @@
           // Only file URIs are supported, but there's no way to signal this to
           // the LSP client (and certainly not before initialization).
           if (uri.isScheme('file')) {
-            openWorkspacePaths.add(uri.toFilePath());
+            unnormalisedWorkspacePaths.add(uri.toFilePath());
           }
         });
       }
       if (rootUri != null) {
         final uri = Uri.parse(rootUri);
         if (uri.isScheme('file')) {
-          openWorkspacePaths.add(uri.toFilePath());
+          unnormalisedWorkspacePaths.add(uri.toFilePath());
         }
       } else if (rootPath != null) {
-        openWorkspacePaths.add(rootPath);
+        unnormalisedWorkspacePaths.add(rootPath);
       }
     }
 
+    final pathContext = server.resourceProvider.pathContext;
+    // Normalise all potential workspace folder paths as these may contain
+    // trailing slashes (the LSP spec does not specific if folders
+    // should/should not have them) and the analysis roots must be normalized.
+    final workspacePaths =
+        unnormalisedWorkspacePaths.map(pathContext.normalize).toList();
+
     server.messageHandler = InitializingStateMessageHandler(
       server,
-      openWorkspacePaths,
+      workspacePaths,
     );
 
     final capabilities = server.capabilitiesComputer
diff --git a/pkg/analysis_server/test/lsp/file_modification_test.dart b/pkg/analysis_server/test/lsp/file_modification_test.dart
index 17ecd10..10c4323 100644
--- a/pkg/analysis_server/test/lsp/file_modification_test.dart
+++ b/pkg/analysis_server/test/lsp/file_modification_test.dart
@@ -19,7 +19,10 @@
 class FileModificationTest extends AbstractLspAnalysisServerTest {
   Future<void> test_change_badPosition() async {
     final contents = '';
-    await initialize();
+    await initialize(
+      // Error is expected and checked below.
+      failTestOnAnyErrorNotification: false,
+    );
     await openFile(mainFileUri, contents);
 
     // Since this is a notification and not a request, the server cannot
@@ -86,7 +89,10 @@
           end: Position(line: 1, character: 1)),
       text: 'test',
     ));
-    await initialize();
+    await initialize(
+      // Error is expected and checked below.
+      failTestOnAnyErrorNotification: false,
+    );
     final notificationParams = await expectErrorNotification(
       () => changeFile(222, mainFileUri, [simpleEdit]),
     );
@@ -131,7 +137,10 @@
   }
 
   Future<void> test_open_invalidPath() async {
-    await initialize();
+    await initialize(
+      // Error is expected and checked below.
+      failTestOnAnyErrorNotification: false,
+    );
 
     final notificationParams = await expectErrorNotification(
       () => openFile(Uri.http('localhost', 'not-a-file'), ''),
diff --git a/pkg/analysis_server/test/lsp/initialization_test.dart b/pkg/analysis_server/test/lsp/initialization_test.dart
index 413afeb..5cf681a 100644
--- a/pkg/analysis_server/test/lsp/initialization_test.dart
+++ b/pkg/analysis_server/test/lsp/initialization_test.dart
@@ -673,21 +673,41 @@
     expect(server.contextManager.includedPaths, equals([projectFolderPath]));
   }
 
+  Future<void> test_initialize_rootPath_trailingSlash() async {
+    await initialize(rootPath: withTrailingSlash(projectFolderPath));
+    expect(server.contextManager.includedPaths, equals([projectFolderPath]));
+  }
+
   Future<void> test_initialize_rootUri() async {
     await initialize(rootUri: projectFolderUri);
     expect(server.contextManager.includedPaths, equals([projectFolderPath]));
   }
 
+  Future<void> test_initialize_rootUri_trailingSlash() async {
+    await initialize(rootUri: withTrailingSlashUri(projectFolderUri));
+    expect(server.contextManager.includedPaths, equals([projectFolderPath]));
+  }
+
   Future<void> test_initialize_workspaceFolders() async {
     await initialize(workspaceFolders: [projectFolderUri]);
     expect(server.contextManager.includedPaths, equals([projectFolderPath]));
   }
 
+  Future<void> test_initialize_workspaceFolders_trailingSlash() async {
+    await initialize(
+        workspaceFolders: [withTrailingSlashUri(projectFolderUri)]);
+    expect(server.contextManager.includedPaths, equals([projectFolderPath]));
+  }
+
   Future<void> test_nonFileScheme_rootUri() async {
     final rootUri = Uri.parse('vsls://');
     final fileUri = rootUri.replace(path: '/file1.dart');
 
-    await initialize(rootUri: rootUri);
+    await initialize(
+      rootUri: rootUri,
+      // We expect an error notification about the invalid file we try to open.
+      failTestOnAnyErrorNotification: false,
+    );
     expect(server.contextManager.includedPaths, equals([]));
 
     // Also open a non-file file to ensure it doesn't cause the root to be added.
@@ -702,10 +722,14 @@
     final rootUri = Uri.parse('vsls://');
     final fileUri = rootUri.replace(path: '/file1.dart');
 
-    await initialize(workspaceFolders: [
-      rootUri,
-      Uri.file(projectFolderPath),
-    ]);
+    await initialize(
+      workspaceFolders: [
+        rootUri,
+        Uri.file(projectFolderPath),
+      ],
+      // We expect an error notification about the invalid file we try to open.
+      failTestOnAnyErrorNotification: false,
+    );
     expect(server.contextManager.includedPaths, equals([projectFolderPath]));
 
     // Also open a non-file file to ensure it doesn't cause the root to be added.
@@ -876,4 +900,15 @@
     expect(response.error, isNotNull);
     expect(response.error!.code, ErrorCodes.ServerNotInitialized);
   }
+
+  String withTrailingSlash(String path) {
+    expect(path, isNot(endsWith('/')));
+    final pathSeparator = server.resourceProvider.pathContext.separator;
+    return '$path$pathSeparator';
+  }
+
+  Uri withTrailingSlashUri(Uri uri) {
+    expect(uri.path, isNot(endsWith('/')));
+    return uri.replace(path: '${uri.path}/');
+  }
 }
diff --git a/pkg/analysis_server/test/lsp/server_abstract.dart b/pkg/analysis_server/test/lsp/server_abstract.dart
index 4bc57a0..01da792 100644
--- a/pkg/analysis_server/test/lsp/server_abstract.dart
+++ b/pkg/analysis_server/test/lsp/server_abstract.dart
@@ -1366,7 +1366,14 @@
     Map<String, Object?>? initializationOptions,
     bool throwOnFailure = true,
     bool allowEmptyRootUri = false,
+    bool failTestOnAnyErrorNotification = true,
   }) async {
+    if (failTestOnAnyErrorNotification) {
+      errorNotificationsFromServer.listen((NotificationMessage error) {
+        fail('${error.toJson()}');
+      });
+    }
+
     final clientCapabilities = ClientCapabilities(
       workspace: workspaceCapabilities,
       textDocument: textDocumentCapabilities,
diff --git a/pkg/analysis_server/test/lsp/server_test.dart b/pkg/analysis_server/test/lsp/server_test.dart
index c5508eb..22608c0 100644
--- a/pkg/analysis_server/test/lsp/server_test.dart
+++ b/pkg/analysis_server/test/lsp/server_test.dart
@@ -18,7 +18,10 @@
 @reflectiveTest
 class ServerTest extends AbstractLspAnalysisServerTest {
   Future<void> test_inconsistentStateError() async {
-    await initialize();
+    await initialize(
+      // Error is expected and checked below.
+      failTestOnAnyErrorNotification: false,
+    );
     await openFile(mainFileUri, '');
     // Attempt to make an illegal modification to the file. This indicates the
     // client and server are out of sync and we expect the server to shut down.
@@ -53,7 +56,10 @@
   }
 
   Future<void> test_unknownNotifications_logError() async {
-    await initialize();
+    await initialize(
+      // Error is expected and checked below.
+      failTestOnAnyErrorNotification: false,
+    );
 
     final notification =
         makeNotification(Method.fromJson(r'some/randomNotification'), null);
diff --git a/pkg/analysis_server/tool/code_completion/completion_metrics.dart b/pkg/analysis_server/tool/code_completion/completion_metrics.dart
index 06e0298..7007b15 100644
--- a/pkg/analysis_server/tool/code_completion/completion_metrics.dart
+++ b/pkg/analysis_server/tool/code_completion/completion_metrics.dart
@@ -306,6 +306,9 @@
   /// run.
   final bool availableSuggestions;
 
+  /// A flag indicating whether the new protocol should be used for this run.
+  final bool useNewProtocol;
+
   /// The function to be executed when this metrics collector is enabled.
   final void Function()? enableFunction;
 
@@ -375,9 +378,11 @@
 
   CompletionMetrics(this.name,
       {required this.availableSuggestions,
+      this.useNewProtocol = false,
       this.enableFunction,
       this.disableFunction})
-      : userTag = UserTag(name);
+      : assert(!(availableSuggestions && useNewProtocol)),
+        userTag = UserTag(name);
 
   /// Return an instance extracted from the decoded JSON [map].
   factory CompletionMetrics.fromJson(Map<String, dynamic> map) {
@@ -694,19 +699,23 @@
     // To compare two or more changes to completions, add a `CompletionMetrics`
     // object with enable and disable functions to the list of `targetMetrics`.
     targetMetrics.add(CompletionMetrics('shipping',
-        availableSuggestions: false,
+        availableSuggestions: true,
         enableFunction: null,
         disableFunction: null));
 
     // To compare two or more relevance tables, uncomment the line below and
     // add the `RelevanceTables` to the list. The default relevance tables
     // should not be included in the list.
-//     compareRelevanceTables([], availableSuggestions: false);
+//    compareRelevanceTables([], availableSuggestions: false);
 
     // To compare the relative benefit from each of the features, uncomment the
     // line below.
 //    compareIndividualFeatures(availableSuggestions: false);
 
+    // To compare the new protocol to the old, uncomment the lines below.
+//    targetMetrics.add(CompletionMetrics('new protocol',
+//        availableSuggestions: false, useNewProtocol: true));
+
     final collection = AnalysisContextCollectionImpl(
       includedPaths: [rootPath],
       resourceProvider: PhysicalResourceProvider.INSTANCE,
@@ -1201,17 +1210,18 @@
       OperationPerformanceImpl performance,
       DartCompletionRequest dartRequest,
       [DeclarationsTracker? declarationsTracker,
-      protocol.CompletionAvailableSuggestionsParams?
-          availableSuggestionsParams]) async {
+      protocol.CompletionAvailableSuggestionsParams? availableSuggestionsParams,
+      NotImportedSuggestions? notImportedSuggestions]) async {
     List<protocol.CompletionSuggestion> suggestions;
 
     var budget = CompletionBudget(Duration(seconds: 30));
     if (declarationsTracker == null) {
       // available suggestions == false
       suggestions = await DartCompletionManager(
-        budget: budget,
-        listener: listener,
-      ).computeSuggestions(dartRequest, performance);
+              budget: budget,
+              listener: listener,
+              notImportedSuggestions: notImportedSuggestions)
+          .computeSuggestions(dartRequest, performance);
     } else {
       // available suggestions == true
       var includedElementKinds = <protocol.ElementKind>{};
@@ -1382,6 +1392,7 @@
             request,
             metrics.availableSuggestions ? declarationsTracker : null,
             metrics.availableSuggestions ? availableSuggestionsParams : null,
+            metrics.useNewProtocol ? NotImportedSuggestions() : null,
           );
           stopwatch.stop();
 
@@ -1903,7 +1914,7 @@
     0.0
   ];
 
-  Map<protocol.CompletionSuggestion, List<double>> featureMap = {};
+  Map<protocol.CompletionSuggestion, List<double>> featureMap = Map.identity();
 
   List<double> cachedFeatures = noFeatures;
 
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart
index be0762c..165e57f 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -223,12 +223,7 @@
   /// Whether resolved units should be indexed.
   final bool enableIndex;
 
-  /// The current analysis session.
-  late final AnalysisSessionImpl _currentSession = AnalysisSessionImpl(this);
-
-  /// The current library context, consistent with the [_currentSession].
-  ///
-  /// TODO(scheglov) We probably should tie it into the session.
+  /// The context in which libraries should be analyzed.
   LibraryContext? _libraryContext;
 
   /// Whether `dart:core` has been transitively discovered.
@@ -311,7 +306,9 @@
   AnalysisOptions get analysisOptions => _analysisOptions;
 
   /// Return the current analysis session.
-  AnalysisSessionImpl get currentSession => _currentSession;
+  AnalysisSessionImpl get currentSession {
+    return libraryContext.elementFactory.analysisSession;
+  }
 
   /// Return the stream that produces [ExceptionResult]s.
   Stream<ExceptionResult> get exceptions => _exceptionController.stream;
@@ -337,7 +334,7 @@
   LibraryContext get libraryContext {
     return _libraryContext ??= LibraryContext(
       testView: _testView.libraryContextTestView,
-      session: currentSession,
+      analysisSession: AnalysisSessionImpl(this),
       logger: _logger,
       byteStore: _byteStore,
       analysisOptions: _analysisOptions,
@@ -515,9 +512,7 @@
   /// periodically.
   @visibleForTesting
   void clearLibraryContext() {
-    _libraryContext?.invalidAllLibraries();
     _libraryContext = null;
-    _currentSession.clearHierarchies();
   }
 
   /// Some state on which analysis depends has changed, so the driver needs to be
@@ -654,7 +649,7 @@
 
     FileState file = _fileTracker.getFile(path);
     return FileResultImpl(
-        _currentSession, path, file.uri, file.lineInfo, file.isPart);
+        currentSession, path, file.uri, file.lineInfo, file.isPart);
   }
 
   /// Return the [FileResult] for the Dart file with the given [path].
@@ -1328,7 +1323,7 @@
       declaredVariables,
       sourceFactory,
       libraryContext.elementFactory.libraryOfUri2(library.uriStr),
-      libraryContext.analysisSession.inheritanceManager,
+      libraryContext.elementFactory.analysisSession.inheritanceManager,
       library,
       testingData: testingData,
     ).analyzeForCompletion(
@@ -1441,7 +1436,7 @@
           declaredVariables,
           sourceFactory,
           libraryContext.elementFactory.libraryOfUri2(library.uriStr),
-          libraryContext.analysisSession.inheritanceManager,
+          libraryContext.elementFactory.analysisSession.inheritanceManager,
           library,
           testingData: testingData,
         ).analyze();
@@ -1512,7 +1507,7 @@
               declaredVariables,
               sourceFactory,
               libraryContext.elementFactory.libraryOfUri2(library.uriStr),
-              libraryContext.analysisSession.inheritanceManager,
+              libraryContext.elementFactory.analysisSession.inheritanceManager,
               library,
               testingData: testingData)
           .analyze();
@@ -1779,6 +1774,10 @@
     _libraryContext?.elementFactory.removeLibraries(
       affected.map((e) => e.uriStr).toSet(),
     );
+
+    _libraryContext?.elementFactory.replaceAnalysisSession(
+      AnalysisSessionImpl(this),
+    );
   }
 
   void _reportException(String path, Object exception, StackTrace stackTrace) {
diff --git a/pkg/analyzer/lib/src/dart/analysis/library_context.dart b/pkg/analyzer/lib/src/dart/analysis/library_context.dart
index 4795da1..c9ee80d 100644
--- a/pkg/analyzer/lib/src/dart/analysis/library_context.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/library_context.dart
@@ -39,8 +39,6 @@
   final LibraryContextTestView testView;
   final PerformanceLog logger;
   final ByteStore byteStore;
-  final AnalysisSessionImpl analysisSession;
-  final SummaryDataStore? externalSummaries;
   final SummaryDataStore store = SummaryDataStore([]);
 
   late final AnalysisContextImpl analysisContext;
@@ -48,21 +46,35 @@
 
   LibraryContext({
     required this.testView,
-    required AnalysisSessionImpl session,
+    required AnalysisSessionImpl analysisSession,
     required PerformanceLog logger,
     required ByteStore byteStore,
     required AnalysisOptionsImpl analysisOptions,
     required DeclaredVariables declaredVariables,
     required SourceFactory sourceFactory,
-    required this.externalSummaries,
+    required SummaryDataStore? externalSummaries,
   })  : logger = logger,
-        byteStore = byteStore,
-        analysisSession = session {
+        byteStore = byteStore {
     var synchronousSession =
         SynchronousSession(analysisOptions, declaredVariables);
     analysisContext = AnalysisContextImpl(synchronousSession, sourceFactory);
 
-    _createElementFactory();
+    elementFactory = LinkedElementFactory(
+      analysisContext,
+      analysisSession,
+      Reference.root(),
+    );
+    if (externalSummaries != null) {
+      for (var bundle in externalSummaries.bundles) {
+        elementFactory.addBundle(
+          BundleReader(
+            elementFactory: elementFactory,
+            resolutionBytes: bundle.resolutionBytes,
+            unitsInformativeBytes: {},
+          ),
+        );
+      }
+    }
   }
 
   /// Computes a [CompilationUnitElement] for the given library/unit pair.
@@ -86,11 +98,6 @@
     return elementFactory.libraryOfUriIfReady(uriStr);
   }
 
-  /// We are about to discard this context, mark all libraries invalid.
-  void invalidAllLibraries() {
-    elementFactory.invalidateAllLibraries();
-  }
-
   /// Load data required to access elements of the given [targetLibrary].
   void load2(FileState targetLibrary) {
     timerLoad2.start();
@@ -222,25 +229,6 @@
     timerLoad2.stop();
   }
 
-  void _createElementFactory() {
-    elementFactory = LinkedElementFactory(
-      analysisContext,
-      analysisSession,
-      Reference.root(),
-    );
-    if (externalSummaries != null) {
-      for (var bundle in externalSummaries!.bundles) {
-        elementFactory.addBundle(
-          BundleReader(
-            elementFactory: elementFactory,
-            resolutionBytes: bundle.resolutionBytes,
-            unitsInformativeBytes: {},
-          ),
-        );
-      }
-    }
-  }
-
   /// Ensure that type provider is created.
   void _createElementFactoryTypeProvider() {
     if (!analysisContext.hasTypeProvider) {
diff --git a/pkg/analyzer/lib/src/dart/constant/evaluation.dart b/pkg/analyzer/lib/src/dart/constant/evaluation.dart
index 514d859..72131f5 100644
--- a/pkg/analyzer/lib/src/dart/constant/evaluation.dart
+++ b/pkg/analyzer/lib/src/dart/constant/evaluation.dart
@@ -101,6 +101,17 @@
                 [dartObject.type, constant.type]);
           }
         }
+
+        if (dartObject != null) {
+          var enumConstant = _enumConstant(constant);
+          if (enumConstant != null) {
+            dartObject.updateEnumConstant(
+              index: enumConstant.index,
+              name: enumConstant.name,
+            );
+          }
+        }
+
         constant.evaluationResult =
             EvaluationResultImpl(dartObject, errorListener.errors);
       }
@@ -361,6 +372,21 @@
     return redirectedConstructor;
   }
 
+  static _EnumConstant? _enumConstant(VariableElementImpl element) {
+    if (element is ConstFieldElementImpl && element.isEnumConstant) {
+      var enum_ = element.enclosingElement;
+      if (enum_ is EnumElementImpl) {
+        var index = enum_.constants.indexOf(element);
+        assert(index >= 0);
+        return _EnumConstant(
+          index: index,
+          name: element.name,
+        );
+      }
+    }
+    return null;
+  }
+
   static DartObjectImpl _nullObject(LibraryElementImpl library) {
     return DartObjectImpl(
       library.typeSystem,
@@ -1917,6 +1943,16 @@
   }
 }
 
+class _EnumConstant {
+  final int index;
+  final String name;
+
+  _EnumConstant({
+    required this.index,
+    required this.name,
+  });
+}
+
 /// The result of evaluation the initializers declared on a const constructor.
 class _InitializersEvaluationResult {
   /// The result of a const evaluation of an initializer, if one was performed,
diff --git a/pkg/analyzer/lib/src/dart/constant/value.dart b/pkg/analyzer/lib/src/dart/constant/value.dart
index b6c4de1..ef76c24 100644
--- a/pkg/analyzer/lib/src/dart/constant/value.dart
+++ b/pkg/analyzer/lib/src/dart/constant/value.dart
@@ -932,6 +932,24 @@
     );
   }
 
+  /// Set the `index` and `_name` fields for this enum constant.
+  void updateEnumConstant({
+    required int index,
+    required String name,
+  }) {
+    var fields = _state.fields!;
+    fields['index'] = DartObjectImpl(
+      _typeSystem,
+      _typeSystem.typeProvider.intType,
+      IntState(index),
+    );
+    fields['_name'] = DartObjectImpl(
+      _typeSystem,
+      _typeSystem.typeProvider.stringType,
+      StringState(name),
+    );
+  }
+
   /// Throw an exception if the given [object]'s state does not represent a Type
   /// value.
   void _assertType(DartObjectImpl object) {
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index 0966306..b79c1a0 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -3586,13 +3586,7 @@
   final AnalysisContext context;
 
   @override
-  final AnalysisSession session;
-
-  /// If `true`, then this library is valid in the session.
-  ///
-  /// A library becomes invalid when one of its files, or one of its
-  /// dependencies, changes.
-  bool isValid = true;
+  AnalysisSession session;
 
   /// The language version for the library.
   LibraryLanguageVersion? _languageVersion;
diff --git a/pkg/analyzer/lib/src/generated/declaration_resolver.dart b/pkg/analyzer/lib/src/generated/declaration_resolver.dart
index 19b68b9..650fde4 100644
--- a/pkg/analyzer/lib/src/generated/declaration_resolver.dart
+++ b/pkg/analyzer/lib/src/generated/declaration_resolver.dart
@@ -4,7 +4,6 @@
 
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/src/dart/element/element.dart';
-import 'package:analyzer/src/dart/element/extensions.dart';
 
 /// Keeps track of the set of non-synthetic child elements of an element,
 /// yielding them one at a time in response to "get" method calls.
@@ -68,9 +67,7 @@
   ElementWalker.forExecutable(ExecutableElement element)
       : element = element,
         _functions = const <ExecutableElement>[],
-        _parameters = element.isEnumConstructor
-            ? element.parameters.skip(2).toList()
-            : element.parameters,
+        _parameters = element.parameters,
         _typeParameters = element.typeParameters;
 
   /// Creates an [ElementWalker] which walks the child elements of an extension
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index 9176c6e..6746259 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -1976,9 +1976,11 @@
   /// [CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_MIXIN_WITH_FIELD].
   bool _checkForConstConstructorWithNonConstSuper(
       ConstructorDeclaration constructor) {
-    if (!_enclosingExecutable.isConstConstructor) {
+    var enclosingClass = _enclosingClass;
+    if (enclosingClass == null || !_enclosingExecutable.isConstConstructor) {
       return false;
     }
+
     // OK, const factory, checked elsewhere
     if (constructor.factoryKeyword != null) {
       return false;
@@ -1986,7 +1988,7 @@
 
     // check for mixins
     var instanceFields = <FieldElement>[];
-    for (var mixin in _enclosingClass!.mixins) {
+    for (var mixin in enclosingClass.mixins) {
       instanceFields.addAll(mixin.element.fields.where((field) {
         if (field.isStatic) {
           return false;
@@ -2022,6 +2024,11 @@
       return true;
     }
 
+    // Enum(s) always call a const super-constructor.
+    if (enclosingClass.isEnum) {
+      return false;
+    }
+
     // try to find and check super constructor invocation
     for (ConstructorInitializer initializer in constructor.initializers) {
       if (initializer is SuperConstructorInvocation) {
@@ -2037,7 +2044,7 @@
       }
     }
     // no explicit super constructor invocation, check default constructor
-    var supertype = _enclosingClass!.supertype;
+    var supertype = enclosingClass.supertype;
     if (supertype == null) {
       return false;
     }
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index d7284f2..5820062 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -1558,7 +1558,7 @@
           argumentList.correspondingStaticParameters =
               ResolverVisitor.resolveArgumentsToParameters(
             argumentList: argumentList,
-            parameters: constructor.parameters.skip(2).toList(),
+            parameters: constructor.parameters,
           );
           for (var argument in argumentList.arguments) {
             var parameter = argument.staticParameterElement;
diff --git a/pkg/analyzer/lib/src/summary2/element_builder.dart b/pkg/analyzer/lib/src/summary2/element_builder.dart
index e201c44..667c275 100644
--- a/pkg/analyzer/lib/src/summary2/element_builder.dart
+++ b/pkg/analyzer/lib/src/summary2/element_builder.dart
@@ -214,22 +214,6 @@
     var reference = _enclosingContext.addEnum(name, element);
     _libraryBuilder.localScope.declare(name, reference);
 
-    var usedNames = <String>{
-      ...node.constants.map((e) => e.name.name),
-    };
-
-    String generateUniqueName(String base) {
-      if (usedNames.add(base)) {
-        return base;
-      }
-      for (var index = 2;; index++) {
-        var name = '$base$index';
-        if (usedNames.add(name)) {
-          return name;
-        }
-      }
-    }
-
     var holder = _EnclosingContext(
       reference,
       element,
@@ -278,14 +262,6 @@
         astFactory.argumentList(
           Tokens.openParenthesis(),
           [
-            astFactory.integerLiteral(
-              StringToken(TokenType.STRING, '$i', 0),
-              i,
-            ),
-            astFactory.simpleStringLiteral(
-              StringToken(TokenType.STRING, "'$name'", 0),
-              name,
-            ),
             ...?constant.arguments?.argumentList.arguments,
           ],
           Tokens.closeParenthesis(),
@@ -374,48 +350,17 @@
       ..isSynthetic = true;
     holder.addNonSyntheticField(indexField);
 
-    // Build the 'name' field.
-    var nameField = ConstFieldElementImpl(generateUniqueName('_name'), -1)
-      ..isFinal = true
-      ..isSynthetic = true;
-    holder.addNonSyntheticField(nameField);
-
     _withEnclosing(holder, () {
       node.typeParameters?.accept(this);
       _visitPropertyFirst<FieldDeclaration>(node.members);
     });
 
-    FieldFormalParameterElementImpl newConstructorIndexParameter() {
-      return FieldFormalParameterElementImpl(
-        name: 'index',
-        nameOffset: -1,
-        parameterKind: ParameterKind.REQUIRED,
-      )..field = indexField;
-    }
-
-    FieldFormalParameterElementImpl newConstructorNameParameter() {
-      return FieldFormalParameterElementImpl(
-        name: nameField.name,
-        nameOffset: -1,
-        parameterKind: ParameterKind.REQUIRED,
-      )..field = nameField;
-    }
-
     if (needsImplicitConstructor) {
       holder.addConstructor(
         ConstructorElementImpl('', -1)
           ..isConst = true
-          ..isSynthetic = true
-          ..parameters = [
-            newConstructorIndexParameter(),
-            newConstructorNameParameter(),
-          ],
+          ..isSynthetic = true,
       );
-    } else {
-      for (var constructor in holder.constructors) {
-        constructor.parameters.insert(0, newConstructorIndexParameter());
-        constructor.parameters.insert(1, newConstructorNameParameter());
-      }
     }
 
     MethodElementImpl? syntheticToStringMethod;
@@ -429,7 +374,6 @@
       ImplicitEnumNodes(
         element: element,
         indexField: indexField,
-        nameField: nameField,
         valuesTypeNode: valuesTypeNode,
         valuesField: valuesField,
         syntheticToStringMethod: syntheticToStringMethod,
diff --git a/pkg/analyzer/lib/src/summary2/informative_data.dart b/pkg/analyzer/lib/src/summary2/informative_data.dart
index c7f58df..1d68050 100644
--- a/pkg/analyzer/lib/src/summary2/informative_data.dart
+++ b/pkg/analyzer/lib/src/summary2/informative_data.dart
@@ -242,9 +242,8 @@
 
   void _applyToConstructors(
     List<ConstructorElement> elementList,
-    List<_InfoConstructorDeclaration> infoList, {
-    bool ofEnum = false,
-  }) {
+    List<_InfoConstructorDeclaration> infoList,
+  ) {
     forCorrespondingPairs<ConstructorElement, _InfoConstructorDeclaration>(
       elementList,
       infoList,
@@ -256,9 +255,8 @@
         element.nameEnd = info.nameEnd;
         element.documentationComment = info.documentationComment;
 
-        var formalParameters = element.parameters_unresolved;
         _applyToFormalParameters(
-          ofEnum ? formalParameters.skip(2).toList() : formalParameters,
+          element.parameters_unresolved,
           info.parameters,
         );
 
@@ -288,7 +286,7 @@
       element.typeParameters_unresolved,
       info.typeParameters,
     );
-    _applyToConstructors(element.constructors, info.constructors, ofEnum: true);
+    _applyToConstructors(element.constructors, info.constructors);
     _applyToFields(element.fields, info.fields);
     _applyToAccessors(element.accessors, info.accessors);
     _applyToMethods(element.methods, info.methods);
@@ -1743,9 +1741,7 @@
     var initializer = element.constantInitializer;
     if (initializer is InstanceCreationExpression) {
       initializer.constructorName.type2.typeArguments?.accept(this);
-      var arguments = initializer.argumentList.arguments;
-      // Skip synthetic `index` and `name` arguments.
-      for (var argument in arguments.skip(2)) {
+      for (var argument in initializer.argumentList.arguments) {
         argument.accept(this);
       }
     }
diff --git a/pkg/analyzer/lib/src/summary2/library_builder.dart b/pkg/analyzer/lib/src/summary2/library_builder.dart
index 765c9dc..aa57e1e 100644
--- a/pkg/analyzer/lib/src/summary2/library_builder.dart
+++ b/pkg/analyzer/lib/src/summary2/library_builder.dart
@@ -23,7 +23,6 @@
 class ImplicitEnumNodes {
   final EnumElementImpl element;
   final FieldElementImpl indexField;
-  final FieldElementImpl nameField;
   final ast.NamedTypeImpl valuesTypeNode;
   final ConstFieldElementImpl valuesField;
   final MethodElementImpl? syntheticToStringMethod;
@@ -31,7 +30,6 @@
   ImplicitEnumNodes({
     required this.element,
     required this.indexField,
-    required this.nameField,
     required this.valuesTypeNode,
     required this.valuesField,
     required this.syntheticToStringMethod,
@@ -137,7 +135,6 @@
     var typeProvider = element.typeProvider;
     for (var enum_ in implicitEnumNodes) {
       enum_.indexField.type = typeProvider.intType;
-      enum_.nameField.type = typeProvider.stringType;
       var valuesType = typeProvider.listType(
         element.typeSystem.instantiateToBounds2(
           classElement: enum_.element,
@@ -147,13 +144,6 @@
       enum_.valuesTypeNode.type = valuesType;
       enum_.valuesField.type = valuesType;
       enum_.syntheticToStringMethod?.returnType = typeProvider.stringType;
-      for (var constructor in enum_.element.constructors) {
-        var parameters = constructor.parameters;
-        if (parameters.length >= 2) {
-          parameters[0].impl.type = typeProvider.intType;
-          parameters[1].impl.type = typeProvider.stringType;
-        }
-      }
     }
   }
 
@@ -338,9 +328,3 @@
     required this.element,
   });
 }
-
-extension on ParameterElement {
-  ParameterElementImpl get impl {
-    return this as ParameterElementImpl;
-  }
-}
diff --git a/pkg/analyzer/lib/src/summary2/linked_element_factory.dart b/pkg/analyzer/lib/src/summary2/linked_element_factory.dart
index b91377d..21183bd 100644
--- a/pkg/analyzer/lib/src/summary2/linked_element_factory.dart
+++ b/pkg/analyzer/lib/src/summary2/linked_element_factory.dart
@@ -13,7 +13,7 @@
 
 class LinkedElementFactory {
   final AnalysisContextImpl analysisContext;
-  final AnalysisSessionImpl analysisSession;
+  AnalysisSessionImpl analysisSession;
   final Reference rootReference;
   final Map<String, LibraryReader> _libraryReaders = {};
   final Map<String, List<Reference>> _exportsOfLibrary = {};
@@ -165,13 +165,6 @@
     return _libraryReaders[uriStr] != null;
   }
 
-  /// We are about to discard this factory, mark all libraries invalid.
-  void invalidateAllLibraries() {
-    for (var libraryReference in rootReference.children) {
-      _invalidateLibrary(libraryReference);
-    }
-  }
-
   LibraryElementImpl? libraryOfUri(String uriStr) {
     var reference = rootReference.getChild(uriStr);
     return elementOfReference(reference) as LibraryElementImpl?;
@@ -204,8 +197,7 @@
     for (var uriStr in uriStrSet) {
       _exportsOfLibrary.remove(uriStr);
       _libraryReaders.remove(uriStr);
-      var libraryReference = rootReference.removeChild(uriStr);
-      _invalidateLibrary(libraryReference);
+      rootReference.removeChild(uriStr);
     }
 
     analysisSession.classHierarchy.removeOfLibraries(uriStrSet);
@@ -230,6 +222,16 @@
     }
   }
 
+  void replaceAnalysisSession(AnalysisSessionImpl newSession) {
+    analysisSession = newSession;
+    for (var libraryReference in rootReference.children) {
+      var libraryElement = libraryReference.element;
+      if (libraryElement is LibraryElementImpl) {
+        libraryElement.session = newSession;
+      }
+    }
+  }
+
   /// Set exports of the library with [uriStr], after building exports during
   /// linking, or after reading a linked bundle.
   void setExportsOfLibrary(String uriStr, List<Reference> exports) {
@@ -255,11 +257,4 @@
 
     libraryElement.createLoadLibraryFunction();
   }
-
-  void _invalidateLibrary(Reference? libraryReference) {
-    var libraryElement = libraryReference?.element;
-    if (libraryElement is LibraryElementImpl) {
-      libraryElement.isValid = false;
-    }
-  }
 }
diff --git a/pkg/analyzer/test/generated/constant_test.dart b/pkg/analyzer/test/generated/constant_test.dart
index 8de1d7f..e52a181 100644
--- a/pkg/analyzer/test/generated/constant_test.dart
+++ b/pkg/analyzer/test/generated/constant_test.dart
@@ -372,6 +372,26 @@
     await _assertValueBool(true, "'a' != 'b'");
   }
 
+  test_object_enum() async {
+    await resolveTestCode('''
+enum E { v1, v2 }
+const x1 = E.v1;
+const x2 = E.v2;
+''');
+
+    _assertTopVarConstValue('x1', r'''
+E
+  _name: String v1
+  index: int 0
+''');
+
+    _assertTopVarConstValue('x2', r'''
+E
+  _name: String v2
+  index: int 1
+''');
+  }
+
   test_parenthesizedExpression() async {
     await _assertValueString("a", "('a')");
   }
@@ -444,6 +464,10 @@
     await _assertValueInt(6, "'Dvorak'.length");
   }
 
+  void _assertTopVarConstValue(String name, String expected) {
+    assertDartObjectText(_topVarConstResult(name).value, expected);
+  }
+
   Future<void> _assertValueBool(bool expectedValue, String contents) async {
     var result = await _getExpressionValue(contents);
     DartObject value = result.value!;
@@ -491,4 +515,9 @@
 
     return evaluator.evaluate(expression);
   }
+
+  EvaluationResultImpl _topVarConstResult(String name) {
+    var element = findElement.topVar(name) as ConstTopLevelVariableElementImpl;
+    return element.evaluationResult!;
+  }
 }
diff --git a/pkg/analyzer/test/src/dart/analysis/driver_test.dart b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
index 1f83aec..807866c 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
@@ -819,12 +819,13 @@
       ],
     );
 
-    // All libraries are valid.
-    expect(a_element.isValid, true);
-    expect(b_element.isValid, true);
-    expect(c_element.isValid, true);
-    expect(d_element.isValid, true);
-    expect(e_element.isValid, true);
+    // All libraries have the current session.
+    var session1 = driver.currentSession;
+    expect(a_element.session, session1);
+    expect(b_element.session, session1);
+    expect(c_element.session, session1);
+    expect(d_element.session, session1);
+    expect(e_element.session, session1);
 
     // Change `b.dart`, also removes `c.dart` and `d.dart` that import it.
     // But `a.dart` and `d.dart` is not affected.
@@ -841,12 +842,17 @@
       ],
     );
 
-    // Only `a.dart` and `e.dart` are still valid.
-    expect(a_element.isValid, true);
-    expect(b_element.isValid, false);
-    expect(c_element.isValid, false);
-    expect(d_element.isValid, false);
-    expect(e_element.isValid, true);
+    // We have a new session.
+    var session2 = driver.currentSession;
+    expect(session2, isNot(session1));
+
+    // `a.dart` and `e.dart` moved to the new session.
+    // Invalidated libraries stuck with the old session.
+    expect(a_element.session, session2);
+    expect(b_element.session, session1);
+    expect(c_element.session, session1);
+    expect(d_element.session, session1);
+    expect(e_element.session, session2);
   }
 
   test_changeFile_potentiallyAffected_part() async {
@@ -880,10 +886,11 @@
       ],
     );
 
-    // All libraries are valid.
-    expect(b_element.isValid, true);
-    expect(c_element.isValid, true);
-    expect(d_element.isValid, true);
+    // All libraries have the current session.
+    var session1 = driver.currentSession;
+    expect(b_element.session, session1);
+    expect(c_element.session, session1);
+    expect(d_element.session, session1);
 
     // Change `a.dart`, remove `b.dart` that part it.
     // Removes `c.dart` that imports `b.dart`.
@@ -899,10 +906,15 @@
       ],
     );
 
-    // Only `d.dart` is still valid.
-    expect(b_element.isValid, false);
-    expect(c_element.isValid, false);
-    expect(d_element.isValid, true);
+    // We have a new session.
+    var session2 = driver.currentSession;
+    expect(session2, isNot(session1));
+
+    // `d.dart` moved to the new session.
+    // Invalidated libraries stuck with the old session.
+    expect(b_element.session, session1);
+    expect(c_element.session, session1);
+    expect(d_element.session, session2);
   }
 
   test_changeFile_selfConsistent() async {
@@ -1180,9 +1192,8 @@
     var session2 = driver.currentSession;
     expect(session2, isNotNull);
 
-    // We don't discard the session anymore.
-    // So, the session is always the same.
-    expect(session2, same(session1));
+    // We get a new session.
+    expect(session2, isNot(session1));
   }
 
   test_discoverAvailableFiles_packages() async {
diff --git a/pkg/analyzer/test/src/dart/analysis/session_test.dart b/pkg/analyzer/test/src/dart/analysis/session_test.dart
index fb40314..6953e85 100644
--- a/pkg/analyzer/test/src/dart/analysis/session_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/session_test.dart
@@ -134,6 +134,16 @@
     expect(errorsResult.errors, isNotEmpty);
   }
 
+  test_getErrors_inconsistent() async {
+    var test = newFile(testFilePath, content: '');
+    var session = contextFor(test.path).currentSession;
+    driverFor(test.path).changeFile(test.path);
+    expect(
+      () => session.getErrors(test.path),
+      throwsA(isA<InconsistentAnalysisException>()),
+    );
+  }
+
   test_getErrors_invalidPath_notAbsolute() async {
     var session = contextFor(testFilePath).currentSession;
     var errorsResult = await session.getErrors('not_absolute.dart');
@@ -146,6 +156,16 @@
     expect(errorsResult, isA<InvalidPathResult>());
   }
 
+  test_getFileSync_inconsistent() async {
+    var test = newFile(testFilePath, content: '');
+    var session = contextFor(test.path).currentSession;
+    driverFor(test.path).changeFile(test.path);
+    expect(
+      () => session.getFile(test.path),
+      throwsA(isA<InconsistentAnalysisException>()),
+    );
+  }
+
   test_getFileSync_library() async {
     var a = newFile('$testPackageLibPath/a.dart', content: '');
 
@@ -180,6 +200,16 @@
     expect(library.getType('C'), isNull);
   }
 
+  test_getLibraryByUri_inconsistent() async {
+    var test = newFile(testFilePath, content: '');
+    var session = contextFor(test.path).currentSession;
+    driverFor(test.path).changeFile(test.path);
+    expect(
+      () => session.getLibraryByUriValid('package:test/test.dart'),
+      throwsA(isA<InconsistentAnalysisException>()),
+    );
+  }
+
   test_getLibraryByUri_unresolvedUri() async {
     var session = contextFor(testFilePath).currentSession;
     var result = await session.getLibraryByUri('package:foo/foo.dart');
@@ -267,6 +297,16 @@
     expect(parsedLibrary.getElementDeclaration(fooElement.setter!), isNull);
   }
 
+  test_getParsedLibrary_inconsistent() async {
+    var test = newFile(testFilePath, content: '');
+    var session = contextFor(test.path).currentSession;
+    driverFor(test.path).changeFile(test.path);
+    expect(
+      () => session.getParsedLibrary(test.path),
+      throwsA(isA<InconsistentAnalysisException>()),
+    );
+  }
+
   test_getParsedLibrary_invalidPartUri() async {
     var test = newFile(testFilePath, content: r'''
 part 'a.dart';
@@ -407,6 +447,16 @@
     expect(unitResult.unit.declarations, hasLength(2));
   }
 
+  test_getParsedUnit_inconsistent() async {
+    var test = newFile(testFilePath, content: '');
+    var session = contextFor(test.path).currentSession;
+    driverFor(test.path).changeFile(test.path);
+    expect(
+      () => session.getParsedUnit(test.path),
+      throwsA(isA<InconsistentAnalysisException>()),
+    );
+  }
+
   test_getParsedUnit_invalidPath_notAbsolute() async {
     var session = contextFor(testFilePath).currentSession;
     var result = session.getParsedUnit('not_absolute.dart');
@@ -512,6 +562,16 @@
     expect(resolvedLibrary.getElementDeclaration(fooElement.setter!), isNull);
   }
 
+  test_getResolvedLibrary_inconsistent() async {
+    var test = newFile(testFilePath, content: '');
+    var session = contextFor(test.path).currentSession;
+    driverFor(test.path).changeFile(test.path);
+    expect(
+      () => session.getResolvedLibrary(test.path),
+      throwsA(isA<InconsistentAnalysisException>()),
+    );
+  }
+
   test_getResolvedLibrary_invalidPartUri() async {
     var test = newFile(testFilePath, content: r'''
 part 'a.dart';
@@ -600,6 +660,16 @@
     expect(unitResult.libraryElement, isNotNull);
   }
 
+  test_getResolvedUnit_inconsistent() async {
+    var test = newFile(testFilePath, content: '');
+    var session = contextFor(test.path).currentSession;
+    driverFor(test.path).changeFile(test.path);
+    expect(
+      () => session.getResolvedUnit(test.path),
+      throwsA(isA<InconsistentAnalysisException>()),
+    );
+  }
+
   test_getUnitElement() async {
     var test = newFile(testFilePath, content: r'''
 class A {}
@@ -614,6 +684,16 @@
     expect(unitResult.element.classes, hasLength(2));
   }
 
+  test_getUnitElement_inconsistent() async {
+    var test = newFile(testFilePath, content: '');
+    var session = contextFor(test.path).currentSession;
+    driverFor(test.path).changeFile(test.path);
+    expect(
+      () => session.getUnitElement(test.path),
+      throwsA(isA<InconsistentAnalysisException>()),
+    );
+  }
+
   test_resourceProvider() async {
     var session = contextFor(testFilePath).currentSession;
     expect(session.resourceProvider, resourceProvider);
diff --git a/pkg/analyzer/test/src/dart/resolution/dart_object_printer.dart b/pkg/analyzer/test/src/dart/resolution/dart_object_printer.dart
new file mode 100644
index 0000000..ccb6a78
--- /dev/null
+++ b/pkg/analyzer/test/src/dart/resolution/dart_object_printer.dart
@@ -0,0 +1,47 @@
+// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:collection';
+
+import 'package:analyzer/src/dart/constant/value.dart';
+
+/// Prints [DartObjectImpl] as a tree, with values and fields.
+class DartObjectPrinter {
+  final StringBuffer sink;
+
+  DartObjectPrinter(this.sink);
+
+  void write(DartObjectImpl? object, String indent) {
+    if (object != null) {
+      var type = object.type;
+      if (type.isDartCoreDouble) {
+        sink.write('double ');
+        sink.writeln(object.toDoubleValue());
+      } else if (type.isDartCoreInt) {
+        sink.write('int ');
+        sink.writeln(object.toIntValue());
+      } else if (type.isDartCoreString) {
+        sink.write('String ');
+        sink.writeln(object.toStringValue());
+      } else if (object.isUserDefinedObject) {
+        var newIndent = '$indent  ';
+        var typeStr = type.getDisplayString(withNullability: true);
+        sink.writeln(typeStr);
+        var fields = object.fields;
+        if (fields != null) {
+          var sortedFields = SplayTreeMap.of(fields);
+          for (var entry in sortedFields.entries) {
+            sink.write(newIndent);
+            sink.write('${entry.key}: ');
+            write(entry.value, newIndent);
+          }
+        }
+      } else {
+        throw UnimplementedError();
+      }
+    } else {
+      sink.writeln('<null>');
+    }
+  }
+}
diff --git a/pkg/analyzer/test/src/dart/resolution/enum_test.dart b/pkg/analyzer/test/src/dart/resolution/enum_test.dart
index ca17f7c..43cf553 100644
--- a/pkg/analyzer/test/src/dart/resolution/enum_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/enum_test.dart
@@ -19,7 +19,7 @@
     await assertNoErrorsInCode(r'''
 enum E {
   v([]);
-  E(List<int> a);
+  const E(List<int> a);
 }
 ''');
 
@@ -30,7 +30,7 @@
     await assertNoErrorsInCode(r'''
 enum E {
   v(<void Function(double)>[]);
-  E(Object a);
+  const E(Object a);
 }
 ''');
 
@@ -50,7 +50,7 @@
     await assertNoErrorsInCode(r'''
 enum E<T> {
   v.named(42);
-  E.named(T a);
+  const E.named(T a);
 }
 ''');
 
@@ -76,7 +76,7 @@
     await assertNoErrorsInCode(r'''
 enum E<T> {
   v(42);
-  E(T a);
+  const E(T a);
 }
 ''');
 
@@ -102,7 +102,7 @@
     await assertNoErrorsInCode(r'''
 enum E<T> {
   v<double>.named(42);
-  E.named(T a);
+  const E.named(T a);
 }
 ''');
 
@@ -134,7 +134,7 @@
     await assertNoErrorsInCode(r'''
 enum E {
   v.named(42);
-  E.named(int a);
+  const E.named(int a);
 }
 ''');
 
@@ -154,7 +154,7 @@
     await assertNoErrorsInCode(r'''
 enum E {
   v(42);
-  E(int a);
+  const E(int a);
 }
 ''');
 
@@ -188,7 +188,7 @@
     await assertNoErrorsInCode(r'''
 enum E {
   v.named(42);
-  E(int a);
+  const E(int a);
 }
 ''');
 
@@ -205,7 +205,7 @@
     await assertNoErrorsInCode(r'''
 enum E {
   v(42);
-  E.named(int a);
+  const E.named(int a);
 }
 ''');
 
diff --git a/pkg/analyzer/test/src/dart/resolution/metadata_test.dart b/pkg/analyzer/test/src/dart/resolution/metadata_test.dart
index b17dc6f..2cd36d7 100644
--- a/pkg/analyzer/test/src/dart/resolution/metadata_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/metadata_test.dart
@@ -2,12 +2,8 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-import 'dart:collection';
-
 import 'package:analyzer/dart/ast/ast.dart';
-import 'package:analyzer/dart/constant/value.dart';
 import 'package:analyzer/dart/element/element.dart';
-import 'package:analyzer/src/dart/constant/value.dart';
 import 'package:analyzer/src/test_utilities/find_element.dart';
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -2181,22 +2177,12 @@
     _assertElementAnnotationValueText(elementAnnotation, expected);
   }
 
-  void _assertDartObjectText(DartObject? object, String expected) {
-    var buffer = StringBuffer();
-    _DartObjectPrinter(buffer).write(object as DartObjectImpl?, '');
-    var actual = buffer.toString();
-    if (actual != expected) {
-      print(buffer);
-    }
-    expect(actual, expected);
-  }
-
   void _assertElementAnnotationValueText(
     ElementAnnotation annotation,
     String expected,
   ) {
     var value = annotation.computeConstantValue();
-    _assertDartObjectText(value, expected);
+    assertDartObjectText(value, expected);
   }
 
   void _assertResolvedNodeText(AstNode node, String expected) {
@@ -2219,39 +2205,3 @@
     return buffer.toString();
   }
 }
-
-class _DartObjectPrinter {
-  final StringBuffer sink;
-
-  _DartObjectPrinter(this.sink);
-
-  void write(DartObjectImpl? object, String indent) {
-    if (object != null) {
-      var type = object.type;
-      if (type.isDartCoreDouble) {
-        sink.write('double ');
-        sink.writeln(object.toDoubleValue());
-      } else if (type.isDartCoreInt) {
-        sink.write('int ');
-        sink.writeln(object.toIntValue());
-      } else if (object.isUserDefinedObject) {
-        var newIndent = '$indent  ';
-        var typeStr = type.getDisplayString(withNullability: true);
-        sink.writeln(typeStr);
-        var fields = object.fields;
-        if (fields != null) {
-          var sortedFields = SplayTreeMap.of(fields);
-          for (var entry in sortedFields.entries) {
-            sink.write(newIndent);
-            sink.write('${entry.key}: ');
-            write(entry.value, newIndent);
-          }
-        }
-      } else {
-        throw UnimplementedError();
-      }
-    } else {
-      sink.writeln('<null>');
-    }
-  }
-}
diff --git a/pkg/analyzer/test/src/dart/resolution/resolution.dart b/pkg/analyzer/test/src/dart/resolution/resolution.dart
index e76b324..71d4a5a 100644
--- a/pkg/analyzer/test/src/dart/resolution/resolution.dart
+++ b/pkg/analyzer/test/src/dart/resolution/resolution.dart
@@ -5,6 +5,7 @@
 import 'package:analyzer/dart/analysis/features.dart';
 import 'package:analyzer/dart/analysis/results.dart';
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/constant/value.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/dart/element/nullability_suffix.dart';
 import 'package:analyzer/dart/element/type.dart';
@@ -12,6 +13,7 @@
 import 'package:analyzer/error/error.dart';
 import 'package:analyzer/src/dart/ast/ast.dart';
 import 'package:analyzer/src/dart/ast/extensions.dart';
+import 'package:analyzer/src/dart/constant/value.dart';
 import 'package:analyzer/src/dart/element/element.dart';
 import 'package:analyzer/src/dart/element/member.dart';
 import 'package:analyzer/src/dart/element/type.dart';
@@ -23,6 +25,7 @@
 import 'package:test/test.dart';
 
 import '../../../generated/test_support.dart';
+import 'dart_object_printer.dart';
 
 final isDynamicType = TypeMatcher<DynamicTypeImpl>();
 
@@ -198,6 +201,16 @@
     );
   }
 
+  void assertDartObjectText(DartObject? object, String expected) {
+    var buffer = StringBuffer();
+    DartObjectPrinter(buffer).write(object as DartObjectImpl?, '');
+    var actual = buffer.toString();
+    if (actual != expected) {
+      print(buffer);
+    }
+    expect(actual, expected);
+  }
+
   void assertElement(Object? nodeOrElement, Object? elementOrMatcher) {
     Element? element;
     if (nodeOrElement is AstNode) {
diff --git a/pkg/analyzer/test/src/diagnostics/const_constructor_with_non_const_super_test.dart b/pkg/analyzer/test/src/diagnostics/const_constructor_with_non_const_super_test.dart
index 9dcfbc5..4b81e48 100644
--- a/pkg/analyzer/test/src/diagnostics/const_constructor_with_non_const_super_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/const_constructor_with_non_const_super_test.dart
@@ -15,7 +15,7 @@
 
 @reflectiveTest
 class ConstConstructorWithNonConstSuperTest extends PubPackageResolutionTest {
-  test_explicit() async {
+  test_class_explicit() async {
     await assertErrorsInCode(r'''
 class A {
   A();
@@ -28,7 +28,7 @@
     ]);
   }
 
-  test_implicit() async {
+  test_class_implicit() async {
     await assertErrorsInCode(r'''
 class A {
   A();
@@ -40,4 +40,21 @@
       error(CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER, 47, 1),
     ]);
   }
+
+  test_enum() async {
+    await assertNoErrorsInCode(r'''
+enum E {
+  v
+}
+''');
+  }
+
+  test_enum_hasConstructor() async {
+    await assertNoErrorsInCode(r'''
+enum E {
+  v(0);
+  const E(int a);
+}
+''');
+  }
 }
diff --git a/pkg/analyzer/test/src/diagnostics/instantiate_enum_test.dart b/pkg/analyzer/test/src/diagnostics/instantiate_enum_test.dart
index 4fc7b70..0fd804c 100644
--- a/pkg/analyzer/test/src/diagnostics/instantiate_enum_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/instantiate_enum_test.dart
@@ -22,10 +22,7 @@
   return const E();
 }
 ''', [
-      error(CompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH, 43, 9),
-      error(CompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH, 43, 9),
       error(CompileTimeErrorCode.INSTANTIATE_ENUM, 49, 1),
-      error(CompileTimeErrorCode.NOT_ENOUGH_POSITIONAL_ARGUMENTS, 50, 2),
     ]);
   }
 
@@ -37,7 +34,6 @@
 }
 ''', [
       error(CompileTimeErrorCode.INSTANTIATE_ENUM, 47, 1),
-      error(CompileTimeErrorCode.NOT_ENOUGH_POSITIONAL_ARGUMENTS, 48, 2),
     ]);
   }
 }
diff --git a/pkg/analyzer/test/src/summary/resynthesize_common.dart b/pkg/analyzer/test/src/summary/resynthesize_common.dart
index 4d9cd96..2610746 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_common.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_common.dart
@@ -8308,12 +8308,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 0 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'aaa' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -8337,12 +8331,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 1 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'bbb' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -8366,12 +8354,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 2 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'ccc' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -8410,21 +8392,8 @@
                 staticType: List<E>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
           synthetic const @-1
-            parameters
-              requiredPositional final this.index @-1
-                type: int
-                codeOffset: null
-                codeLength: null
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                codeOffset: null
-                codeLength: null
-                field: self::@enum::E::@field::_name
         accessors
           synthetic static get aaa @-1
             returnType: E
@@ -8436,8 +8405,6 @@
             returnType: List<E>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           synthetic toString @-1
             returnType: String
@@ -13591,12 +13558,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 0 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'a' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -13618,12 +13579,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 1 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'b' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -13645,12 +13600,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 2 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'c' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -13689,17 +13638,8 @@
                 staticType: List<E>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
           synthetic const @-1
-            parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E::@field::_name
         accessors
           synthetic static get a @-1
             returnType: E
@@ -13711,8 +13651,6 @@
             returnType: List<E>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           synthetic toString @-1
             returnType: String
@@ -15915,12 +15853,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 0 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'a' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -15942,12 +15874,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 1 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'b' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -15969,12 +15895,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 2 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'c' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -16013,17 +15933,8 @@
                 staticType: List<E>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
           synthetic const @-1
-            parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E::@field::_name
         accessors
           synthetic static get a @-1
             returnType: E
@@ -16035,8 +15946,6 @@
             returnType: List<E>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           synthetic toString @-1
             returnType: String
@@ -16074,12 +15983,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 0 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'a' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -16110,17 +16013,8 @@
                 staticType: List<E>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
           synthetic const @-1
-            parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E::@field::_name
         accessors
           synthetic static get a @-1
             returnType: E
@@ -16128,8 +16022,6 @@
             returnType: List<E>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           synthetic toString @-1
             returnType: String
@@ -17092,12 +16984,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 0 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'a' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -17119,12 +17005,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 1 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'b' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -17159,17 +17039,8 @@
                 staticType: List<E>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
           synthetic const @-1
-            parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E::@field::_name
         accessors
           synthetic static get a @-1
             returnType: E
@@ -17179,8 +17050,6 @@
             returnType: List<E>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           synthetic toString @-1
             returnType: String
@@ -17192,12 +17061,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 0 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'c' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -17219,12 +17082,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 1 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'd' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -17246,12 +17103,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 2 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'e' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -17290,17 +17141,8 @@
                 staticType: List<E>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
           synthetic const @-1
-            parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E::@field::_name
         accessors
           synthetic static get c @-1
             returnType: E
@@ -17312,8 +17154,6 @@
             returnType: List<E>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           synthetic toString @-1
             returnType: String
@@ -17539,7 +17379,7 @@
     var library = await checkLibrary(r'''
 enum E<T> {
   int(1), string('2');
-  E(T a);
+  const E(T a);
 }
 ''');
     checkElementText(library, r'''
@@ -17559,11 +17399,6 @@
                 argumentList: ArgumentList
                   arguments
                     IntegerLiteral
-                      literal: 0 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'int' @0
-                    IntegerLiteral
                       literal: 1 @18
                       staticType: int
                   leftParenthesis: ( @0
@@ -17592,11 +17427,6 @@
               InstanceCreationExpression
                 argumentList: ArgumentList
                   arguments
-                    IntegerLiteral
-                      literal: 1 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'string' @0
                     SimpleStringLiteral
                       literal: '2' @29
                   leftParenthesis: ( @0
@@ -17637,18 +17467,10 @@
                 staticType: List<E<dynamic>>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
-          @37
+          const @43
             parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E::@field::_name
-              requiredPositional a @41
+              requiredPositional a @47
                 type: T
         accessors
           synthetic static get int @-1
@@ -17659,8 +17481,6 @@
             returnType: List<E<dynamic>>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           synthetic toString @-1
             returnType: String
@@ -17686,12 +17506,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 0 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: '_name' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -17722,17 +17536,8 @@
                 staticType: List<E>
           synthetic final index @-1
             type: int
-          synthetic final _name2 @-1
-            type: String
         constructors
           synthetic const @-1
-            parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name2 @-1
-                type: String
-                field: self::@enum::E::@field::_name2
         accessors
           synthetic static get _name @-1
             returnType: E
@@ -17740,8 +17545,6 @@
             returnType: List<E>
           synthetic get index @-1
             returnType: int
-          synthetic get _name2 @-1
-            returnType: String
         methods
           synthetic toString @-1
             returnType: String
@@ -17752,7 +17555,7 @@
     var library = await checkLibrary(r'''
 enum E<T> {
   v<double>(42);
-  E(T a);
+  const E(T a);
 }
 ''');
     checkElementText(library, r'''
@@ -17772,11 +17575,6 @@
                 argumentList: ArgumentList
                   arguments
                     IntegerLiteral
-                      literal: 0 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'v' @0
-                    IntegerLiteral
                       literal: 42 @24
                       staticType: double
                   leftParenthesis: ( @0
@@ -17823,18 +17621,10 @@
                 staticType: List<E<dynamic>>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
-          @31
+          const @37
             parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E::@field::_name
-              requiredPositional a @35
+              requiredPositional a @41
                 type: T
         accessors
           synthetic static get v @-1
@@ -17843,8 +17633,6 @@
             returnType: List<E<dynamic>>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           synthetic toString @-1
             returnType: String
@@ -17869,12 +17657,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 0 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: '_' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -17905,17 +17687,8 @@
                 staticType: List<E>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
           synthetic const @-1
-            parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E::@field::_name
         accessors
           synthetic static get _ @-1
             returnType: E
@@ -17923,8 +17696,6 @@
             returnType: List<E>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           synthetic toString @-1
             returnType: String
@@ -17935,7 +17706,7 @@
     var library = await checkLibrary(r'''
 enum E {
   v.named(42);
-  E.named(int a);
+  const E.named(int a);
 }
 ''');
     checkElementText(library, r'''
@@ -17952,11 +17723,6 @@
                 argumentList: ArgumentList
                   arguments
                     IntegerLiteral
-                      literal: 0 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'v' @0
-                    IntegerLiteral
                       literal: 42 @19
                       staticType: int
                   leftParenthesis: ( @0
@@ -17989,20 +17755,12 @@
                 staticType: List<E>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
-          named @28
-            periodOffset: 27
-            nameEnd: 33
+          const named @34
+            periodOffset: 33
+            nameEnd: 39
             parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E::@field::_name
-              requiredPositional a @38
+              requiredPositional a @44
                 type: int
         accessors
           synthetic static get v @-1
@@ -18011,8 +17769,6 @@
             returnType: List<E>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           synthetic toString @-1
             returnType: String
@@ -18023,7 +17779,7 @@
     var library = await checkLibrary(r'''
 enum E {
   v(42);
-  E(int a);
+  const E(int a);
 }
 ''');
     checkElementText(library, r'''
@@ -18040,11 +17796,6 @@
                 argumentList: ArgumentList
                   arguments
                     IntegerLiteral
-                      literal: 0 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'v' @0
-                    IntegerLiteral
                       literal: 42 @13
                       staticType: int
                   leftParenthesis: ( @0
@@ -18077,18 +17828,10 @@
                 staticType: List<E>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
-          @20
+          const @26
             parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E::@field::_name
-              requiredPositional a @26
+              requiredPositional a @32
                 type: int
         accessors
           synthetic static get v @-1
@@ -18097,8 +17840,6 @@
             returnType: List<E>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           synthetic toString @-1
             returnType: String
@@ -18125,12 +17866,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 0 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'v' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -18161,17 +17896,8 @@
                 staticType: List<E>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
           synthetic const @-1
-            parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E::@field::_name
         accessors
           synthetic static get v @-1
             returnType: E
@@ -18179,8 +17905,6 @@
             returnType: List<E>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           synthetic toString @-1
             returnType: String
@@ -18206,12 +17930,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 0 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'v' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -18242,8 +17960,6 @@
                 staticType: List<E>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
           final foo @22
             type: int
             constantInitializer
@@ -18252,13 +17968,6 @@
                 staticType: int
         constructors
           synthetic const @-1
-            parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E::@field::_name
         accessors
           synthetic static get v @-1
             returnType: E
@@ -18266,8 +17975,6 @@
             returnType: List<E>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
           synthetic get foo @-1
             returnType: int
         methods
@@ -18298,12 +18005,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 0 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'v' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -18338,17 +18039,8 @@
                 staticType: List<E<dynamic>>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
           synthetic const @-1
-            parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E::@field::_name
         accessors
           synthetic static get v @-1
             returnType: E<dynamic>
@@ -18356,8 +18048,6 @@
             returnType: List<E<dynamic>>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           foo @23
             typeParameters
@@ -18392,12 +18082,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 0 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'v' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -18428,17 +18112,8 @@
                 staticType: List<E>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
           synthetic const @-1
-            parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E::@field::_name
         accessors
           synthetic static get v @-1
             returnType: E
@@ -18446,8 +18121,6 @@
             returnType: List<E>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           toString @23
             returnType: String
@@ -18475,12 +18148,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 0 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'v' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -18515,17 +18182,8 @@
                 staticType: List<E<dynamic>>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
           synthetic const @-1
-            parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E::@field::_name
         accessors
           synthetic static get v @-1
             returnType: E<dynamic>
@@ -18533,8 +18191,6 @@
             returnType: List<E<dynamic>>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           synthetic toString @-1
             returnType: String
@@ -18566,12 +18222,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 0 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'v' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -18606,17 +18256,8 @@
                 staticType: List<E<num, num>>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
           synthetic const @-1
-            parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E::@field::_name
         accessors
           synthetic static get v @-1
             returnType: E<num, num>
@@ -18624,8 +18265,6 @@
             returnType: List<E<num, num>>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           synthetic toString @-1
             returnType: String
@@ -18656,24 +18295,13 @@
                 staticType: List<E<dynamic>>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
           synthetic const @-1
-            parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E::@field::_name
         accessors
           synthetic static get values @-1
             returnType: List<E<dynamic>>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           synthetic toString @-1
             returnType: String
@@ -18710,24 +18338,13 @@
                 staticType: List<E<dynamic, num, dynamic>>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
           synthetic const @-1
-            parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E::@field::_name
         accessors
           synthetic static get values @-1
             returnType: List<E<dynamic, num, dynamic>>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           synthetic toString @-1
             returnType: String
@@ -18758,24 +18375,13 @@
                 staticType: List<E<dynamic>>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
           synthetic const @-1
-            parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E::@field::_name
         accessors
           synthetic static get values @-1
             returnType: List<E<dynamic>>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           synthetic toString @-1
             returnType: String
@@ -18805,24 +18411,13 @@
                 staticType: List<E<dynamic>>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
           synthetic const @-1
-            parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E::@field::_name
         accessors
           synthetic static get values @-1
             returnType: List<E<dynamic>>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           synthetic toString @-1
             returnType: String
@@ -18852,24 +18447,13 @@
                 staticType: List<E<dynamic>>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
           synthetic const @-1
-            parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E::@field::_name
         accessors
           synthetic static get values @-1
             returnType: List<E<dynamic>>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           synthetic toString @-1
             returnType: String
@@ -18899,24 +18483,13 @@
                 staticType: List<E<dynamic>>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
           synthetic const @-1
-            parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E::@field::_name
         accessors
           synthetic static get values @-1
             returnType: List<E<dynamic>>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           synthetic toString @-1
             returnType: String
@@ -18950,24 +18523,13 @@
                 staticType: List<E<dynamic, dynamic, dynamic>>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
           synthetic const @-1
-            parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E::@field::_name
         accessors
           synthetic static get values @-1
             returnType: List<E<dynamic, dynamic, dynamic>>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           synthetic toString @-1
             returnType: String
@@ -18997,12 +18559,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 0 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'a' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -19025,12 +18581,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 1 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'b' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -19065,17 +18615,8 @@
                 staticType: List<E>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
           synthetic const @-1
-            parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E::@field::_name
         accessors
           synthetic static get a @-1
             returnType: E
@@ -19085,8 +18626,6 @@
             returnType: List<E>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           synthetic toString @-1
             returnType: String
@@ -19129,12 +18668,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 0 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'a' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -19165,12 +18698,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 1 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'b' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -19205,17 +18732,8 @@
                 staticType: List<E>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
           synthetic const @-1
-            parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E::@field::_name
         accessors
           synthetic static get a @-1
             returnType: E
@@ -19225,8 +18743,6 @@
             returnType: List<E>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           synthetic toString @-1
             returnType: String
@@ -19257,12 +18773,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 0 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'v1' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -19284,12 +18794,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 1 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'v2' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -19324,17 +18828,8 @@
                 staticType: List<E>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
           synthetic const @-1
-            parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E::@field::_name
         accessors
           synthetic static get v1 @-1
             returnType: E
@@ -19344,8 +18839,6 @@
             returnType: List<E>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           synthetic toString @-1
             returnType: String
@@ -19366,12 +18859,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 0 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'v1' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -19402,17 +18889,8 @@
                 staticType: List<E1>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
           synthetic const @-1
-            parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E1::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E1::@field::_name
         accessors
           synthetic static get v1 @-1
             returnType: E1
@@ -19420,8 +18898,6 @@
             returnType: List<E1>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           synthetic toString @-1
             returnType: String
@@ -19433,12 +18909,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 0 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'v2' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -19469,17 +18939,8 @@
                 staticType: List<E2>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
           synthetic const @-1
-            parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E2::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E2::@field::_name
         accessors
           synthetic static get v2 @-1
             returnType: E2
@@ -19487,8 +18948,6 @@
             returnType: List<E2>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           synthetic toString @-1
             returnType: String
@@ -19567,12 +19026,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 0 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'a' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -19594,12 +19047,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 1 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'b' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -19621,12 +19068,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 2 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'c' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -19665,17 +19106,8 @@
                 staticType: List<E>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
           synthetic const @-1
-            parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E::@field::_name
         accessors
           synthetic static get a @-1
             returnType: E
@@ -19687,8 +19119,6 @@
             returnType: List<E>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           synthetic toString @-1
             returnType: String
@@ -26540,12 +25970,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 0 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'v' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -26576,17 +26000,8 @@
                 staticType: List<E>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
           synthetic const @-1
-            parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E::@field::_name
         accessors
           synthetic static get v @-1
             returnType: E
@@ -26594,8 +26009,6 @@
             returnType: List<E>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           synthetic toString @-1
             returnType: String
@@ -26666,12 +26079,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 0 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'a' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -26693,12 +26100,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 1 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'b' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -26735,12 +26136,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 2 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'c' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -26779,17 +26174,8 @@
                 staticType: List<E>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
           synthetic const @-1
-            parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E::@field::_name
         accessors
           synthetic static get a @-1
             returnType: E
@@ -26801,8 +26187,6 @@
             returnType: List<E>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           synthetic toString @-1
             returnType: String
@@ -26831,12 +26215,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 0 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'v' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -26867,17 +26245,8 @@
                 staticType: List<E>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
           synthetic const @-1
-            parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E::@field::_name
         accessors
           synthetic static get v @-1
             returnType: E
@@ -26885,8 +26254,6 @@
             returnType: List<E>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           synthetic toString @-1
             returnType: String
@@ -28386,12 +27753,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 0 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'e1' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -28413,12 +27774,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 1 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'e2' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -28448,12 +27803,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 2 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'e3' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -28492,17 +27841,8 @@
                 staticType: List<E>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
           synthetic const @-1
-            parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E::@field::_name
         accessors
           synthetic static get e1 @-1
             returnType: E
@@ -28514,8 +27854,6 @@
             returnType: List<E>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           synthetic toString @-1
             returnType: String
@@ -29562,12 +28900,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 0 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'v' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -29602,17 +28934,8 @@
                 staticType: List<E<dynamic>>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
           synthetic const @-1
-            parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E::@field::_name
         accessors
           synthetic static get v @-1
             returnType: E<dynamic>
@@ -29620,8 +28943,6 @@
             returnType: List<E<dynamic>>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           synthetic toString @-1
             returnType: String
@@ -29834,12 +29155,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 0 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'a' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -29861,12 +29176,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 1 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'b' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -29888,12 +29197,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 2 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'c' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -29932,17 +29235,8 @@
                 staticType: List<E>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
           synthetic const @-1
-            parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E::@field::_name
         accessors
           synthetic static get a @-1
             returnType: E
@@ -29954,8 +29248,6 @@
             returnType: List<E>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           synthetic toString @-1
             returnType: String
@@ -31251,12 +30543,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 0 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'a' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -31279,12 +30565,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 1 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'b' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -31322,20 +30602,8 @@
           synthetic final index @-1
             type: int
             nonSynthetic: self::@enum::E
-          synthetic final _name @-1
-            type: String
-            nonSynthetic: self::@enum::E::@getter::_name
         constructors
           synthetic const @-1
-            parameters
-              requiredPositional final this.index @-1
-                type: int
-                nonSynthetic: index@-1
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                nonSynthetic: _name@-1
-                field: self::@enum::E::@field::_name
             nonSynthetic: self::@enum::E
         accessors
           synthetic static get a @-1
@@ -31350,9 +30618,6 @@
           synthetic get index @-1
             returnType: int
             nonSynthetic: self::@enum::E
-          synthetic get _name @-1
-            returnType: String
-            nonSynthetic: self::@enum::E::@field::_name
         methods
           synthetic toString @-1
             returnType: String
@@ -33334,12 +32599,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 0 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'v' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -33370,17 +32629,8 @@
                 staticType: List<E>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
           synthetic const @-1
-            parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E::@field::_name
         accessors
           synthetic static get v @-1
             returnType: E
@@ -33388,8 +32638,6 @@
             returnType: List<E>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           synthetic toString @-1
             returnType: String
@@ -33489,12 +32737,6 @@
               constantInitializer
                 InstanceCreationExpression
                   argumentList: ArgumentList
-                    arguments
-                      IntegerLiteral
-                        literal: 0 @0
-                        staticType: int
-                      SimpleStringLiteral
-                        literal: 'v' @0
                     leftParenthesis: ( @0
                     rightParenthesis: ) @0
                   constructorName: ConstructorName
@@ -33525,17 +32767,8 @@
                   staticType: List<E>
             synthetic final index @-1
               type: int
-            synthetic final _name @-1
-              type: String
           constructors
             synthetic const @-1
-              parameters
-                requiredPositional final this.index @-1
-                  type: int
-                  field: self::@enum::E::@field::index
-                requiredPositional final this._name @-1
-                  type: String
-                  field: self::@enum::E::@field::_name
           accessors
             synthetic static get v @-1
               returnType: E
@@ -33543,8 +32776,6 @@
               returnType: List<E>
             synthetic get index @-1
               returnType: int
-            synthetic get _name @-1
-              returnType: String
           methods
             synthetic toString @-1
               returnType: String
@@ -33578,12 +32809,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 0 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'v' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -33614,17 +32839,8 @@
                 staticType: List<E>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
           synthetic const @-1
-            parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E::@field::_name
         accessors
           synthetic static get v @-1
             returnType: E
@@ -33632,8 +32848,6 @@
             returnType: List<E>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           synthetic toString @-1
             returnType: String
@@ -33704,12 +32918,6 @@
               constantInitializer
                 InstanceCreationExpression
                   argumentList: ArgumentList
-                    arguments
-                      IntegerLiteral
-                        literal: 0 @0
-                        staticType: int
-                      SimpleStringLiteral
-                        literal: 'v' @0
                     leftParenthesis: ( @0
                     rightParenthesis: ) @0
                   constructorName: ConstructorName
@@ -33740,17 +32948,8 @@
                   staticType: List<E>
             synthetic final index @-1
               type: int
-            synthetic final _name @-1
-              type: String
           constructors
             synthetic const @-1
-              parameters
-                requiredPositional final this.index @-1
-                  type: int
-                  field: self::@enum::E::@field::index
-                requiredPositional final this._name @-1
-                  type: String
-                  field: self::@enum::E::@field::_name
           accessors
             synthetic static get v @-1
               returnType: E
@@ -33758,8 +32957,6 @@
               returnType: List<E>
             synthetic get index @-1
               returnType: int
-            synthetic get _name @-1
-              returnType: String
           methods
             synthetic toString @-1
               returnType: String
@@ -33828,12 +33025,6 @@
               constantInitializer
                 InstanceCreationExpression
                   argumentList: ArgumentList
-                    arguments
-                      IntegerLiteral
-                        literal: 0 @0
-                        staticType: int
-                      SimpleStringLiteral
-                        literal: 'v' @0
                     leftParenthesis: ( @0
                     rightParenthesis: ) @0
                   constructorName: ConstructorName
@@ -33864,17 +33055,8 @@
                   staticType: List<E>
             synthetic final index @-1
               type: int
-            synthetic final _name @-1
-              type: String
           constructors
             synthetic const @-1
-              parameters
-                requiredPositional final this.index @-1
-                  type: int
-                  field: self::@enum::E::@field::index
-                requiredPositional final this._name @-1
-                  type: String
-                  field: self::@enum::E::@field::_name
           accessors
             synthetic static get v @-1
               returnType: E
@@ -33882,8 +33064,6 @@
               returnType: List<E>
             synthetic get index @-1
               returnType: int
-            synthetic get _name @-1
-              returnType: String
           methods
             synthetic toString @-1
               returnType: String
@@ -34020,12 +33200,6 @@
             constantInitializer
               InstanceCreationExpression
                 argumentList: ArgumentList
-                  arguments
-                    IntegerLiteral
-                      literal: 0 @0
-                      staticType: int
-                    SimpleStringLiteral
-                      literal: 'v' @0
                   leftParenthesis: ( @0
                   rightParenthesis: ) @0
                 constructorName: ConstructorName
@@ -34056,17 +33230,8 @@
                 staticType: List<E>
           synthetic final index @-1
             type: int
-          synthetic final _name @-1
-            type: String
         constructors
           synthetic const @-1
-            parameters
-              requiredPositional final this.index @-1
-                type: int
-                field: self::@enum::E::@field::index
-              requiredPositional final this._name @-1
-                type: String
-                field: self::@enum::E::@field::_name
         accessors
           synthetic static get v @-1
             returnType: E
@@ -34074,8 +33239,6 @@
             returnType: List<E>
           synthetic get index @-1
             returnType: int
-          synthetic get _name @-1
-            returnType: String
         methods
           synthetic toString @-1
             returnType: String
diff --git a/pkg/analyzer/test/verify_diagnostics_test.dart b/pkg/analyzer/test/verify_diagnostics_test.dart
index 84ce4b3..873f700 100644
--- a/pkg/analyzer/test/verify_diagnostics_test.dart
+++ b/pkg/analyzer/test/verify_diagnostics_test.dart
@@ -50,8 +50,6 @@
     // (such as `JSBool b;`), but that would complicate the example.
     'CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY',
     // Produces two diagnostics when it should only produce one.
-    'CompileTimeErrorCode.INSTANTIATE_ENUM',
-    // Produces two diagnostics when it should only produce one.
     'CompileTimeErrorCode.INVALID_URI',
     // Produces two diagnostics when it should only produce one.
     'CompileTimeErrorCode.INVALID_USE_OF_NULL_VALUE',
diff --git a/pkg/dartdev/bin/dartdev.dart b/pkg/dartdev/bin/dartdev.dart
index c2eee8a..7c096ee 100644
--- a/pkg/dartdev/bin/dartdev.dart
+++ b/pkg/dartdev/bin/dartdev.dart
@@ -7,6 +7,6 @@
 import 'package:dartdev/dartdev.dart';
 
 /// The entry point for dartdev.
-Future<void> main(List<String> args, SendPort port) async {
+Future<void> main(List<String> args, SendPort? port) async {
   await runDartdev(args, port);
 }
diff --git a/pkg/dartdev/lib/dartdev.dart b/pkg/dartdev/lib/dartdev.dart
index f3d60c4..acebbf7 100644
--- a/pkg/dartdev/lib/dartdev.dart
+++ b/pkg/dartdev/lib/dartdev.dart
@@ -35,7 +35,7 @@
 
 /// This is typically called from bin/, but given the length of the method and
 /// analytics logic, it has been moved here.
-Future<void> runDartdev(List<String> args, SendPort port) async {
+Future<void> runDartdev(List<String> args, SendPort? port) async {
   VmInteropHandler.initialize(port);
 
   // TODO(sigurdm): Remove when top-level pub is removed.
@@ -61,7 +61,7 @@
   // Finally, call the runner to execute the command; see DartdevRunner.
 
   final runner = DartdevRunner(args);
-  var exitCode = 1;
+  int? exitCode = 1;
   try {
     exitCode = await runner.run(args);
   } on UsageException catch (e) {
@@ -86,7 +86,7 @@
 
   final bool verbose;
 
-  Analytics _analytics;
+  late Analytics _analytics;
 
   DartdevRunner(List<String> args)
       : verbose = args.contains('-v') || args.contains('--verbose'),
@@ -128,6 +128,7 @@
           () => analytics,
           dependencyKindCustomDimensionName: dependencyKindCustomDimensionName,
         ),
+        isVerbose: () => verbose,
       ),
     );
     addCommand(RunCommand(verbose: verbose));
@@ -221,15 +222,15 @@
 
     // The exit code for the dartdev process; null indicates that it has not been
     // set yet. The value is set in the catch and finally blocks below.
-    int exitCode;
+    int? exitCode;
 
     // Any caught non-UsageExceptions when running the sub command.
-    Object exception;
-    StackTrace stackTrace;
+    Object? exception;
+    StackTrace? stackTrace;
     try {
       exitCode = await super.runCommand(topLevelResults);
 
-      if (path != null && analytics.enabled) {
+      if (analytics.enabled) {
         // Send the event to analytics
         unawaited(
           sendUsageEvent(
@@ -242,7 +243,8 @@
                 // value.
                 //
                 // Note that this will also conflate short-options and long-options.
-                command?.options?.where(command.wasParsed)?.toList(),
+                command?.options.where(command.wasParsed).toList() ??
+                    const <String>[],
             specifiedExperiments: topLevelResults.enabledExperiments,
           ),
         );
@@ -263,7 +265,7 @@
       if (analytics.enabled) {
         unawaited(
           analytics.sendTiming(
-            path ?? '',
+            path,
             stopwatch.elapsedMilliseconds,
             category: 'commands',
           ),
diff --git a/pkg/dartdev/lib/src/analysis_server.dart b/pkg/dartdev/lib/src/analysis_server.dart
index 970d4a8..e8ae525 100644
--- a/pkg/dartdev/lib/src/analysis_server.dart
+++ b/pkg/dartdev/lib/src/analysis_server.dart
@@ -14,7 +14,6 @@
         EditBulkFixesResult,
         ResponseDecoder;
 import 'package:args/args.dart';
-import 'package:meta/meta.dart';
 import 'package:path/path.dart' as path;
 
 import 'core.dart';
@@ -23,7 +22,7 @@
 
 /// When set, this function is executed just before the Analysis Server starts.
 void Function(String cmdName, List<FileSystemEntity> analysisRoots,
-    ArgResults argResults) preAnalysisServerStart;
+    ArgResults? argResults)? preAnalysisServerStart;
 
 /// A class to provide an API wrapper around an analysis server process.
 class AnalysisServer {
@@ -32,18 +31,18 @@
     this.sdkPath,
     this.analysisRoots, {
     this.cacheDirectoryPath,
-    @required this.commandName,
-    @required this.argResults,
+    required this.commandName,
+    required this.argResults,
   });
 
-  final String cacheDirectoryPath;
-  final File packagesFile;
+  final String? cacheDirectoryPath;
+  final File? packagesFile;
   final Directory sdkPath;
   final List<FileSystemEntity> analysisRoots;
   final String commandName;
-  final ArgResults argResults;
+  final ArgResults? argResults;
 
-  Process _process;
+  Process? _process;
 
   Completer<bool> _analysisFinished = Completer();
 
@@ -53,8 +52,8 @@
     // {"event":"server.status","params":{"analysis":{"isAnalyzing":true}}}
     return _streamController('server.status')
         .stream
-        .where((event) => event['analysis'] != null)
-        .map((event) => event['analysis']['isAnalyzing'] as bool);
+        .where((event) => event!['analysis'] != null)
+        .map((event) => (event!['analysis']['isAnalyzing']!) as bool);
   }
 
   /// This future completes when we next receive an analysis finished event
@@ -65,7 +64,7 @@
   Stream<FileAnalysisErrors> get onErrors {
     // {"event":"analysis.errors","params":{"file":"/Users/.../lib/main.dart","errors":[]}}
     return _streamController('analysis.errors').stream.map((event) {
-      final file = event['file'] as String;
+      final file = event!['file'] as String;
       final errorsList = event['errors'] as List<dynamic>;
       final errors = errorsList
           .map<Map<String, dynamic>>(castStringKeyedMap)
@@ -76,7 +75,7 @@
     });
   }
 
-  Future<int> get onExit => _process.exitCode;
+  Future<int> get onExit => _process!.exitCode;
 
   final Map<String, StreamController<Map<String, dynamic>>> _streamControllers =
       {};
@@ -94,19 +93,19 @@
       '--sdk',
       sdkPath.path,
       if (cacheDirectoryPath != null) '--cache=$cacheDirectoryPath',
-      if (packagesFile != null) '--packages=${packagesFile.path}',
+      if (packagesFile != null) '--packages=${packagesFile!.path}',
     ];
 
     _process = await startDartProcess(sdk, command);
     // This callback hookup can't throw.
-    _process.exitCode.whenComplete(() => _process = null);
+    _process!.exitCode.whenComplete(() => _process = null);
 
-    final Stream<String> errorStream = _process.stderr
+    final Stream<String> errorStream = _process!.stderr
         .transform<String>(utf8.decoder)
         .transform<String>(const LineSplitter());
     errorStream.listen(log.stderr);
 
-    final Stream<String> inStream = _process.stdout
+    final Stream<String> inStream = _process!.stdout
         .transform<String>(utf8.decoder)
         .transform<String>(const LineSplitter());
     inStream.listen(_handleServerResponse);
@@ -125,7 +124,7 @@
     // be passed to the analysis server.
     List<String> analysisRootPaths = analysisRoots.map((root) {
       return trimEnd(
-          root.absolute.resolveSymbolicLinksSync(), path.context.separator);
+          root.absolute.resolveSymbolicLinksSync(), path.context.separator)!;
     }).toList();
 
     onAnalyzing.listen((bool isAnalyzing) {
@@ -178,7 +177,7 @@
   }
 
   Future<Map<String, dynamic>> _sendCommand(String method,
-      {Map<String, dynamic> params}) {
+      {Map<String, dynamic>? params}) {
     final String id = (++_id).toString();
     final String message = json.encode(<String, dynamic>{
       'id': id,
@@ -187,11 +186,11 @@
     });
 
     _requestCompleters[id] = Completer();
-    _process.stdin.writeln(message);
+    _process!.stdin.writeln(message);
 
     log.trace('==> $message');
 
-    return _requestCompleters[id].future;
+    return _requestCompleters[id]!.future;
   }
 
   void _handleServerResponse(String line) {
@@ -216,27 +215,28 @@
               .remove(id)
               ?.completeError(RequestError.parse(error));
         } else {
-          _requestCompleters.remove(id)?.complete(response['result']);
+          _requestCompleters.remove(id)?.complete(response['result'] ?? {});
         }
       }
     }
   }
 
-  void _handleServerError(Map<String, dynamic> error) {
+  void _handleServerError(Map<String, dynamic>? error) {
+    final err = error!;
     // Fields are 'isFatal', 'message', and 'stackTrace'.
-    log.stderr('Error from the analysis server: ${error['message']}');
-    if (error['stackTrace'] != null) {
-      log.stderr(error['stackTrace'] as String);
+    log.stderr('Error from the analysis server: ${err['message']}');
+    if (err['stackTrace'] != null) {
+      log.stderr(err['stackTrace'] as String);
     }
   }
 
-  StreamController<Map<String, dynamic>> _streamController(String streamId) {
+  StreamController<Map<String, dynamic>?> _streamController(String streamId) {
     return _streamControllers.putIfAbsent(
         streamId, () => StreamController<Map<String, dynamic>>.broadcast());
   }
 
   Future<bool> dispose() async {
-    return _process?.kill();
+    return _process?.kill() ?? true;
   }
 }
 
@@ -262,10 +262,10 @@
   // },"message":"...","hasFix":false}
   Map<String, dynamic> json;
 
-  String get severity => json['severity'] as String;
+  String? get severity => json['severity'] as String?;
 
   _AnalysisSeverity get _severityLevel =>
-      _severityMap[severity] ?? _AnalysisSeverity.none;
+      _severityMap[severity!] ?? _AnalysisSeverity.none;
 
   bool get isInfo => _severityLevel == _AnalysisSeverity.info;
 
@@ -279,26 +279,26 @@
 
   String get code => json['code'] as String;
 
-  String get correction => json['correction'] as String;
+  String? get correction => json['correction'] as String?;
 
-  int get endColumn => json['location']['endColumn'] as int;
+  int? get endColumn => json['location']['endColumn'] as int?;
 
-  int get endLine => json['location']['endLine'] as int;
+  int? get endLine => json['location']['endLine'] as int?;
 
   String get file => json['location']['file'] as String;
 
-  int get startLine => json['location']['startLine'] as int;
+  int? get startLine => json['location']['startLine'] as int?;
 
-  int get startColumn => json['location']['startColumn'] as int;
+  int? get startColumn => json['location']['startColumn'] as int?;
 
   int get offset => json['location']['offset'] as int;
 
   int get length => json['location']['length'] as int;
 
-  String get url => json['url'] as String;
+  String? get url => json['url'] as String?;
 
   List<DiagnosticMessage> get contextMessages {
-    var messages = json['contextMessages'] as List<dynamic>;
+    var messages = json['contextMessages'] as List<dynamic>?;
     if (messages == null) {
       // The field is optional, so we return an empty list as a default value.
       return [];
@@ -326,7 +326,7 @@
   }
 
   @override
-  String toString() => '${severity.toLowerCase()} • '
+  String toString() => '${severity!.toLowerCase()} • '
       '$message • $file:$startLine:$startColumn • '
       '($code)';
 }
@@ -336,11 +336,11 @@
 
   DiagnosticMessage(this.json);
 
-  int get column => json['location']['startColumn'] as int;
+  int? get column => json['location']['startColumn'] as int?;
 
-  int get endColumn => json['location']['endColumn'] as int;
+  int? get endColumn => json['location']['endColumn'] as int?;
 
-  int get endLine => json['location']['endLine'] as int;
+  int? get endLine => json['location']['endLine'] as int?;
 
   String get filePath => json['location']['file'] as String;
 
@@ -373,7 +373,7 @@
   final String message;
   final String stackTrace;
 
-  RequestError(this.code, this.message, {this.stackTrace});
+  RequestError(this.code, this.message, {required this.stackTrace});
 
   @override
   String toString() => '[RequestError code: $code, message: $message]';
diff --git a/pkg/dartdev/lib/src/analytics.dart b/pkg/dartdev/lib/src/analytics.dart
index 3072c34..7b69d8e 100644
--- a/pkg/dartdev/lib/src/analytics.dart
+++ b/pkg/dartdev/lib/src/analytics.dart
@@ -101,7 +101,7 @@
 ///
 /// This can return null under some conditions, including when the user's home
 /// directory does not exist.
-Directory getDartStorageDirectory() {
+Directory? getDartStorageDirectory() {
   var homeDir = Directory(userHomeDir());
   if (!homeDir.existsSync()) {
     return null;
@@ -133,11 +133,11 @@
     }
 
     // If there's no explicit setting (enabled or disabled) then we don't send.
-    return (properties['enabled'] as bool) ?? false;
+    return (properties['enabled'] as bool?) ?? false;
   }
 
   bool get disclosureShownOnTerminal =>
-      (properties['disclosureShown'] as bool) ?? false;
+      (properties['disclosureShown'] as bool?) ?? false;
 
   set disclosureShownOnTerminal(bool value) {
     properties['disclosureShown'] = value;
@@ -171,7 +171,7 @@
   bool get firstRun => false;
 
   @override
-  Future sendScreenView(String viewName, {Map<String, String> parameters}) {
+  Future sendScreenView(String viewName, {Map<String, String>? parameters}) {
     parameters ??= <String, String>{};
     parameters['viewName'] = viewName;
     return _log('screenView', parameters);
@@ -179,7 +179,7 @@
 
   @override
   Future sendEvent(String category, String action,
-      {String label, int value, Map<String, String> parameters}) {
+      {String? label, int? value, Map<String, String>? parameters}) {
     parameters ??= <String, String>{};
     return _log(
         'event',
@@ -193,7 +193,7 @@
 
   @override
   Future sendTiming(String variableName, int time,
-      {String category, String label}) {
+      {String? category, String? label}) {
     return _log('timing', {
       'variableName': variableName,
       'time': time,
diff --git a/pkg/dartdev/lib/src/commands/analyze.dart b/pkg/dartdev/lib/src/commands/analyze.dart
index 2c8837b..1112fe8 100644
--- a/pkg/dartdev/lib/src/commands/analyze.dart
+++ b/pkg/dartdev/lib/src/commands/analyze.dart
@@ -82,12 +82,13 @@
 
   @override
   FutureOr<int> run() async {
+    final args = argResults!;
     // Find targets from the 'rest' params.
     final List<io.FileSystemEntity> targets = [];
-    if (argResults.rest.isEmpty) {
+    if (args.rest.isEmpty) {
       targets.add(io.Directory.current);
     } else {
-      for (String targetPath in argResults.rest) {
+      for (String targetPath in args.rest) {
         if (io.Directory(targetPath).existsSync()) {
           targets.add(io.Directory(targetPath));
         } else if (io.File(targetPath).existsSync()) {
@@ -100,8 +101,8 @@
 
     final List<AnalysisError> errors = <AnalysisError>[];
 
-    final machineFormat = argResults['format'] == 'machine';
-    final jsonFormat = argResults['format'] == 'json';
+    final machineFormat = args['format'] == 'machine';
+    final jsonFormat = args['format'] == 'json';
 
     final targetsNames =
         targets.map((entity) => path.basename(entity.path)).join(', ');
@@ -113,9 +114,9 @@
       _packagesFile(),
       io.Directory(sdk.sdkPath),
       targets,
-      cacheDirectoryPath: argResults['cache'],
+      cacheDirectoryPath: args['cache'],
       commandName: 'analyze',
-      argResults: argResults,
+      argResults: args,
     );
 
     server.onErrors.listen((FileAnalysisErrors fileErrors) {
@@ -160,7 +161,9 @@
       emitDefaultFormat(
         log,
         errors,
-        relativeToDir: relativeTo is io.File ? relativeTo.parent : relativeTo,
+        relativeToDir: relativeTo is io.File
+            ? relativeTo.parent
+            : relativeTo as io.Directory?,
         verbose: verbose,
       );
     }
@@ -181,8 +184,8 @@
       return 3;
     }
 
-    bool fatalWarnings = argResults['fatal-warnings'];
-    bool fatalInfos = argResults['fatal-infos'];
+    bool fatalWarnings = args['fatal-warnings'];
+    bool fatalInfos = args['fatal-infos'];
 
     if (fatalWarnings && hasWarnings) {
       return 2;
@@ -193,8 +196,8 @@
     }
   }
 
-  io.File _packagesFile() {
-    var path = argResults['packages'];
+  io.File? _packagesFile() {
+    var path = argResults!['packages'];
     if (path is String) {
       var file = io.File(path);
       if (!file.existsSync()) {
@@ -210,7 +213,7 @@
   static void emitDefaultFormat(
     Logger log,
     List<AnalysisError> errors, {
-    io.Directory relativeToDir,
+    io.Directory? relativeToDir,
     bool verbose = false,
   }) {
     final ansi = log.ansi;
@@ -220,10 +223,10 @@
 
     final wrapWidth = dartdevUsageLineLength == null
         ? null
-        : (dartdevUsageLineLength - _bodyIndentWidth);
+        : (dartdevUsageLineLength! - _bodyIndentWidth);
 
     for (final AnalysisError error in errors) {
-      var severity = error.severity.toLowerCase().padLeft(_severityWidth);
+      var severity = error.severity!.toLowerCase().padLeft(_severityWidth);
       if (error.isError) {
         severity = ansi.error(severity);
       }
@@ -231,7 +234,7 @@
       var codeRef = error.code;
       // If we're in verbose mode, write any error urls instead of error codes.
       if (error.url != null && verbose) {
-        codeRef = error.url;
+        codeRef = error.url!;
       }
 
       // Emit "file:line:col * Error message. Correction (code)."
@@ -278,7 +281,7 @@
           'range': range,
         };
 
-    Map<String, dynamic> position(int offset, int line, int column) => {
+    Map<String, dynamic> position(int? offset, int? line, int? column) => {
           'offset': offset,
           'line': line,
           'column': column,
@@ -364,8 +367,8 @@
   }
 
   /// Return a relative path if it is a shorter reference than the given dir.
-  static String _relativePath(String givenPath, io.Directory fromDir) {
-    String fromPath = fromDir?.absolute?.resolveSymbolicLinksSync();
+  static String _relativePath(String givenPath, io.Directory? fromDir) {
+    String? fromPath = fromDir?.absolute.resolveSymbolicLinksSync();
     String relative = path.relative(givenPath, from: fromPath);
     return relative.length <= givenPath.length ? relative : givenPath;
   }
diff --git a/pkg/dartdev/lib/src/commands/compile.dart b/pkg/dartdev/lib/src/commands/compile.dart
index bd48713..6e3d600 100644
--- a/pkg/dartdev/lib/src/commands/compile.dart
+++ b/pkg/dartdev/lib/src/commands/compile.dart
@@ -21,14 +21,14 @@
 class Option {
   final String flag;
   final String help;
-  final String abbr;
-  final String defaultsTo;
-  final List<String> allowed;
-  final Map<String, String> allowedHelp;
+  final String? abbr;
+  final String? defaultsTo;
+  final List<String>? allowed;
+  final Map<String, String>? allowedHelp;
 
   Option(
-      {this.flag,
-      this.help,
+      {required this.flag,
+      required this.help,
       this.abbr,
       this.defaultsTo,
       this.allowed,
@@ -71,7 +71,7 @@
   @override
   final ArgParser argParser = ArgParser.allowAnything();
 
-  CompileJSCommand({bool verbose})
+  CompileJSCommand({bool verbose = false})
       : super(cmdName, 'Compile Dart to JavaScript.', verbose);
 
   @override
@@ -91,7 +91,7 @@
           '--libraries-spec=$librariesPath',
           '--cfe-invocation-modes=compile',
           '--invoker=dart_cli',
-          ...argResults.arguments,
+          ...argResults!.arguments,
         ],
         packageConfigOverride: null);
 
@@ -109,25 +109,25 @@
   final String formatName;
 
   CompileSnapshotCommand({
-    this.commandName,
-    this.help,
-    this.fileExt,
-    this.formatName,
-    bool verbose,
+    required this.commandName,
+    required this.help,
+    required this.fileExt,
+    required this.formatName,
+    bool verbose = false,
   }) : super(commandName, 'Compile Dart $help', verbose) {
     argParser
       ..addOption(
-        commonOptions['outputFile'].flag,
-        help: commonOptions['outputFile'].help,
-        abbr: commonOptions['outputFile'].abbr,
+        commonOptions['outputFile']!.flag,
+        help: commonOptions['outputFile']!.help,
+        abbr: commonOptions['outputFile']!.abbr,
       )
       ..addOption(
-        commonOptions['verbosity'].flag,
-        help: commonOptions['verbosity'].help,
-        abbr: commonOptions['verbosity'].abbr,
-        defaultsTo: commonOptions['verbosity'].defaultsTo,
-        allowed: commonOptions['verbosity'].allowed,
-        allowedHelp: commonOptions['verbosity'].allowedHelp,
+        commonOptions['verbosity']!.flag,
+        help: commonOptions['verbosity']!.help,
+        abbr: commonOptions['verbosity']!.abbr,
+        defaultsTo: commonOptions['verbosity']!.defaultsTo,
+        allowed: commonOptions['verbosity']!.allowed,
+        allowedHelp: commonOptions['verbosity']!.allowedHelp,
       );
 
     addExperimentalFlags(argParser, verbose);
@@ -146,20 +146,21 @@
 
   @override
   FutureOr<int> run() async {
-    if (argResults.rest.isEmpty) {
+    final args = argResults!;
+    if (args.rest.isEmpty) {
       // This throws.
       usageException('Missing Dart entry point.');
-    } else if (!isJitSnapshot && argResults.rest.length > 1) {
+    } else if (!isJitSnapshot && args.rest.length > 1) {
       usageException('Unexpected arguments after Dart entry point.');
     }
 
-    final String sourcePath = argResults.rest[0];
+    final String sourcePath = args.rest[0];
     if (!checkFile(sourcePath)) {
       return -1;
     }
 
     // Determine output file name.
-    String outputFile = argResults[commonOptions['outputFile'].flag];
+    String? outputFile = args[commonOptions['outputFile']!.flag];
     if (outputFile == null) {
       final inputWithoutDart = sourcePath.endsWith('.dart')
           ? sourcePath.substring(0, sourcePath.length - 5)
@@ -167,31 +168,31 @@
       outputFile = '$inputWithoutDart.$fileExt';
     }
 
-    final enabledExperiments = argResults.enabledExperiments;
+    final enabledExperiments = args.enabledExperiments;
     // Build arguments.
-    List<String> args = [];
-    args.add('--snapshot-kind=$formatName');
-    args.add('--snapshot=${path.canonicalize(outputFile)}');
+    List<String> buildArgs = [];
+    buildArgs.add('--snapshot-kind=$formatName');
+    buildArgs.add('--snapshot=${path.canonicalize(outputFile)}');
 
-    String verbosity = argResults[commonOptions['verbosity'].flag];
-    args.add('--verbosity=$verbosity');
+    String? verbosity = args[commonOptions['verbosity']!.flag];
+    buildArgs.add('--verbosity=$verbosity');
 
     if (enabledExperiments.isNotEmpty) {
-      args.add("--enable-experiment=${enabledExperiments.join(',')}");
+      buildArgs.add("--enable-experiment=${enabledExperiments.join(',')}");
     }
     if (verbose) {
-      args.add('-v');
+      buildArgs.add('-v');
     }
-    args.add(path.canonicalize(sourcePath));
+    buildArgs.add(path.canonicalize(sourcePath));
 
     // Add the training arguments.
-    if (argResults.rest.length > 1) {
-      args.addAll(argResults.rest.sublist(1));
+    if (args.rest.length > 1) {
+      buildArgs.addAll(args.rest.sublist(1));
     }
 
     log.stdout('Compiling $sourcePath to $commandName file $outputFile.');
     // TODO(bkonyi): perform compilation in same process.
-    final process = await startDartProcess(sdk, args);
+    final process = await startDartProcess(sdk, buildArgs);
     routeToStdout(process);
     return process.exitCode;
   }
@@ -206,24 +207,24 @@
   final String help;
 
   CompileNativeCommand({
-    this.commandName,
-    this.format,
-    this.help,
-    bool verbose,
+    required this.commandName,
+    required this.format,
+    required this.help,
+    bool verbose = false,
   }) : super(commandName, 'Compile Dart $help', verbose) {
     argParser
       ..addOption(
-        commonOptions['outputFile'].flag,
-        help: commonOptions['outputFile'].help,
-        abbr: commonOptions['outputFile'].abbr,
+        commonOptions['outputFile']!.flag,
+        help: commonOptions['outputFile']!.help,
+        abbr: commonOptions['outputFile']!.abbr,
       )
       ..addOption(
-        commonOptions['verbosity'].flag,
-        help: commonOptions['verbosity'].help,
-        abbr: commonOptions['verbosity'].abbr,
-        defaultsTo: commonOptions['verbosity'].defaultsTo,
-        allowed: commonOptions['verbosity'].allowed,
-        allowedHelp: commonOptions['verbosity'].allowedHelp,
+        commonOptions['verbosity']!.flag,
+        help: commonOptions['verbosity']!.help,
+        abbr: commonOptions['verbosity']!.abbr,
+        defaultsTo: commonOptions['verbosity']!.defaultsTo,
+        allowed: commonOptions['verbosity']!.allowed,
+        allowedHelp: commonOptions['verbosity']!.allowedHelp,
       )
       ..addMultiOption('define', abbr: 'D', valueHelp: 'key=value', help: '''
 Define an environment declaration. To specify multiple declarations, use multiple options or use commas to separate key-value pairs.
@@ -269,13 +270,14 @@
           "'dart compile $format' is not supported on x86 architectures");
       return 64;
     }
+    final args = argResults!;
+
     // We expect a single rest argument; the dart entry point.
-    if (argResults.rest.length != 1) {
+    if (args.rest.length != 1) {
       // This throws.
       usageException('Missing Dart entry point.');
     }
-
-    final String sourcePath = argResults.rest[0];
+    final String sourcePath = args.rest[0];
     if (!checkFile(sourcePath)) {
       return -1;
     }
@@ -284,16 +286,16 @@
       await generateNative(
         kind: format,
         sourceFile: sourcePath,
-        outputFile: argResults['output'],
-        defines: argResults['define'],
-        packages: argResults['packages'],
-        enableAsserts: argResults['enable-asserts'],
-        enableExperiment: argResults.enabledExperiments.join(','),
-        soundNullSafety: argResults['sound-null-safety'],
-        debugFile: argResults['save-debugging-info'],
+        outputFile: args['output'],
+        defines: args['define'],
+        packages: args['packages'],
+        enableAsserts: args['enable-asserts'],
+        enableExperiment: args.enabledExperiments.join(','),
+        soundNullSafety: args['sound-null-safety'],
+        debugFile: args['save-debugging-info'],
         verbose: verbose,
-        verbosity: argResults['verbosity'],
-        extraOptions: argResults['extra-gen-snapshot-options'],
+        verbosity: args['verbosity'],
+        extraOptions: args['extra-gen-snapshot-options'],
       );
       return 0;
     } catch (e) {
diff --git a/pkg/dartdev/lib/src/commands/create.dart b/pkg/dartdev/lib/src/commands/create.dart
index 9819614..8d20bee 100644
--- a/pkg/dartdev/lib/src/commands/create.dart
+++ b/pkg/dartdev/lib/src/commands/create.dart
@@ -54,22 +54,23 @@
 
   @override
   FutureOr<int> run() async {
-    if (argResults['list-templates']) {
+    final args = argResults!;
+    if (args['list-templates']) {
       log.stdout(_availableTemplatesJson());
       return 0;
     }
 
-    if (argResults.rest.isEmpty) {
+    if (args.rest.isEmpty) {
       printUsage();
       return 1;
     }
 
-    String templateId = argResults['template'];
+    String templateId = args['template'];
 
-    String dir = argResults.rest.first;
+    String dir = args.rest.first;
     var targetDir = io.Directory(dir).absolute;
     dir = targetDir.path;
-    if (targetDir.existsSync() && !argResults['force']) {
+    if (targetDir.existsSync() && !args['force']) {
       log.stderr(
         "Directory '$dir' already exists "
         "(use '--force' to force project generation).",
@@ -95,13 +96,13 @@
     );
     log.stdout('');
 
-    var generator = getGenerator(templateId);
+    var generator = getGenerator(templateId)!;
     generator.generate(
       projectName,
       DirectoryGeneratorTarget(generator, io.Directory(dir)),
     );
 
-    if (argResults['pub']) {
+    if (args['pub']) {
       log.stdout('');
       var progress = log.progress('Running pub get');
       var process = await startDartProcess(
@@ -137,7 +138,7 @@
     log.stdout('');
     log.stdout(generator.getInstallInstructions(
       dir,
-      projectName,
+      scriptPath: projectName,
     ));
     log.stdout('');
 
@@ -164,7 +165,7 @@
       };
 
       if (generator.entrypoint != null) {
-        m['entrypoint'] = generator.entrypoint.path;
+        m['entrypoint'] = generator.entrypoint!.path;
       }
 
       return m;
diff --git a/pkg/dartdev/lib/src/commands/debug_adapter.dart b/pkg/dartdev/lib/src/commands/debug_adapter.dart
index e1a87b5..817f91b 100644
--- a/pkg/dartdev/lib/src/commands/debug_adapter.dart
+++ b/pkg/dartdev/lib/src/commands/debug_adapter.dart
@@ -53,7 +53,7 @@
 
   @override
   FutureOr<int> run() async {
-    final args = argResults;
+    final args = argResults!;
     final ipv6 = args[argIpv6] as bool;
 
     final server = DapServer(
diff --git a/pkg/dartdev/lib/src/commands/devtools.dart b/pkg/dartdev/lib/src/commands/devtools.dart
index e01c6bb..35d216c 100644
--- a/pkg/dartdev/lib/src/commands/devtools.dart
+++ b/pkg/dartdev/lib/src/commands/devtools.dart
@@ -140,7 +140,7 @@
         hide: !verbose,
       );
 
-    // Deprecated and hidden argResults.
+    // Deprecated and hidden args.
     // TODO: Remove this - prefer that clients use the rest arg.
     argParser
       ..addOption(
@@ -150,7 +150,7 @@
         hide: true,
       )
 
-      // Development only argResults.
+      // Development only args.
       ..addFlag(
         argDebugMode,
         negatable: false,
@@ -159,7 +159,7 @@
       );
   }
 
-  final String customDevToolsPath;
+  final String? customDevToolsPath;
 
   @override
   String get name => 'devtools';
@@ -172,32 +172,30 @@
 
   @override
   Future<int> run() async {
-    final bool version = argResults[argVersion];
-    final bool machineMode = argResults[argMachine];
+    final args = argResults!;
+    final bool version = args[argVersion];
+    final bool machineMode = args[argMachine];
     // launchBrowser defaults based on machine-mode if not explicitly supplied.
-    final bool launchBrowser = argResults.wasParsed(argLaunchBrowser)
-        ? argResults[argLaunchBrowser]
+    final bool launchBrowser = args.wasParsed(argLaunchBrowser)
+        ? args[argLaunchBrowser]
         : !machineMode;
-    final bool enableNotifications = argResults[argEnableNotifications];
-    final bool allowEmbedding = argResults.wasParsed(argAllowEmbedding)
-        ? argResults[argAllowEmbedding]
-        : true;
+    final bool enableNotifications = args[argEnableNotifications];
+    final bool allowEmbedding =
+        args.wasParsed(argAllowEmbedding) ? args[argAllowEmbedding] : true;
 
-    final port = argResults[argPort] != null
-        ? int.tryParse(argResults[argPort]) ?? 0
-        : 0;
+    final port = args[argPort] != null ? int.tryParse(args[argPort]) ?? 0 : 0;
 
-    final bool headlessMode = argResults[argHeadlessMode];
-    final bool debugMode = argResults[argDebugMode];
+    final bool headlessMode = args[argHeadlessMode];
+    final bool debugMode = args[argDebugMode];
 
-    final numPortsToTry = argResults[argTryPorts] != null
-        ? int.tryParse(argResults[argTryPorts]) ?? 0
+    final numPortsToTry = args[argTryPorts] != null
+        ? int.tryParse(args[argTryPorts]) ?? 0
         : DevToolsServer.defaultTryPorts;
 
-    final bool verboseMode = argResults[argVerbose];
-    final String hostname = argResults[argHost];
-    final String appSizeBase = argResults[argAppSizeBase];
-    final String appSizeTest = argResults[argAppSizeTest];
+    final bool verboseMode = args[argVerbose];
+    final String? hostname = args[argHost];
+    final String? appSizeBase = args[argAppSizeBase];
+    final String? appSizeTest = args[argAppSizeTest];
 
     final sdkDir = path.dirname(sdk.dart);
     final fullSdk = sdkDir.endsWith('bin');
@@ -213,22 +211,22 @@
         },
         machineMode: machineMode,
       );
-      return null;
+      return 0;
     }
 
-    // Prefer getting the VM URI from the rest argResults; fall back on the 'vm-url'
+    // Prefer getting the VM URI from the rest args; fall back on the 'vm-url'
     // option otherwise.
-    String serviceProtocolUri;
-    if (argResults.rest.isNotEmpty) {
-      serviceProtocolUri = argResults.rest.first;
-    } else if (argResults.wasParsed(argVmUri)) {
-      serviceProtocolUri = argResults[argVmUri];
+    String? serviceProtocolUri;
+    if (args.rest.isNotEmpty) {
+      serviceProtocolUri = args.rest.first;
+    } else if (args.wasParsed(argVmUri)) {
+      serviceProtocolUri = args[argVmUri];
     }
 
     // Support collecting profile data.
-    String profileFilename;
-    if (argResults.wasParsed(argProfileMemory)) {
-      profileFilename = argResults[argProfileMemory];
+    String? profileFilename;
+    if (args.wasParsed(argProfileMemory)) {
+      profileFilename = args[argProfileMemory];
     }
     if (profileFilename != null && !path.isAbsolute(profileFilename)) {
       profileFilename = path.absolute(profileFilename);
diff --git a/pkg/dartdev/lib/src/commands/doc.dart b/pkg/dartdev/lib/src/commands/doc.dart
index 69826d4..11e1df7 100644
--- a/pkg/dartdev/lib/src/commands/doc.dart
+++ b/pkg/dartdev/lib/src/commands/doc.dart
@@ -59,18 +59,19 @@
   @override
   FutureOr<int> run() async {
     final options = <String>[];
+    final args = argResults!;
 
-    if (argResults['sdk-docs']) {
+    if (args['sdk-docs']) {
       options.add('--sdk-docs');
     } else {
       // At least one argument, the input directory, is required,
       // when we're not generating docs for the Dart SDK.
-      if (argResults.rest.isEmpty) {
+      if (args.rest.isEmpty) {
         usageException("Error: Input directory not specified");
       }
 
       // Determine input directory.
-      final dir = io.Directory(argResults.rest[0]);
+      final dir = io.Directory(args.rest[0]);
       if (!dir.existsSync()) {
         usageException("Error: Input directory doesn't exist: ${dir.path}");
       }
@@ -83,10 +84,10 @@
 
     // Build remaining options.
     options.addAll([
-      '--output=${argResults['output']}',
+      '--output=${args['output']}',
       '--resources-dir=$resourcesPath',
-      if (argResults['validate-links']) '--validate-links',
-      if (argResults['dry-run']) '--no-generate-docs',
+      if (args['validate-links']) '--validate-links',
+      if (args['dry-run']) '--no-generate-docs',
       if (verbose) '--no-quiet',
     ]);
 
diff --git a/pkg/dartdev/lib/src/commands/fix.dart b/pkg/dartdev/lib/src/commands/fix.dart
index 1bdb252..8fd6db9 100644
--- a/pkg/dartdev/lib/src/commands/fix.dart
+++ b/pkg/dartdev/lib/src/commands/fix.dart
@@ -6,7 +6,7 @@
 import 'dart:io' as io;
 
 import 'package:analysis_server_client/protocol.dart' hide AnalysisError;
-import 'package:meta/meta.dart';
+import 'package:cli_util/cli_logging.dart' show Progress;
 import 'package:path/path.dart' as path;
 
 import '../analysis_server.dart';
@@ -54,7 +54,7 @@
 
   @override
   String get description {
-    if (log != null && log.ansi.useAnsi) {
+    if (log.ansi.useAnsi) {
       return cmdDescription
           .replaceAll('[', log.ansi.bold)
           .replaceAll(']', log.ansi.none);
@@ -65,15 +65,16 @@
 
   @override
   FutureOr<int> run() async {
-    var dryRun = argResults['dry-run'];
-    var inTestMode = argResults['compare-to-golden'];
-    var apply = argResults['apply'];
+    final args = argResults!;
+    var dryRun = args['dry-run'];
+    var inTestMode = args['compare-to-golden'];
+    var apply = args['apply'];
     if (!apply && !dryRun && !inTestMode) {
       printUsage();
       return 0;
     }
 
-    var arguments = argResults.rest;
+    var arguments = args.rest;
     var argumentCount = arguments.length;
     if (argumentCount > 1) {
       usageException('Only one file or directory is expected.');
@@ -90,7 +91,7 @@
     var modeText = dryRun ? ' (dry run)' : '';
 
     final projectName = path.basename(dirPath);
-    var computeFixesProgress = log.progress(
+    Progress? computeFixesProgress = log.progress(
         'Computing fixes in ${log.ansi.emphasized(projectName)}$modeText');
 
     var server = AnalysisServer(
@@ -131,7 +132,7 @@
     await server.shutdown();
 
     if (computeFixesProgress != null) {
-      computeFixesProgress.finish(showTiming: true);
+      computeFixesProgress!.finish(showTiming: true);
       computeFixesProgress = null;
     }
 
@@ -145,7 +146,8 @@
       var fileCount = detailsMap.length;
       var fixCount = detailsMap.values
           .expand((detail) => detail.fixes)
-          .fold(0, (previousValue, fixes) => previousValue + fixes.occurrences);
+          .fold<int>(0,
+              (int previousValue, fixes) => previousValue + fixes.occurrences);
 
       if (dryRun) {
         log.stdout('');
@@ -221,7 +223,7 @@
         var actualIsOriginal = !fileContentCache.containsKey(filePath);
         var actualCode = actualIsOriginal
             ? originalFile.readAsStringSync()
-            : fileContentCache[filePath];
+            : fileContentCache[filePath]!;
         // Use a whitespace insensitive comparison.
         if (_compressWhitespace(actualCode) !=
             _compressWhitespace(expectedCode)) {
@@ -305,7 +307,7 @@
     modifiedFilePaths
         .sort((first, second) => relative(first).compareTo(relative(second)));
     for (var filePath in modifiedFilePaths) {
-      var detail = detailsMap[filePath];
+      var detail = detailsMap[filePath]!;
       log.stdout(relative(detail.path));
       final fixes = detail.fixes.toList();
       fixes.sort((a, b) => a.code.compareTo(b.code));
@@ -320,7 +322,7 @@
   /// Report that the [actualCode] produced by applying fixes to the content of
   /// [filePath] did not match the [expectedCode].
   void _reportFailure(String filePath, String actualCode, String expectedCode,
-      {@required bool actualIsOriginal}) {
+      {required bool actualIsOriginal}) {
     log.stdout('Failed when applying fixes to $filePath');
     log.stdout('Expected:');
     log.stdout(expectedCode);
diff --git a/pkg/dartdev/lib/src/commands/language_server.dart b/pkg/dartdev/lib/src/commands/language_server.dart
index 6de3df3..65eca06 100644
--- a/pkg/dartdev/lib/src/commands/language_server.dart
+++ b/pkg/dartdev/lib/src/commands/language_server.dart
@@ -40,7 +40,7 @@
   Future<int> run() async {
     final driver = server_driver.Driver();
     driver.start(
-      argResults.arguments,
+      argResults!.arguments,
       defaultToLsp: true,
     );
 
diff --git a/pkg/dartdev/lib/src/commands/migrate.dart b/pkg/dartdev/lib/src/commands/migrate.dart
index cb83e82..5064326 100644
--- a/pkg/dartdev/lib/src/commands/migrate.dart
+++ b/pkg/dartdev/lib/src/commands/migrate.dart
@@ -34,7 +34,7 @@
   FutureOr<int> run() async {
     var cli = MigrationCli(binaryName: 'dart $name');
     try {
-      await cli.decodeCommandLineArgs(argResults, isVerbose: verbose)?.run();
+      await cli.decodeCommandLineArgs(argResults!, isVerbose: verbose)?.run();
     } on MigrationExit catch (migrationExit) {
       return migrationExit.exitCode;
     }
diff --git a/pkg/dartdev/lib/src/commands/run.dart b/pkg/dartdev/lib/src/commands/run.dart
index 2ce7fbc..ea0ce59 100644
--- a/pkg/dartdev/lib/src/commands/run.dart
+++ b/pkg/dartdev/lib/src/commands/run.dart
@@ -196,22 +196,22 @@
 
   @override
   FutureOr<int> run() async {
+    final args = argResults!;
     var mainCommand = '';
     var runArgs = <String>[];
-    if (argResults.rest.isNotEmpty) {
-      mainCommand = argResults.rest.first;
+    if (args.rest.isNotEmpty) {
+      mainCommand = args.rest.first;
       // The command line arguments after the command name.
-      runArgs = argResults.rest.skip(1).toList();
+      runArgs = args.rest.skip(1).toList();
     }
-
     if (!isProductMode) {
       // --launch-dds is provided by the VM if the VM service is to be enabled. In
       // that case, we need to launch DDS as well.
-      String launchDdsArg = argResults['launch-dds'];
+      String? launchDdsArg = args['launch-dds'];
       String ddsHost = '';
       String ddsPort = '';
 
-      bool launchDevTools = argResults['serve-devtools'];
+      bool launchDevTools = args['serve-devtools'] ?? false;
       bool launchDds = false;
       if (launchDdsArg != null) {
         launchDds = true;
@@ -219,9 +219,9 @@
         ddsHost = ddsUrl[0];
         ddsPort = ddsUrl[1];
       }
-      final bool debugDds = argResults['debug-dds'];
+      final bool debugDds = args['debug-dds'];
 
-      bool disableServiceAuthCodes = argResults['disable-service-auth-codes'];
+      bool disableServiceAuthCodes = args['disable-service-auth-codes'];
 
       // If the user wants to start a debugging session we need to do some extra
       // work and spawn a Dart Development Service (DDS) instance. DDS is a VM
@@ -310,7 +310,7 @@
     const devToolsMessagePrefix =
         'The Dart DevTools debugger and profiler is available at:';
     if (debugDds) {
-      StreamSubscription stdoutSub;
+      late StreamSubscription stdoutSub;
       stdoutSub = process.stdout.transform(utf8.decoder).listen((event) {
         if (event.startsWith(devToolsMessagePrefix)) {
           final ddsDebuggingUri = event.split(' ').last;
@@ -321,7 +321,7 @@
         }
       });
     }
-    StreamSubscription stderrSub;
+    late StreamSubscription stderrSub;
     stderrSub = process.stderr.transform(utf8.decoder).listen((event) {
       final result = json.decode(event) as Map<String, dynamic>;
       final state = result['state'];
diff --git a/pkg/dartdev/lib/src/commands/test.dart b/pkg/dartdev/lib/src/commands/test.dart
index 36683af..31d7916 100644
--- a/pkg/dartdev/lib/src/commands/test.dart
+++ b/pkg/dartdev/lib/src/commands/test.dart
@@ -28,11 +28,12 @@
 
   @override
   FutureOr<int> run() async {
+    final args = argResults!;
     try {
       final testExecutable = await getExecutableForCommand('test:test');
-      log.trace('dart $testExecutable ${argResults.rest.join(' ')}');
-      VmInteropHandler.run(testExecutable.executable, argResults.rest,
-          packageConfigOverride: testExecutable.packageConfig);
+      log.trace('dart $testExecutable ${args.rest.join(' ')}');
+      VmInteropHandler.run(testExecutable.executable, args.rest,
+          packageConfigOverride: testExecutable.packageConfig!);
       return 0;
     } on CommandResolutionFailedException catch (e) {
       if (project.hasPubspecFile) {
@@ -45,8 +46,7 @@
         print(
             'No pubspec.yaml file found - run this command in your project folder.');
       }
-      if (argResults.rest.contains('-h') ||
-          argResults.rest.contains('--help')) {
+      if (args.rest.contains('-h') || args.rest.contains('--help')) {
         print('');
         printUsage();
       }
diff --git a/pkg/dartdev/lib/src/core.dart b/pkg/dartdev/lib/src/core.dart
index 3f4b340..439bdfd 100644
--- a/pkg/dartdev/lib/src/core.dart
+++ b/pkg/dartdev/lib/src/core.dart
@@ -15,19 +15,19 @@
 import 'sdk.dart';
 import 'utils.dart';
 
-Logger log;
+late Logger log;
 bool isDiagnostics = false;
 
 /// When set, this function is executed from the [DartdevCommand] constructor to
 /// contribute additional flags.
-void Function(ArgParser argParser, String cmdName) flagContributor;
+void Function(ArgParser argParser, String cmdName)? flagContributor;
 
 abstract class DartdevCommand extends Command<int> {
   final String _name;
   final String _description;
   final bool _verbose;
 
-  Project _project;
+  Project? _project;
 
   @override
   final bool hidden;
@@ -43,7 +43,7 @@
   @override
   String get description => _description;
 
-  ArgParser _argParser;
+  ArgParser? _argParser;
 
   @override
   ArgParser get argParser => _argParser ??= createArgParser();
@@ -70,16 +70,16 @@
 
 extension DartDevCommand on Command {
   /// Return whether commands should emit verbose output.
-  bool get verbose => globalResults['verbose'];
+  bool get verbose => globalResults!['verbose'];
 
   /// Return whether the tool should emit diagnostic output.
-  bool get diagnosticsEnabled => globalResults['diagnostics'];
+  bool get diagnosticsEnabled => globalResults!['diagnostics'];
 
   /// Return whether any Dart experiments were specified by the user.
   bool get wereExperimentsSpecified =>
       globalResults?.wasParsed(experimentFlagName) ?? false;
 
-  List<String> get specifiedExperiments => globalResults[experimentFlagName];
+  List<String> get specifiedExperiments => globalResults![experimentFlagName];
 }
 
 /// A utility method to start a Dart VM instance with the given arguments and an
@@ -89,7 +89,7 @@
 Future<Process> startDartProcess(
   Sdk sdk,
   List<String> arguments, {
-  String cwd,
+  String? cwd,
 }) {
   log.trace('${sdk.dart} ${arguments.join(' ')}');
   return Process.start(sdk.dart, arguments, workingDirectory: cwd);
@@ -98,7 +98,7 @@
 void routeToStdout(
   Process process, {
   bool logToTrace = false,
-  void Function(String str) listener,
+  void Function(String str)? listener,
 }) {
   if (isDiagnostics) {
     _streamLineTransform(process.stdout, (String line) {
@@ -136,7 +136,7 @@
 class Project {
   final Directory dir;
 
-  PackageConfig _packageConfig;
+  PackageConfig? _packageConfig;
 
   Project() : dir = Directory.current;
 
@@ -147,7 +147,7 @@
 
   bool get hasPackageConfigFile => packageConfig != null;
 
-  PackageConfig get packageConfig {
+  PackageConfig? get packageConfig {
     if (_packageConfig == null) {
       File file =
           File(path.join(dir.path, '.dart_tool', 'package_config.json'));
@@ -170,11 +170,11 @@
 
   PackageConfig(this.contents);
 
-  List<Map<String, dynamic>> get packages {
+  List<Map<String, dynamic>?> get packages {
     List<dynamic> _packages = contents['packages'];
-    return _packages.map<Map<String, dynamic>>(castStringKeyedMap).toList();
+    return _packages.map<Map<String, dynamic>?>(castStringKeyedMap).toList();
   }
 
   bool hasDependency(String packageName) =>
-      packages.any((element) => element['name'] == packageName);
+      packages.any((element) => element!['name'] == packageName);
 }
diff --git a/pkg/dartdev/lib/src/events.dart b/pkg/dartdev/lib/src/events.dart
index 65469c0..d2dad35 100644
--- a/pkg/dartdev/lib/src/events.dart
+++ b/pkg/dartdev/lib/src/events.dart
@@ -2,7 +2,6 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-import 'package:meta/meta.dart';
 import 'package:usage/usage.dart';
 
 /// The [String] identifier `dartdev`, used as the category in the events sent
@@ -54,17 +53,16 @@
 Future<void> sendUsageEvent(
   Analytics analytics,
   String action, {
-  String label,
-  List<String> specifiedExperiments,
-  @required int exitCode,
-  @required List<String> commandFlags,
+  String? label,
+  List<String>? specifiedExperiments,
+  required int? exitCode,
+  required List<String> commandFlags,
 }) {
   /// The category stores the name of this cli tool, 'dartdev'. This matches the
   /// pattern from the flutter cli tool which always passes 'flutter' as the
   /// category.
   final category = _dartdev;
-  commandFlags =
-      commandFlags?.where((e) => e != 'enable-experiment')?.toList() ?? [];
+  commandFlags = commandFlags.where((e) => e != 'enable-experiment').toList();
   specifiedExperiments = specifiedExperiments?.toList() ?? [];
 
   // Sort the flag lists to slightly reduce the explosion of possibilities.
diff --git a/pkg/dartdev/lib/src/experiments.dart b/pkg/dartdev/lib/src/experiments.dart
index 36d4bd8..70acd2a 100644
--- a/pkg/dartdev/lib/src/experiments.dart
+++ b/pkg/dartdev/lib/src/experiments.dart
@@ -4,6 +4,7 @@
 
 import 'package:analyzer/src/dart/analysis/experiments.dart';
 import 'package:args/args.dart';
+import 'package:collection/collection.dart' show IterableExtension;
 
 const experimentFlagName = 'enable-experiment';
 
@@ -53,9 +54,8 @@
       // look for --enable-experiment=. Currently, this path is only taken for
       // the pub and test commands, as well as when we are trying to send
       // analytics.
-      final String experiments = arguments.firstWhere(
+      final String? experiments = arguments.firstWhereOrNull(
         (e) => e.startsWith('--enable-experiment='),
-        orElse: () => null,
       );
       if (experiments == null) {
         return [];
diff --git a/pkg/dartdev/lib/src/sdk.dart b/pkg/dartdev/lib/src/sdk.dart
index 2f42de6..57b99c6 100644
--- a/pkg/dartdev/lib/src/sdk.dart
+++ b/pkg/dartdev/lib/src/sdk.dart
@@ -108,7 +108,7 @@
   /// The SDK's release channel (`be`, `dev`, `beta`, `stable`).
   ///
   /// May be null if [Platform.version] does not have the expected format.
-  final String /*?*/ channel;
+  final String? channel;
 
   Runtime._(this.version, this.channel);
 
@@ -116,7 +116,7 @@
     var versionString = Platform.version;
     // Exepcted format: "version (channel) ..."
     var version = versionString;
-    String /*?*/ channel;
+    String? channel;
     var versionEnd = versionString.indexOf(' ');
     if (versionEnd > 0) {
       version = versionString.substring(0, versionEnd);
diff --git a/pkg/dartdev/lib/src/templates.dart b/pkg/dartdev/lib/src/templates.dart
index 3d36844..ee1938a 100644
--- a/pkg/dartdev/lib/src/templates.dart
+++ b/pkg/dartdev/lib/src/templates.dart
@@ -4,6 +4,7 @@
 
 import 'dart:convert' show utf8;
 
+import 'package:collection/collection.dart' show IterableExtension;
 import 'package:meta/meta.dart';
 import 'package:path/path.dart' as p;
 
@@ -24,8 +25,8 @@
   WebSimpleGenerator(),
 ];
 
-Generator getGenerator(String id) =>
-    generators.firstWhere((g) => g.id == id, orElse: () => null);
+Generator? getGenerator(String id) =>
+    generators.firstWhereOrNull((g) => g.id == id);
 
 /// An abstract class which both defines a template generator and can generate a
 /// user project based on this template.
@@ -36,12 +37,12 @@
   final List<String> categories;
 
   final List<TemplateFile> files = [];
-  TemplateFile _entrypoint;
+  TemplateFile? _entrypoint;
 
   /// Lazily initialized cache for lower-case if [id].
   ///
   /// Used by [compareTo].
-  String /*?*/ _lowerCaseId;
+  String? _lowerCaseId;
 
   Generator(
     this.id,
@@ -54,7 +55,7 @@
 
   /// The entrypoint of the application; the main file for the project, which an
   /// IDE might open after creating the project.
-  TemplateFile get entrypoint => _entrypoint;
+  TemplateFile? get entrypoint => _entrypoint;
 
   TemplateFile addFile(String path, String contents) {
     return addTemplateFile(TemplateFile(path, contents));
@@ -67,22 +68,21 @@
   }
 
   /// Return the template file wih the given [path].
-  TemplateFile getFile(String path) =>
-      files.firstWhere((file) => file.path == path, orElse: () => null);
+  TemplateFile? getFile(String path) =>
+      files.firstWhereOrNull((file) => file.path == path);
 
   /// Set the main entrypoint of this template. This is the 'most important'
   /// file of this template. An IDE might use this information to open this file
   /// after the user's project is generated.
   void setEntrypoint(TemplateFile entrypoint) {
     if (_entrypoint != null) throw StateError('entrypoint already set');
-    if (entrypoint == null) throw StateError('entrypoint is null');
     _entrypoint = entrypoint;
   }
 
   void generate(
     String projectName,
     GeneratorTarget target, {
-    Map<String, String> additionalVars,
+    Map<String, String>? additionalVars,
   }) {
     final vars = {
       'projectName': projectName,
@@ -111,9 +111,9 @@
   /// (e.g., bin/foo.dart) **without** an extension. If null, the implicit run
   /// command will be output by default (e.g., dart run).
   String getInstallInstructions(
-    String directory,
-    String scriptPath,
-  ) {
+    String directory, {
+    String? scriptPath,
+  }) {
     final buffer = StringBuffer();
     buffer.writeln('  cd ${p.relative(directory)}');
     if (scriptPath != null) {
@@ -208,5 +208,5 @@
   }
 
   return str.replaceAllMapped(
-      _substituteRegExp, (match) => vars[match[1]] ?? match[0]);
+      _substituteRegExp, (match) => vars[match[1]!] ?? match[0]!);
 }
diff --git a/pkg/dartdev/lib/src/templates/console_full.dart b/pkg/dartdev/lib/src/templates/console_full.dart
index 553ceeb..d4c2965 100644
--- a/pkg/dartdev/lib/src/templates/console_full.dart
+++ b/pkg/dartdev/lib/src/templates/console_full.dart
@@ -25,10 +25,10 @@
 
   @override
   String getInstallInstructions(
-    String directory,
-    String scriptPath,
-  ) =>
-      super.getInstallInstructions(directory, null);
+    String directory, {
+    String? scriptPath,
+  }) =>
+      super.getInstallInstructions(directory);
 }
 
 final String _pubspec = '''
diff --git a/pkg/dartdev/lib/src/templates/console_simple.dart b/pkg/dartdev/lib/src/templates/console_simple.dart
index 5c6d381..ed6f793 100644
--- a/pkg/dartdev/lib/src/templates/console_simple.dart
+++ b/pkg/dartdev/lib/src/templates/console_simple.dart
@@ -17,16 +17,16 @@
     addFile('pubspec.yaml', _pubspec);
     addFile('README.md', _readme);
     setEntrypoint(
-      addFile('bin/__projectName__.dart', main),
+      addFile('bin/__projectName__.dart', mainSrc),
     );
   }
 
   @override
   String getInstallInstructions(
-    String directory,
-    String scriptPath,
-  ) =>
-      super.getInstallInstructions(directory, null);
+    String directory, {
+    String? scriptPath,
+  }) =>
+      super.getInstallInstructions(directory);
 }
 
 final String _pubspec = '''
@@ -49,7 +49,7 @@
 A simple command-line application.
 ''';
 
-final String main = '''
+final String mainSrc = '''
 void main(List<String> arguments) {
   print('Hello world!');
 }
diff --git a/pkg/dartdev/lib/src/templates/package_simple.dart b/pkg/dartdev/lib/src/templates/package_simple.dart
index 591f110..9827dd7 100644
--- a/pkg/dartdev/lib/src/templates/package_simple.dart
+++ b/pkg/dartdev/lib/src/templates/package_simple.dart
@@ -26,12 +26,12 @@
 
   @override
   String getInstallInstructions(
-    String directory,
-    String scriptPath,
-  ) =>
+    String directory, {
+    String? scriptPath,
+  }) =>
       super.getInstallInstructions(
         directory,
-        'example/${scriptPath}_example',
+        scriptPath: 'example/${scriptPath}_example',
       );
 }
 
diff --git a/pkg/dartdev/lib/src/templates/server_shelf.dart b/pkg/dartdev/lib/src/templates/server_shelf.dart
index ed6b730..c075f02 100644
--- a/pkg/dartdev/lib/src/templates/server_shelf.dart
+++ b/pkg/dartdev/lib/src/templates/server_shelf.dart
@@ -26,12 +26,12 @@
 
   @override
   String getInstallInstructions(
-    String directory,
-    String scriptPath,
-  ) =>
+    String directory, {
+    String? scriptPath,
+  }) =>
       super.getInstallInstructions(
         directory,
-        'bin/server',
+        scriptPath: 'bin/server',
       );
 }
 
diff --git a/pkg/dartdev/lib/src/templates/web_simple.dart b/pkg/dartdev/lib/src/templates/web_simple.dart
index 6ea2eb1..e22be74 100644
--- a/pkg/dartdev/lib/src/templates/web_simple.dart
+++ b/pkg/dartdev/lib/src/templates/web_simple.dart
@@ -27,9 +27,9 @@
 
   @override
   String getInstallInstructions(
-    String directory,
-    String scriptPath,
-  ) =>
+    String directory, {
+    String? scriptPath,
+  }) =>
       '  cd ${p.relative(directory)}\n'
       '  dart pub global activate webdev\n'
       '  webdev serve';
diff --git a/pkg/dartdev/lib/src/utils.dart b/pkg/dartdev/lib/src/utils.dart
index c36d6fa..f4c5676 100644
--- a/pkg/dartdev/lib/src/utils.dart
+++ b/pkg/dartdev/lib/src/utils.dart
@@ -8,14 +8,14 @@
 
 /// For commands where we are able to initialize the [ArgParser], this value
 /// is used as the usageLineLength.
-int get dartdevUsageLineLength =>
+int? get dartdevUsageLineLength =>
     stdout.hasTerminal ? stdout.terminalColumns : null;
 
 /// Given a data structure which is a Map of String to dynamic values, return
 /// the same structure (`Map<String, dynamic>`) with the correct runtime types.
 Map<String, dynamic> castStringKeyedMap(dynamic untyped) {
-  final Map<dynamic, dynamic> map = untyped as Map<dynamic, dynamic>;
-  return map?.cast<String, dynamic>();
+  final Map<dynamic, dynamic> map = untyped! as Map<dynamic, dynamic>;
+  return map.cast<String, dynamic>();
 }
 
 /// Emit the given word with the correct pluralization.
@@ -31,7 +31,7 @@
 }
 
 /// String utility to trim some suffix from the end of a [String].
-String trimEnd(String s, String suffix) {
+String? trimEnd(String? s, String? suffix) {
   if (s != null && suffix != null && suffix.isNotEmpty && s.endsWith(suffix)) {
     return s.substring(0, s.length - suffix.length);
   }
@@ -45,7 +45,7 @@
 }
 
 /// Wraps [text] to the given [width], if provided.
-String wrapText(String text, {int width}) {
+String wrapText(String text, {int? width}) {
   if (width == null) {
     return text;
   }
diff --git a/pkg/dartdev/lib/src/vm_interop_handler.dart b/pkg/dartdev/lib/src/vm_interop_handler.dart
index 6ff7bfa..0913a93 100644
--- a/pkg/dartdev/lib/src/vm_interop_handler.dart
+++ b/pkg/dartdev/lib/src/vm_interop_handler.dart
@@ -4,13 +4,11 @@
 
 import 'dart:isolate';
 
-import 'package:meta/meta.dart';
-
 /// Contains methods used to communicate DartDev results back to the VM.
 abstract class VmInteropHandler {
   /// Initializes [VmInteropHandler] to utilize [port] to communicate with the
   /// VM.
-  static void initialize(SendPort port) => _port = port;
+  static void initialize(SendPort? port) => _port = port;
 
   /// Notifies the VM to run [script] with [args] upon DartDev exit.
   ///
@@ -18,10 +16,10 @@
   static void run(
     String script,
     List<String> args, {
-    @required String packageConfigOverride,
+    String? packageConfigOverride,
   }) {
-    assert(_port != null);
-    if (_port == null) return;
+    final port = _port;
+    if (port == null) return;
     final message = <dynamic>[
       _kResultRun,
       script,
@@ -29,21 +27,21 @@
       // Copy the list so it doesn't get GC'd underneath us.
       args.toList()
     ];
-    _port.send(message);
+    port.send(message);
   }
 
   /// Notifies the VM that DartDev has completed running. If provided a
   /// non-zero [exitCode], the VM will terminate with the given exit code.
-  static void exit(int exitCode) {
-    assert(_port != null);
-    if (_port == null) return;
+  static void exit(int? exitCode) {
+    final port = _port;
+    if (port == null) return;
     final message = <dynamic>[_kResultExit, exitCode];
-    _port.send(message);
+    port.send(message);
   }
 
   // Note: keep in sync with runtime/bin/dartdev_isolate.h
   static const int _kResultRun = 1;
   static const int _kResultExit = 2;
 
-  static SendPort _port;
+  static SendPort? _port;
 }
diff --git a/pkg/dartdev/pubspec.yaml b/pkg/dartdev/pubspec.yaml
index ea17317..51e57b2 100644
--- a/pkg/dartdev/pubspec.yaml
+++ b/pkg/dartdev/pubspec.yaml
@@ -4,7 +4,7 @@
 publish_to: none
 
 environment:
-  sdk: '>=2.6.0 <3.0.0'
+  sdk: '>=2.12.0 <3.0.0'
 dependencies:
   analysis_server:
     path: ../analysis_server
@@ -14,6 +14,7 @@
     path: ../analyzer
   args: any
   cli_util: any
+  collection: any
   dart2native:
     path: ../dart2native
   dart_style: any
diff --git a/pkg/dartdev/test/analysis_server_test.dart b/pkg/dartdev/test/analysis_server_test.dart
index 975eb86..bd24aed 100644
--- a/pkg/dartdev/test/analysis_server_test.dart
+++ b/pkg/dartdev/test/analysis_server_test.dart
@@ -14,14 +14,14 @@
 
 void main() {
   group('AnalysisServer', () {
-    TestProject p;
+    late TestProject p;
 
     setUp(() {
       log = Logger.standard();
       p = project();
     });
 
-    tearDown(() async => await p?.dispose());
+    tearDown(() async => await p.dispose());
 
     test('can start', () async {
       AnalysisServer server = AnalysisServer(
diff --git a/pkg/dartdev/test/commands/analyze_test.dart b/pkg/dartdev/test/commands/analyze_test.dart
index 60bbb1a..04fc049 100644
--- a/pkg/dartdev/test/commands/analyze_test.dart
+++ b/pkg/dartdev/test/commands/analyze_test.dart
@@ -172,7 +172,7 @@
 }
 
 void defineAnalyze() {
-  TestProject p;
+  TestProject? p;
 
   setUp(() => p = null);
 
@@ -180,7 +180,7 @@
 
   test('--help', () async {
     p = project();
-    var result = await p.run(['analyze', '--help']);
+    var result = await p!.run(['analyze', '--help']);
 
     expect(result.exitCode, 0);
     expect(result.stderr, isEmpty);
@@ -190,7 +190,7 @@
 
   test('--help --verbose', () async {
     p = project();
-    var result = await p.run(['analyze', '--help', '--verbose']);
+    var result = await p!.run(['analyze', '--help', '--verbose']);
 
     expect(result.exitCode, 0);
     expect(result.stderr, isEmpty);
@@ -199,14 +199,15 @@
   });
 
   group('multiple items', () {
-    TestProject secondProject;
+    late TestProject secondProject;
 
-    tearDown(() async => await secondProject?.dispose());
+    tearDown(() async => await secondProject.dispose());
 
     test('folder and file', () async {
       p = project(mainSrc: "int get foo => 'str';\n");
       secondProject = project(mainSrc: "int get foo => 'str';\n");
-      var result = await p.run(['analyze', p.dirPath, secondProject.mainPath]);
+      var result =
+          await p!.run(['analyze', p!.dirPath, secondProject.mainPath]);
 
       expect(result.exitCode, 3);
       expect(result.stderr, isEmpty);
@@ -219,7 +220,7 @@
     test('two folders', () async {
       p = project(mainSrc: "int get foo => 'str';\n");
       secondProject = project(mainSrc: "int get foo => 'str';\n");
-      var result = await p.run(['analyze', p.dirPath, secondProject.dirPath]);
+      var result = await p!.run(['analyze', p!.dirPath, secondProject.dirPath]);
 
       expect(result.exitCode, 3);
       expect(result.stderr, isEmpty);
@@ -232,7 +233,7 @@
 
   test('no such directory', () async {
     p = project();
-    var result = await p.run(['analyze', '/no/such/dir1/']);
+    var result = await p!.run(['analyze', '/no/such/dir1/']);
 
     expect(result.exitCode, 64);
     expect(result.stdout, isEmpty);
@@ -244,7 +245,7 @@
   test('current working directory', () async {
     p = project(mainSrc: 'int get foo => 1;\n');
 
-    var result = await p.run(['analyze'], workingDir: p.dirPath);
+    var result = await p!.run(['analyze'], workingDir: p!.dirPath);
 
     expect(result.exitCode, 0);
     expect(result.stderr, isEmpty);
@@ -254,7 +255,7 @@
   group('single directory', () {
     test('no errors', () async {
       p = project(mainSrc: 'int get foo => 1;\n');
-      var result = await p.run(['analyze', p.dirPath]);
+      var result = await p!.run(['analyze', p!.dirPath]);
 
       expect(result.exitCode, 0);
       expect(result.stderr, isEmpty);
@@ -263,7 +264,7 @@
 
     test('one error', () async {
       p = project(mainSrc: "int get foo => 'str';\n");
-      var result = await p.run(['analyze', p.dirPath]);
+      var result = await p!.run(['analyze', p!.dirPath]);
 
       expect(result.exitCode, 3);
       expect(result.stderr, isEmpty);
@@ -275,7 +276,7 @@
 
     test('two errors', () async {
       p = project(mainSrc: "int get foo => 'str';\nint get bar => 'str';\n");
-      var result = await p.run(['analyze', p.dirPath]);
+      var result = await p!.run(['analyze', p!.dirPath]);
 
       expect(result.exitCode, 3);
       expect(result.stderr, isEmpty);
@@ -286,7 +287,7 @@
   group('single file', () {
     test('no errors', () async {
       p = project(mainSrc: 'int get foo => 1;\n');
-      var result = await p.run(['analyze', p.mainPath]);
+      var result = await p!.run(['analyze', p!.mainPath]);
 
       expect(result.exitCode, 0);
       expect(result.stderr, isEmpty);
@@ -295,7 +296,7 @@
 
     test('one error', () async {
       p = project(mainSrc: "int get foo => 'str';\n");
-      var result = await p.run(['analyze', p.mainPath]);
+      var result = await p!.run(['analyze', p!.mainPath]);
 
       expect(result.exitCode, 3);
       expect(result.stderr, isEmpty);
@@ -310,7 +311,7 @@
     p = project(
         mainSrc: _unusedImportCodeSnippet,
         analysisOptions: _unusedImportAnalysisOptions);
-    var result = await p.run(['analyze', '--fatal-warnings', p.dirPath]);
+    var result = await p!.run(['analyze', '--fatal-warnings', p!.dirPath]);
 
     expect(result.exitCode, equals(2));
     expect(result.stderr, isEmpty);
@@ -321,7 +322,7 @@
     p = project(
         mainSrc: _unusedImportCodeSnippet,
         analysisOptions: _unusedImportAnalysisOptions);
-    var result = await p.run(['analyze', p.dirPath]);
+    var result = await p!.run(['analyze', p!.dirPath]);
 
     expect(result.exitCode, equals(2));
     expect(result.stderr, isEmpty);
@@ -332,7 +333,7 @@
     p = project(
         mainSrc: _unusedImportCodeSnippet,
         analysisOptions: _unusedImportAnalysisOptions);
-    var result = await p.run(['analyze', '--no-fatal-warnings', p.dirPath]);
+    var result = await p!.run(['analyze', '--no-fatal-warnings', p!.dirPath]);
 
     expect(result.exitCode, 0);
     expect(result.stderr, isEmpty);
@@ -341,7 +342,7 @@
 
   test('info implicit no --fatal-infos', () async {
     p = project(mainSrc: dartVersionFilePrefix2_9 + 'String foo() {}');
-    var result = await p.run(['analyze', p.dirPath]);
+    var result = await p!.run(['analyze', p!.dirPath]);
 
     expect(result.exitCode, 0);
     expect(result.stderr, isEmpty);
@@ -350,7 +351,7 @@
 
   test('info --fatal-infos', () async {
     p = project(mainSrc: dartVersionFilePrefix2_9 + 'String foo() {}');
-    var result = await p.run(['analyze', '--fatal-infos', p.dirPath]);
+    var result = await p!.run(['analyze', '--fatal-infos', p!.dirPath]);
 
     expect(result.exitCode, 1);
     expect(result.stderr, isEmpty);
@@ -364,7 +365,7 @@
   var one = 1;
   return result;
 }''');
-    var result = await p.run(['analyze', '--verbose', p.dirPath]);
+    var result = await p!.run(['analyze', '--verbose', p!.dirPath]);
 
     expect(result.exitCode, 3);
     expect(result.stderr, isEmpty);
@@ -386,7 +387,7 @@
 void f() {
   my_foo;
 }''');
-      p.file('my_packages.json', '''
+      p!.file('my_packages.json', '''
 {
   "configVersion": 2,
   "packages": [
@@ -399,10 +400,10 @@
   ]
 }
 ''');
-      var result = await p.run([
+      var result = await p!.run([
         'analyze',
-        '--packages=${p.findFile('my_packages.json').path}',
-        p.dirPath,
+        '--packages=${p!.findFile('my_packages.json')!.path}',
+        p!.dirPath,
       ]);
 
       expect(result.exitCode, 0);
@@ -412,10 +413,10 @@
 
     test('not existing', () async {
       p = project();
-      var result = await p.run([
+      var result = await p!.run([
         'analyze',
         '--packages=no.such.file',
-        p.dirPath,
+        p!.dirPath,
       ]);
 
       expect(result.exitCode, 64);
@@ -428,10 +429,10 @@
     var cache = project(name: 'cache');
 
     p = project(mainSrc: 'var v = 0;');
-    var result = await p.run([
+    var result = await p!.run([
       'analyze',
       '--cache=${cache.dirPath}',
-      p.mainPath,
+      p!.mainPath,
     ]);
 
     expect(result.exitCode, 0);
diff --git a/pkg/dartdev/test/commands/compile_test.dart b/pkg/dartdev/test/commands/compile_test.dart
index 2facc8c..82478e9 100644
--- a/pkg/dartdev/test/commands/compile_test.dart
+++ b/pkg/dartdev/test/commands/compile_test.dart
@@ -468,7 +468,7 @@
     );
 
     expect(result.stdout,
-        predicate((o) => !'$o'.contains(soundNullSafetyMessage)));
+        predicate((dynamic o) => !'$o'.contains(soundNullSafetyMessage)));
     expect(result.stderr, isEmpty);
     expect(result.exitCode, 0);
     expect(File(outFile).existsSync(), true,
@@ -497,7 +497,7 @@
     );
 
     expect(result.stdout,
-        predicate((o) => !'$o'.contains(soundNullSafetyMessage)));
+        predicate((dynamic o) => !'$o'.contains(soundNullSafetyMessage)));
     expect(result.stderr, isEmpty);
     expect(result.exitCode, 0);
   }, skip: isRunningOnIA32);
@@ -566,7 +566,7 @@
     );
 
     expect(result.stdout,
-        predicate((o) => !'$o'.contains(soundNullSafetyMessage)));
+        predicate((dynamic o) => !'$o'.contains(soundNullSafetyMessage)));
     expect(result.stderr, isEmpty);
     expect(result.exitCode, 0);
     expect(File(outFile).existsSync(), true,
@@ -595,7 +595,7 @@
     );
 
     expect(result.stdout,
-        predicate((o) => !'$o'.contains(soundNullSafetyMessage)));
+        predicate((dynamic o) => !'$o'.contains(soundNullSafetyMessage)));
     expect(result.stderr, isEmpty);
     expect(result.exitCode, 0);
   });
@@ -664,7 +664,7 @@
     );
 
     expect(result.stdout,
-        predicate((o) => !'$o'.contains(soundNullSafetyMessage)));
+        predicate((dynamic o) => !'$o'.contains(soundNullSafetyMessage)));
     expect(result.stderr, isEmpty);
     expect(result.exitCode, 0);
     expect(File(outFile).existsSync(), true,
@@ -693,7 +693,7 @@
     );
 
     expect(result.stdout,
-        predicate((o) => !'$o'.contains(soundNullSafetyMessage)));
+        predicate((dynamic o) => !'$o'.contains(soundNullSafetyMessage)));
     expect(result.stderr, isEmpty);
     expect(result.exitCode, 0);
   }, skip: isRunningOnIA32);
@@ -720,7 +720,7 @@
     );
 
     expect(result.stdout,
-        predicate((o) => !'$o'.contains(soundNullSafetyMessage)));
+        predicate((dynamic o) => !'$o'.contains(soundNullSafetyMessage)));
     expect(result.stdout, contains('Warning: '));
     expect(result.stderr, isEmpty);
     expect(result.exitCode, 0);
@@ -747,7 +747,8 @@
     expect(
       result.stderr,
       predicate(
-        (o) => '$o'.contains('Unexpected arguments after Dart entry point.'),
+        (dynamic o) =>
+            '$o'.contains('Unexpected arguments after Dart entry point.'),
       ),
     );
     expect(result.exitCode, 64);
@@ -818,7 +819,7 @@
     );
 
     expect(result.stdout,
-        predicate((o) => !'$o'.contains(soundNullSafetyMessage)));
+        predicate((dynamic o) => !'$o'.contains(soundNullSafetyMessage)));
     expect(result.stderr, isEmpty);
     expect(result.exitCode, 0);
     expect(File(outFile).existsSync(), true,
@@ -846,7 +847,7 @@
     );
 
     expect(result.stdout,
-        predicate((o) => !'$o'.contains(soundNullSafetyMessage)));
+        predicate((dynamic o) => !'$o'.contains(soundNullSafetyMessage)));
     expect(result.stderr, contains('must be assigned before it can be used'));
     expect(result.exitCode, 254);
   });
@@ -872,7 +873,7 @@
     );
 
     expect(result.stdout,
-        predicate((o) => !'$o'.contains(soundNullSafetyMessage)));
+        predicate((dynamic o) => !'$o'.contains(soundNullSafetyMessage)));
     expect(result.stderr, contains('Warning:'));
     expect(result.exitCode, 0);
   });
@@ -941,7 +942,7 @@
       ],
     );
 
-    expect(result.stdout, predicate((o) => '$o'.contains('[foo]')));
+    expect(result.stdout, predicate((dynamic o) => '$o'.contains('[foo]')));
     expect(result.stderr, isEmpty);
     expect(result.exitCode, 0);
     expect(File(outFile).existsSync(), true,
@@ -965,7 +966,7 @@
     );
 
     expect(result.stdout,
-        predicate((o) => !'$o'.contains(soundNullSafetyMessage)));
+        predicate((dynamic o) => !'$o'.contains(soundNullSafetyMessage)));
     expect(result.stderr, isEmpty);
     expect(result.exitCode, 0);
     expect(File(outFile).existsSync(), true,
@@ -993,7 +994,7 @@
     );
 
     expect(result.stdout,
-        predicate((o) => !'$o'.contains(soundNullSafetyMessage)));
+        predicate((dynamic o) => !'$o'.contains(soundNullSafetyMessage)));
     expect(result.stderr, contains('must be assigned before it can be used'));
     expect(result.exitCode, 254);
   });
@@ -1019,7 +1020,7 @@
     );
 
     expect(result.stdout,
-        predicate((o) => !'$o'.contains(soundNullSafetyMessage)));
+        predicate((dynamic o) => !'$o'.contains(soundNullSafetyMessage)));
     expect(result.stderr, contains('Warning:'));
     expect(result.exitCode, 0);
   });
diff --git a/pkg/dartdev/test/commands/create_integration_test.dart b/pkg/dartdev/test/commands/create_integration_test.dart
index 4856b47..e73a16d 100644
--- a/pkg/dartdev/test/commands/create_integration_test.dart
+++ b/pkg/dartdev/test/commands/create_integration_test.dart
@@ -14,7 +14,7 @@
 }
 
 void defineCreateTests() {
-  TestProject p;
+  TestProject? p;
 
   setUp(() => p = null);
 
@@ -25,7 +25,7 @@
     test(templateId, () async {
       p = project();
 
-      ProcessResult createResult = await p.run([
+      ProcessResult createResult = await p!.run([
         'create',
         '--force',
         '--template',
@@ -37,11 +37,11 @@
       // Validate that the project analyzes cleanly.
       // TODO: Should we use --fatal-infos here?
       ProcessResult analyzeResult =
-          await p.run(['analyze'], workingDir: p.dir.path);
+          await p!.run(['analyze'], workingDir: p!.dir.path);
       expect(analyzeResult.exitCode, 0, reason: analyzeResult.stdout);
 
       // Validate that the code is well formatted.
-      ProcessResult formatResult = await p.run([
+      ProcessResult formatResult = await p!.run([
         'format',
         '--output',
         'none',
diff --git a/pkg/dartdev/test/commands/create_test.dart b/pkg/dartdev/test/commands/create_test.dart
index 899c7b0..872309e 100644
--- a/pkg/dartdev/test/commands/create_test.dart
+++ b/pkg/dartdev/test/commands/create_test.dart
@@ -17,7 +17,7 @@
 }
 
 void defineCreateTests() {
-  TestProject p;
+  TestProject? p;
 
   setUp(() => p = null);
 
@@ -25,7 +25,7 @@
 
   test('--help', () async {
     p = project();
-    var result = await p.run(['create', '--help']);
+    var result = await p!.run(['create', '--help']);
 
     expect(result.stdout, contains('Create a new Dart project.'));
     expect(
@@ -40,7 +40,7 @@
 
   test('--help --verbose', () async {
     p = project();
-    var result = await p.run(['create', '--help', '--verbose']);
+    var result = await p!.run(['create', '--help', '--verbose']);
 
     expect(result.stdout, contains('Create a new Dart project.'));
     expect(
@@ -67,7 +67,7 @@
   test('list templates', () async {
     p = project();
 
-    ProcessResult result = await p.run(['create', '--list-templates']);
+    ProcessResult result = await p!.run(['create', '--list-templates']);
     expect(result.exitCode, 0);
 
     String output = result.stdout.toString();
@@ -81,7 +81,7 @@
   test('no directory given', () async {
     p = project();
 
-    ProcessResult result = await p.run([
+    ProcessResult result = await p!.run([
       'create',
     ]);
     expect(result.exitCode, 1);
@@ -90,15 +90,15 @@
   test('directory already exists', () async {
     p = project();
 
-    ProcessResult result = await p.run(
-        ['create', '--template', CreateCommand.defaultTemplateId, p.dir.path]);
+    ProcessResult result = await p!.run(
+        ['create', '--template', CreateCommand.defaultTemplateId, p!.dir.path]);
     expect(result.exitCode, 73);
   });
 
   test('project in current directory', () async {
     p = project();
     final projectDir = Directory('foo')..createSync();
-    final result = await p.run(
+    final result = await p!.run(
       ['create', '--force', '.'],
       workingDir: projectDir.path,
     );
@@ -109,7 +109,7 @@
 
   test('project with normalized package name', () async {
     p = project();
-    final result = await p.run(['create', 'requires-normalization']);
+    final result = await p!.run(['create', 'requires-normalization']);
     expect(result.stderr, isEmpty);
     expect(
         result.stdout,
@@ -120,7 +120,7 @@
 
   test('project with an invalid package name', () async {
     p = project();
-    final result = await p.run(['create', 'bad-package^name']);
+    final result = await p!.run(['create', 'bad-package^name']);
     expect(
       result.stderr,
       contains(
@@ -134,8 +134,8 @@
   test('bad template id', () async {
     p = project();
 
-    ProcessResult result = await p
-        .run(['create', '--no-pub', '--template', 'foo-bar', p.dir.path]);
+    ProcessResult result = await p!
+        .run(['create', '--no-pub', '--template', 'foo-bar', p!.dir.path]);
     expect(result.exitCode, isNot(0));
   });
 
@@ -144,7 +144,7 @@
     test(templateId, () async {
       p = project();
       const projectName = 'template_project';
-      ProcessResult result = await p.run([
+      ProcessResult result = await p!.run([
         'create',
         '--force',
         '--no-pub',
@@ -154,9 +154,9 @@
       ]);
       expect(result.exitCode, 0);
 
-      String entry = templates.getGenerator(templateId).entrypoint.path;
+      String entry = templates.getGenerator(templateId)!.entrypoint!.path;
       entry = entry.replaceAll('__projectName__', projectName);
-      File entryFile = File(path.join(p.dir.path, projectName, entry));
+      File entryFile = File(path.join(p!.dir.path, projectName, entry));
 
       expect(entryFile.existsSync(), true,
           reason: 'File not found: ${entryFile.path}');
@@ -168,7 +168,7 @@
       const dir = 'foo';
       const projectName = dir;
       final lines = generator
-          .getInstallInstructions(dir, projectName)
+          .getInstallInstructions(dir, scriptPath: projectName)
           .split('\n')
           .map((e) => e.trim())
           .toList();
diff --git a/pkg/dartdev/test/commands/devtools_test.dart b/pkg/dartdev/test/commands/devtools_test.dart
index 24cb80b..08f1cd0 100644
--- a/pkg/dartdev/test/commands/devtools_test.dart
+++ b/pkg/dartdev/test/commands/devtools_test.dart
@@ -14,9 +14,9 @@
 }
 
 void devtools() {
-  TestProject p;
+  late TestProject p;
 
-  tearDown(() async => await p?.dispose());
+  tearDown(() async => await p.dispose());
 
   test('--help', () async {
     p = project();
@@ -47,7 +47,7 @@
   });
 
   group('integration', () {
-    Process process;
+    Process? process;
 
     tearDown(() {
       process?.kill();
@@ -58,8 +58,8 @@
 
       // start the devtools server
       process = await p.start(['devtools', '--no-launch-browser', '--machine']);
-
-      final Stream<String> inStream = process.stdout
+      process!.stderr.transform(utf8.decoder).listen(print);
+      final Stream<String> inStream = process!.stdout
           .transform<String>(utf8.decoder)
           .transform<String>(const LineSplitter());
 
@@ -89,7 +89,7 @@
       expect(contents, contains('DevTools'));
 
       // kill the process
-      process.kill();
+      process!.kill();
       process = null;
     });
   });
diff --git a/pkg/dartdev/test/commands/fix_test.dart b/pkg/dartdev/test/commands/fix_test.dart
index c6382f4..2d21669 100644
--- a/pkg/dartdev/test/commands/fix_test.dart
+++ b/pkg/dartdev/test/commands/fix_test.dart
@@ -18,9 +18,9 @@
 const runFromSource = false;
 
 void defineFix() {
-  TestProject p;
+  TestProject? p;
 
-  ProcessResult result;
+  late ProcessResult result;
 
   final bullet = Logger.standard().ansi.bullet;
 
@@ -52,18 +52,18 @@
 ''');
   }
 
-  Future<ProcessResult> runFix(List<String> args, {String workingDir}) async {
+  Future<ProcessResult> runFix(List<String> args, {String? workingDir}) async {
     if (runFromSource) {
       var binary = path.join(Directory.current.path, 'bin', 'dartdev.dart');
-      return await p.run([binary, 'fix', ...?args], workingDir: workingDir);
+      return await p!.run([binary, 'fix', ...args], workingDir: workingDir);
     }
-    return await p.run(['fix', ...args], workingDir: workingDir);
+    return await p!.run(['fix', ...args], workingDir: workingDir);
   }
 
   test('--help', () async {
     p = project(mainSrc: 'int get foo => 1;\n');
 
-    var result = await runFix([p.dirPath, '--help']);
+    var result = await runFix([p!.dirPath, '--help']);
 
     expect(result.exitCode, 0);
     expect(result.stderr, isEmpty);
@@ -79,7 +79,7 @@
   test('--help --verbose', () async {
     p = project(mainSrc: 'int get foo => 1;\n');
 
-    var result = await runFix([p.dirPath, '--help', '--verbose']);
+    var result = await runFix([p!.dirPath, '--help', '--verbose']);
 
     expect(result.exitCode, 0);
     expect(result.stderr, isEmpty);
@@ -98,7 +98,7 @@
   test('none', () async {
     p = project(mainSrc: 'int get foo => 1;\n');
 
-    var result = await runFix([p.dirPath]);
+    var result = await runFix([p!.dirPath]);
 
     expect(result.exitCode, 0);
     expect(result.stderr, isEmpty);
@@ -109,7 +109,7 @@
   test('--apply (none)', () async {
     p = project(mainSrc: 'int get foo => 1;\n');
 
-    var result = await runFix(['--apply', p.dirPath]);
+    var result = await runFix(['--apply', p!.dirPath]);
 
     expect(result.exitCode, 0);
     expect(result.stderr, isEmpty);
@@ -128,7 +128,7 @@
 ''',
     );
 
-    var result = await runFix(['--apply'], workingDir: p.dirPath);
+    var result = await runFix(['--apply'], workingDir: p!.dirPath);
     expect(result.exitCode, 0);
     expect(result.stderr, isEmpty);
     expect(
@@ -158,7 +158,7 @@
     - prefer_single_quotes
 ''',
     );
-    var result = await runFix(['--dry-run', '.'], workingDir: p.dirPath);
+    var result = await runFix(['--dry-run', '.'], workingDir: p!.dirPath);
     expect(result.exitCode, 0);
     expect(result.stderr, isEmpty);
     expect(
@@ -182,7 +182,7 @@
     - prefer_single_quotes
 ''',
     );
-    var result = await runFix(['--apply', '.'], workingDir: p.dirPath);
+    var result = await runFix(['--apply', '.'], workingDir: p!.dirPath);
     expect(result.exitCode, 0);
     expect(result.stderr, isEmpty);
     expect(
@@ -207,7 +207,7 @@
     - prefer_single_quotes
 ''',
     );
-    var result = await runFix(['--apply', '.'], workingDir: p.dirPath);
+    var result = await runFix(['--apply', '.'], workingDir: p!.dirPath);
     expect(result.exitCode, 0);
     expect(result.stderr, isEmpty);
     expect(
@@ -235,7 +235,7 @@
     - prefer_single_quotes
 ''',
     );
-    var result = await runFix(['--apply', '.'], workingDir: p.dirPath);
+    var result = await runFix(['--apply', '.'], workingDir: p!.dirPath);
     expect(result.exitCode, 0);
     expect(result.stderr, isEmpty);
     expect(result.stdout, contains('Nothing to fix!'));
@@ -253,7 +253,7 @@
     - prefer_single_quotes
 ''',
     );
-    var result = await runFix(['--apply', '.'], workingDir: p.dirPath);
+    var result = await runFix(['--apply', '.'], workingDir: p!.dirPath);
     expect(result.exitCode, 0);
     expect(result.stderr, isEmpty);
     expect(result.stdout, contains('Nothing to fix!'));
@@ -272,7 +272,7 @@
     - prefer_single_quotes
 ''',
     );
-    var result = await runFix(['--apply', '.'], workingDir: p.dirPath);
+    var result = await runFix(['--apply', '.'], workingDir: p!.dirPath);
     expect(result.exitCode, 0);
     expect(result.stderr, isEmpty);
     expect(
@@ -305,7 +305,7 @@
     - prefer_single_quotes
 ''',
       );
-      p.file('lib/main.dart.expect', '''
+      p!.file('lib/main.dart.expect', '''
 class A {
   String a() => '';
 }
@@ -315,7 +315,7 @@
 }
 ''');
       result =
-          await runFix(['--compare-to-golden', '.'], workingDir: p.dirPath);
+          await runFix(['--compare-to-golden', '.'], workingDir: p!.dirPath);
       assertResult(exitCode: 1);
     });
 
@@ -337,7 +337,7 @@
     - prefer_single_quotes
 ''',
       );
-      p.file('lib/main.dart.expect', '''
+      p!.file('lib/main.dart.expect', '''
 class A {
   String a() => '';
 }
@@ -348,7 +348,7 @@
 }
 ''');
       result =
-          await runFix(['--compare-to-golden', '.'], workingDir: p.dirPath);
+          await runFix(['--compare-to-golden', '.'], workingDir: p!.dirPath);
       assertResult();
     });
 
@@ -371,7 +371,7 @@
 ''',
       );
       result =
-          await runFix(['--compare-to-golden', '.'], workingDir: p.dirPath);
+          await runFix(['--compare-to-golden', '.'], workingDir: p!.dirPath);
       assertResult(exitCode: 1);
     });
 
@@ -379,14 +379,14 @@
       p = project(mainSrc: '''
 class C {}
 ''');
-      p.file('lib/main.dart.expect', '''
+      p!.file('lib/main.dart.expect', '''
 class C {}
 ''');
-      p.file('lib/secondary.dart.expect', '''
+      p!.file('lib/secondary.dart.expect', '''
 class A {}
 ''');
       result =
-          await runFix(['--compare-to-golden', '.'], workingDir: p.dirPath);
+          await runFix(['--compare-to-golden', '.'], workingDir: p!.dirPath);
       assertResult(exitCode: 1);
     });
 
@@ -403,13 +403,13 @@
     - annotate_overrides
 ''',
       );
-      p.file('lib/main.dart.expect', '''
+      p!.file('lib/main.dart.expect', '''
 class A {
   String a() => '';
 }
 ''');
       result =
-          await runFix(['--compare-to-golden', '.'], workingDir: p.dirPath);
+          await runFix(['--compare-to-golden', '.'], workingDir: p!.dirPath);
       assertResult(exitCode: 1);
     });
   });
diff --git a/pkg/dartdev/test/commands/flag_test.dart b/pkg/dartdev/test/commands/flag_test.dart
index 3feab2d..7c4b4fa5 100644
--- a/pkg/dartdev/test/commands/flag_test.dart
+++ b/pkg/dartdev/test/commands/flag_test.dart
@@ -11,6 +11,7 @@
 import '../utils.dart';
 
 void main() {
+  initGlobalState();
   group('command', command, timeout: longTimeout);
   group('flag', help, timeout: longTimeout);
 }
@@ -34,30 +35,28 @@
     DartdevRunner(['--no-analytics'])
         .commands
         .forEach((String commandKey, Command command) {
-      if (command.argParser != null) {
-        if (command.name != 'help' &&
-            command.name != 'format' &&
-            command.name != 'pub' &&
-            command.name != 'test') {
-          expect(command.argParser.usageLineLength,
-              stdout.hasTerminal ? stdout.terminalColumns : null);
-        } else if (command.name == 'pub') {
-          // TODO(sigurdm): Avoid special casing here.
-          // https://github.com/dart-lang/pub/issues/2700
-          expect(command.argParser.usageLineLength,
-              stdout.hasTerminal ? stdout.terminalColumns : 80);
-        } else {
-          expect(command.argParser.usageLineLength, isNull);
-        }
+      if (command.name != 'help' &&
+          command.name != 'format' &&
+          command.name != 'pub' &&
+          command.name != 'test') {
+        expect(command.argParser.usageLineLength,
+            stdout.hasTerminal ? stdout.terminalColumns : null);
+      } else if (command.name == 'pub') {
+        // TODO(sigurdm): Avoid special casing here.
+        // https://github.com/dart-lang/pub/issues/2700
+        expect(command.argParser.usageLineLength,
+            stdout.hasTerminal ? stdout.terminalColumns : 80);
+      } else {
+        expect(command.argParser.usageLineLength, isNull);
       }
     });
   });
 }
 
 void help() {
-  TestProject p;
+  late TestProject p;
 
-  tearDown(() async => await p?.dispose());
+  tearDown(() async => await p.dispose());
 
   test('--help', () async {
     p = project();
diff --git a/pkg/dartdev/test/commands/format_test.dart b/pkg/dartdev/test/commands/format_test.dart
index cf82970..2026f3f 100644
--- a/pkg/dartdev/test/commands/format_test.dart
+++ b/pkg/dartdev/test/commands/format_test.dart
@@ -14,9 +14,9 @@
 }
 
 void format() {
-  TestProject p;
+  late TestProject p;
 
-  tearDown(() async => await p?.dispose());
+  tearDown(() async => await p.dispose());
 
   test('--help', () async {
     p = project();
diff --git a/pkg/dartdev/test/commands/help_test.dart b/pkg/dartdev/test/commands/help_test.dart
index 69f1f27..8aa3d74 100644
--- a/pkg/dartdev/test/commands/help_test.dart
+++ b/pkg/dartdev/test/commands/help_test.dart
@@ -13,9 +13,9 @@
 }
 
 void help() {
-  TestProject p;
+  late TestProject p;
 
-  tearDown(() async => await p?.dispose());
+  tearDown(() async => await p.dispose());
 
   /// Commands not tested by the following loop.
   List<String> _commandsNotTested = <String>[
diff --git a/pkg/dartdev/test/commands/language_server_test.dart b/pkg/dartdev/test/commands/language_server_test.dart
index 543aec9..06d75dc 100644
--- a/pkg/dartdev/test/commands/language_server_test.dart
+++ b/pkg/dartdev/test/commands/language_server_test.dart
@@ -21,10 +21,10 @@
 }
 
 void defineLanguageServerTests() {
-  utils.TestProject project;
-  Process process;
+  late utils.TestProject project;
+  Process? process;
 
-  tearDown(() async => await project?.dispose());
+  tearDown(() async => await project.dispose());
 
   Future runWithLsp(List<String> args) async {
     project = utils.project();
@@ -32,7 +32,7 @@
     process = await project.start(args);
 
     final Stream<String> inStream =
-        process.stdout.transform<String>(utf8.decoder);
+        process!.stdout.transform<String>(utf8.decoder);
 
     // Send an LSP init.
     final String message = jsonEncode({
@@ -47,9 +47,9 @@
       },
     });
 
-    process.stdin.write('Content-Length: ${message.length}\r\n');
-    process.stdin.write('\r\n');
-    process.stdin.write(message);
+    process!.stdin.write('Content-Length: ${message.length}\r\n');
+    process!.stdin.write('\r\n');
+    process!.stdin.write(message);
 
     List<String> responses = await inStream.take(2).toList();
     expect(responses, hasLength(2));
@@ -65,7 +65,7 @@
     final serverInfo = result['serverInfo'];
     expect(serverInfo['name'], isNotEmpty);
 
-    process.kill();
+    process!.kill();
     process = null;
   }
 
@@ -82,7 +82,7 @@
 
     process = await project.start(['language-server', '--protocol=analyzer']);
 
-    final Stream<String> inStream = process.stdout
+    final Stream<String> inStream = process!.stdout
         .transform<String>(utf8.decoder)
         .transform<String>(const LineSplitter());
 
@@ -95,7 +95,7 @@
     expect(params['version'], isNotEmpty);
     expect(params['pid'], isNot(0));
 
-    process.kill();
+    process!.kill();
     process = null;
   });
 }
diff --git a/pkg/dartdev/test/commands/migrate_test.dart b/pkg/dartdev/test/commands/migrate_test.dart
index 0b394ad..24b0614 100644
--- a/pkg/dartdev/test/commands/migrate_test.dart
+++ b/pkg/dartdev/test/commands/migrate_test.dart
@@ -15,9 +15,9 @@
   final runPubGet = contains('Run `dart pub get`');
   final setLowerSdkConstraint = contains('Set the lower SDK constraint');
 
-  TestProject p;
+  late TestProject p;
 
-  tearDown(() async => await p?.dispose());
+  tearDown(() async => await p.dispose());
 
   test('--help', () async {
     p = project();
diff --git a/pkg/dartdev/test/commands/pub_test.dart b/pkg/dartdev/test/commands/pub_test.dart
index f2486dd..0c11319 100644
--- a/pkg/dartdev/test/commands/pub_test.dart
+++ b/pkg/dartdev/test/commands/pub_test.dart
@@ -13,9 +13,9 @@
 }
 
 void pub() {
-  TestProject p;
+  TestProject p = project();
 
-  tearDown(() async => await p?.dispose());
+  tearDown(() async => await p.dispose());
 
   void _assertPubHelpInvoked(ProcessResult result) {
     expect(result, isNotNull);
diff --git a/pkg/dartdev/test/commands/run_test.dart b/pkg/dartdev/test/commands/run_test.dart
index f3174c7..40978d9 100644
--- a/pkg/dartdev/test/commands/run_test.dart
+++ b/pkg/dartdev/test/commands/run_test.dart
@@ -21,9 +21,9 @@
 }
 
 void run() {
-  TestProject p;
+  late TestProject p;
 
-  tearDown(() async => await p?.dispose());
+  tearDown(() async => await p.dispose());
 
   test('--help', () async {
     p = project();
@@ -345,7 +345,7 @@
     );
 
     expect(result.stdout,
-        predicate((o) => !'$o'.contains(soundNullSafetyMessage)));
+        predicate((dynamic o) => !'$o'.contains(soundNullSafetyMessage)));
     expect(result.stderr, isEmpty);
     expect(result.exitCode, 0);
   });
@@ -497,7 +497,7 @@
         final readyCompleter = Completer<void>();
         final completer = Completer<void>();
 
-        StreamSubscription sub;
+        late StreamSubscription sub;
         sub = process.stdout.transform(utf8.decoder).listen((event) async {
           if (event.contains('ready')) {
             readyCompleter.complete();
diff --git a/pkg/dartdev/test/commands/test_test.dart b/pkg/dartdev/test/commands/test_test.dart
index 7f758d3..1005862 100644
--- a/pkg/dartdev/test/commands/test_test.dart
+++ b/pkg/dartdev/test/commands/test_test.dart
@@ -17,9 +17,9 @@
 }
 
 void defineTest(List<Experiment> experiments) {
-  TestProject p;
+  late TestProject p;
 
-  tearDown(() async => await p?.dispose());
+  tearDown(() async => await p.dispose());
 
   test('--help', () async {
     p = project();
@@ -152,7 +152,7 @@
   });
 
   group('--enable-experiment', () {
-    Future<ProcessResult> runTestWithExperimentFlag(String flag) async {
+    Future<ProcessResult> runTestWithExperimentFlag(String? flag) async {
       return await p.run([
         if (flag != null) flag,
         'test',
@@ -162,7 +162,7 @@
       ]);
     }
 
-    Future<void> expectSuccess(String flag) async {
+    Future<void> expectSuccess(String? flag) async {
       final result = await runTestWithExperimentFlag(flag);
       expect(result.stdout, contains('feature enabled'),
           reason: 'stderr: ${result.stderr}');
@@ -170,7 +170,7 @@
           reason: 'stdout: ${result.stdout} stderr: ${result.stderr}');
     }
 
-    Future<void> expectFailure(String flag) async {
+    Future<void> expectFailure(String? flag) async {
       final result = await runTestWithExperimentFlag(flag);
       expect(result.exitCode, isNot(0));
     }
diff --git a/pkg/dartdev/test/core_test.dart b/pkg/dartdev/test/core_test.dart
index f9c8e29..e06feef 100644
--- a/pkg/dartdev/test/core_test.dart
+++ b/pkg/dartdev/test/core_test.dart
@@ -18,6 +18,7 @@
 import 'utils.dart';
 
 void main() {
+  initGlobalState();
   group('DartdevCommand', _dartdevCommand);
   group('PackageConfig', _packageConfig);
   group('Project', _project);
@@ -45,29 +46,35 @@
 
   test('compile/js', () {
     _assertDartdevCommandProperties(
-        CompileCommand().subcommands['js'], 'js', 'compile/js');
+        CompileCommand().subcommands['js'] as DartdevCommand,
+        'js',
+        'compile/js');
   });
 
   test('compile/jit-snapshot', () {
     _assertDartdevCommandProperties(
-        CompileCommand().subcommands['jit-snapshot'],
+        CompileCommand().subcommands['jit-snapshot'] as DartdevCommand,
         'jit-snapshot',
         'compile/jit-snapshot');
   });
 
   test('compile/kernel', () {
     _assertDartdevCommandProperties(
-        CompileCommand().subcommands['kernel'], 'kernel', 'compile/kernel');
+        CompileCommand().subcommands['kernel'] as DartdevCommand,
+        'kernel',
+        'compile/kernel');
   });
 
   test('compile/exe', () {
     _assertDartdevCommandProperties(
-        CompileCommand().subcommands['exe'], 'exe', 'compile/exe');
+        CompileCommand().subcommands['exe'] as DartdevCommand,
+        'exe',
+        'compile/exe');
   });
 
   test('compile/aot-snapshot', () {
     _assertDartdevCommandProperties(
-        CompileCommand().subcommands['aot-snapshot'],
+        CompileCommand().subcommands['aot-snapshot'] as DartdevCommand,
         'aot-snapshot',
         'compile/aot-snapshot');
   });
@@ -103,9 +110,9 @@
 }
 
 void _project() {
-  TestProject p;
+  late TestProject p;
 
-  tearDown(() async => await p?.dispose());
+  tearDown(() async => await p.dispose());
 
   test('hasPubspecFile positive', () {
     p = project();
@@ -128,7 +135,7 @@
     Project coreProj = Project.fromDirectory(p.dir);
     expect(coreProj.hasPackageConfigFile, isTrue);
     expect(coreProj.packageConfig, isNotNull);
-    expect(coreProj.packageConfig.packages, isNotEmpty);
+    expect(coreProj.packageConfig!.packages, isNotEmpty);
   });
 
   test('hasPackageConfigFile negative', () {
diff --git a/pkg/dartdev/test/experiment_util.dart b/pkg/dartdev/test/experiment_util.dart
index 0cf98e1..4ad4ae4 100644
--- a/pkg/dartdev/test/experiment_util.dart
+++ b/pkg/dartdev/test/experiment_util.dart
@@ -12,7 +12,7 @@
 /// associated `validation` program.
 Future<List<Experiment>> experimentsWithValidation() async {
   final url = (await Isolate.resolvePackageUri(
-          Uri.parse('package:dartdev/dartdev.dart')))
+          Uri.parse('package:dartdev/dartdev.dart')))!
       .resolve('../../../tools/experimental_features.yaml');
   final experiments =
       yaml.loadYaml(File.fromUri(url).readAsStringSync(), sourceUrl: url);
@@ -28,14 +28,14 @@
   ];
 }
 
-Version tryParseVersion(String version) =>
+Version? tryParseVersion(String? version) =>
     version == null ? null : Version.parse(version);
 
 class Experiment {
   final String name;
   final String validation;
-  final Version enabledIn;
-  final Version experimentalReleaseVersion;
+  final Version? enabledIn;
+  final Version? experimentalReleaseVersion;
   Experiment(
     this.name,
     this.validation,
diff --git a/pkg/dartdev/test/fix_driver_test.dart b/pkg/dartdev/test/fix_driver_test.dart
index 8b71804..ac9a6e9 100644
--- a/pkg/dartdev/test/fix_driver_test.dart
+++ b/pkg/dartdev/test/fix_driver_test.dart
@@ -18,8 +18,8 @@
 }
 
 void _driver() {
-  TestProject p;
-  tearDown(() async => await p?.dispose());
+  late TestProject p;
+  tearDown(() async => await p.dispose());
 
   test('no fixes', () async {
     p = project(mainSrc: 'int get foo => 1;\n');
@@ -33,7 +33,7 @@
   final FixResult<CapturingLogger> result;
   FixOutput(this.result);
 
-  int get returnCode => result.returnCode;
+  int? get returnCode => result.returnCode;
   String get stderr => result.logger.output.stderr.toString();
   String get stdout => result.logger.output.stdout.toString();
 }
diff --git a/pkg/dartdev/test/load_from_dill_test.dart b/pkg/dartdev/test/load_from_dill_test.dart
index 0412854..1c4542b 100644
--- a/pkg/dartdev/test/load_from_dill_test.dart
+++ b/pkg/dartdev/test/load_from_dill_test.dart
@@ -9,9 +9,9 @@
 import 'utils.dart';
 
 void main() {
-  TestProject p;
+  late TestProject p;
 
-  tearDown(() async => await p?.dispose());
+  tearDown(() async => await p.dispose());
 
   test("Fallback to dartdev.dill from dartdev.dart.snapshot for 'Hello World'",
       () async {
diff --git a/pkg/dartdev/test/no_such_file_test.dart b/pkg/dartdev/test/no_such_file_test.dart
index 549c059..1208a5e 100644
--- a/pkg/dartdev/test/no_such_file_test.dart
+++ b/pkg/dartdev/test/no_such_file_test.dart
@@ -7,9 +7,9 @@
 import 'utils.dart';
 
 void main() {
-  TestProject p;
+  late TestProject p;
 
-  tearDown(() async => await p?.dispose());
+  tearDown(() async => await p.dispose());
 
   test('Ensure parsing fails after encountering invalid file', () async {
     // Regression test for https://github.com/dart-lang/sdk/issues/43991
diff --git a/pkg/dartdev/test/smoke/smoke.dart b/pkg/dartdev/test/smoke/smoke.dart
index 003118f..a6a5181 100644
--- a/pkg/dartdev/test/smoke/smoke.dart
+++ b/pkg/dartdev/test/smoke/smoke.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.10
-
 void main() {
   print('Smoke test!');
 }
diff --git a/pkg/dartdev/test/smoke/smoke_test.dart b/pkg/dartdev/test/smoke/smoke_test.dart
index 671836d..faad483 100644
--- a/pkg/dartdev/test/smoke/smoke_test.dart
+++ b/pkg/dartdev/test/smoke/smoke_test.dart
@@ -63,7 +63,7 @@
         );
         expect(
           result.stderr,
-          'Could not start VM service: localhost:${server.port} is already in use.\n',
+          'Could not start the VM service: localhost:${server.port} is already in use.\n',
         );
         expect(result.stdout, isEmpty);
         server.close();
diff --git a/pkg/dartdev/test/utils.dart b/pkg/dartdev/test/utils.dart
index b45e60b..316c8bc 100644
--- a/pkg/dartdev/test/utils.dart
+++ b/pkg/dartdev/test/utils.dart
@@ -5,6 +5,8 @@
 import 'dart:convert';
 import 'dart:io';
 
+import 'package:cli_util/cli_logging.dart';
+import 'package:dartdev/src/core.dart';
 import 'package:path/path.dart' as path;
 import 'package:pub_semver/pub_semver.dart';
 import 'package:test/test.dart';
@@ -18,13 +20,17 @@
 /// version:
 const String dartVersionFilePrefix2_9 = '// @dart = 2.9\n';
 
+void initGlobalState() {
+  log = Logger.standard();
+}
+
 TestProject project(
-        {String mainSrc,
-        String analysisOptions,
+        {String? mainSrc,
+        String? analysisOptions,
         bool logAnalytics = false,
         String name = TestProject._defaultProjectName,
-        VersionConstraint sdkConstraint,
-        Map<String, dynamic> pubspec}) =>
+        VersionConstraint? sdkConstraint,
+        Map<String, dynamic>? pubspec}) =>
     TestProject(
         mainSrc: mainSrc,
         analysisOptions: analysisOptions,
@@ -35,7 +41,7 @@
 class TestProject {
   static const String _defaultProjectName = 'dartdev_temp';
 
-  Directory dir;
+  late Directory dir;
 
   String get dirPath => dir.path;
 
@@ -47,19 +53,20 @@
 
   final bool logAnalytics;
 
-  final VersionConstraint sdkConstraint;
+  final VersionConstraint? sdkConstraint;
 
-  final Map<String, dynamic> pubspec;
+  final Map<String, dynamic>? pubspec;
 
-  Process _process;
+  Process? _process;
 
   TestProject(
-      {String mainSrc,
-      String analysisOptions,
+      {String? mainSrc,
+      String? analysisOptions,
       this.name = _defaultProjectName,
       this.logAnalytics = false,
       this.sdkConstraint,
       this.pubspec}) {
+    initGlobalState();
     dir = Directory.systemTemp.createTempSync('a');
     file(
         'pubspec.yaml',
@@ -113,7 +120,7 @@
 
   Future<ProcessResult> run(
     List<String> arguments, {
-    String workingDir,
+    String? workingDir,
   }) async {
     _process = await Process.start(
         Platform.resolvedExecutable,
@@ -123,11 +130,11 @@
         ],
         workingDirectory: workingDir ?? dir.path,
         environment: {if (logAnalytics) '_DARTDEV_LOG_ANALYTICS': 'true'});
-    final stdoutContents = _process.stdout.transform(utf8.decoder).join();
-    final stderrContents = _process.stderr.transform(utf8.decoder).join();
-    final code = await _process.exitCode;
+    final stdoutContents = _process!.stdout.transform(utf8.decoder).join();
+    final stderrContents = _process!.stderr.transform(utf8.decoder).join();
+    final code = await _process!.exitCode;
     return ProcessResult(
-      _process.pid,
+      _process!.pid,
       code,
       await stdoutContents,
       await stderrContents,
@@ -136,7 +143,7 @@
 
   Future<Process> start(
     List<String> arguments, {
-    String workingDir,
+    String? workingDir,
   }) {
     return Process.start(
         Platform.resolvedExecutable,
@@ -149,7 +156,7 @@
       ..then((p) => _process = p);
   }
 
-  String _sdkRootPath;
+  String? _sdkRootPath;
 
   /// Return the root of the SDK.
   String get sdkRootPath {
@@ -161,24 +168,24 @@
         if (File(path.join(tryDir, 'pkg', 'dartdev', 'bin', 'dartdev.dart'))
             .existsSync()) {
           _sdkRootPath = tryDir;
-          return _sdkRootPath;
+          return _sdkRootPath!;
         }
         current = tryDir;
       } while (path.dirname(current) != current);
       throw StateError('can not find SDK repository root');
     }
-    return _sdkRootPath;
+    return _sdkRootPath!;
   }
 
   String get absolutePathToDartdevFile =>
       path.join(sdkRootPath, 'pkg', 'dartdev', 'bin', 'dartdev.dart');
 
-  Directory findDirectory(String name) {
+  Directory? findDirectory(String name) {
     var directory = Directory(path.join(dir.path, name));
     return directory.existsSync() ? directory : null;
   }
 
-  File findFile(String name) {
+  File? findFile(String name) {
     var file = File(path.join(dir.path, name));
     return file.existsSync() ? file : null;
   }
diff --git a/pkg/dartdev/test/utils_test.dart b/pkg/dartdev/test/utils_test.dart
index 111326b..83f2567 100644
--- a/pkg/dartdev/test/utils_test.dart
+++ b/pkg/dartdev/test/utils_test.dart
@@ -64,7 +64,8 @@
       List<dynamic> _packages = contents['packages'];
       try {
         // ignore: unused_local_variable
-        List<Map<String, dynamic>> packages = _packages;
+        List<Map<String, dynamic>> packages =
+            _packages as List<Map<String, dynamic>>;
         fail('expected implicit cast to fail');
       } on TypeError {
         // TypeError is expected
diff --git a/pkg/dartdev/tool/fix_driver.dart b/pkg/dartdev/tool/fix_driver.dart
index 17f246a..d2d8723 100644
--- a/pkg/dartdev/tool/fix_driver.dart
+++ b/pkg/dartdev/tool/fix_driver.dart
@@ -8,9 +8,8 @@
 import 'package:dartdev/src/commands/fix.dart';
 import 'package:dartdev/src/core.dart';
 import 'package:dartdev/src/utils.dart';
-import 'package:meta/meta.dart';
 
-Future<void> main(List<String> args) async {
+Future<int?> main(List<String> args) async {
   var runner = FixRunner(logger: Logger.standard());
   var result = await runner.runFix(args);
   return result.returnCode;
@@ -32,7 +31,7 @@
   }
 
   @override
-  void finish({String message, bool showTiming = false}) {
+  void finish({String? message, bool showTiming = false}) {
     // todo (pq): consider capturing / tracking finish display updates.
     finished = true;
   }
@@ -85,7 +84,7 @@
 
 class FixResult<T extends Logger> {
   /// The value returned by [FixCommand.run].
-  final int returnCode;
+  final int? returnCode;
 
   /// The logger used in driving fixes.
   final T logger;
@@ -104,7 +103,7 @@
     allowTrailingOptions: false,
   );
 
-  FixRunner({@required this.logger})
+  FixRunner({required this.logger})
       : super('fix_runner',
             'A command-line utility for testing the `dart fix` command.') {
     addCommand(FixCommand());
@@ -112,14 +111,14 @@
   }
 
   @override
-  Future<int> runCommand(ArgResults topLevelResults) async {
+  Future<int?> runCommand(ArgResults topLevelResults) async {
     var result = await super.runCommand(topLevelResults);
     return result;
   }
 
   Future<FixResult<T>> runFix(List<String> args) async {
     log = logger;
-    var argResults = argParser.parse(['fix', ...?args]);
+    var argResults = argParser.parse(['fix', ...args]);
     var result = await runCommand(argResults);
     return FixResult(logger, result);
   }
diff --git a/pkg/dev_compiler/README.md b/pkg/dev_compiler/README.md
index 1a9e625..e20dac2 100644
--- a/pkg/dev_compiler/README.md
+++ b/pkg/dev_compiler/README.md
@@ -1,48 +1,81 @@
-The Dart Dev Compiler (DDC) is a fast, modular compiler that generates modern JavaScript (EcmaScript 6).  Its primary use today is to support fast, iterative development of Dart web applications for Chrome and other modern browsers.
+The Dart Dev Compiler (DDC) is a fast, modular compiler that generates modern
+JavaScript (EcmaScript 6). Its primary use today is to support fast, iterative
+development of Dart web applications for Chrome and other modern browsers.
 
-# Soundness and Restrictions
+# Support
 
-DDC is built upon Dart's [sound](https://dart.dev/guides/language/type-system) type system.  It only compiles programs that statically type check (i.e., no strong mode errors).  It leverages static type checking to generate simpler, readable, and more idiomatic code with fewer runtime checks.  In general, DDC is able to provide stronger type guarantees - i.e., *soundness* - than traditional Dart checked mode with significantly fewer runtime checks.
+DDC is meant to be used by build systems like bazel, `build_web_compilers` and
+`flutter_tools`  under the hood. This compiler is not meant to be used by
+application developers directly.
 
-With strong mode, DDC is stricter than traditional Dart production mode or checked mode.  Running existing Dart code on DDC will generally require fixing both static and runtime type errors.
+While at times the code generated by this compiler may be readable, the
+representation is not meant to be stable and can break with time. For that
+reason we do not recommend using this compiler to export Dart as a
+JavaScript module.
 
-For example, although the following snippet will run in production or checked mode, it will fail to compile with DDC:
+The recommended approach to compile Dart to JavaScript is to use `dart compile
+js` instead. If you intend to make a public JavaScript API based on a Dart
+implementation, such API should be declared explicitly using the standard
+Dart-JSInterop mechanisms.
 
-```dart
-var list = ["hello", "world"];  // Inferred as List<String> in strong mode
-List<int> list2 = list;  // Static type error: incompatible types
-```
+# Implementation details
 
-On the other hand, the following snippet - which tries to mask the type error via casts - will compile with DDC, but fail with a runtime type error.
+## Modularity
 
-```dart
-var list = ["hello", "world"];
-List<Object> list2 = list;  // Generics are covariant.  No runtime check required.
-List<int> list3 = list2;  // Implicit runtime downcast triggers error.
-```  
+Unlike Dart2JS, DDC does not require an entire Dart application. Instead, it
+operates modularly: it compiles a set of Dart files into a JavaScript module. A
+DDC compilation step requires a set of input Dart files and a set of *summaries*
+of dependencies. It performs modular type checking as part of this compilation
+step, and, if the input type checks, it generates a JavaScript module. The
+browser (i.e., the JavaScript runtime) loads and links the generated modules
+when running the application. During development, a compilation step only needs
+to be rerun if the Dart files or summaries it relies upon change. For most
+changes, only a very small part of your code will require recompilation.
+Moreover, modules that are unchanged can be cached in the browser.
 
-# Modularity
+## Representation
 
-DDC provides fast, incremental compilation based on standard JavaScript modules.  Unlike Dart2JS, DDC does not require an entire Dart application.  Instead, it operates modularly: it compiles a set of Dart files into a JavaScript module.  A DDC compilation step requires a set of input Dart files and a set of *summaries* of dependencies.  It performs modular type checking as part of this compilation step, and, if the input type checks, it generates a JavaScript module (e.g., [*ES6*](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import), [*AMD*](https://github.com/amdjs/amdjs-api/blob/master/AMD.md), or [*CommonJS*](https://nodejs.org/docs/latest/api/modules.html)).  The browser (i.e., the JavaScript runtime) loads and links the generated modules when running the application.
-During development, a compilation step only needs to be rerun if the Dart files or summaries it relies upon change.  For most changes, only a very small part of your code will require recompilation.  Moreover, modules that are unchanged can be cached in the browser.
+Currently Dart classes are mapped to ES6 classes, Dart fields to ES6 properties,
+Dart getters/setters to ES6 getters/setters, Dart methods to ES6 methods, and so
+on. Often names are preserved and calling conventions are natural JavaScript
+ones.
 
-# EcmaScript 6
+Some Dart concepts don't map directly:
 
-DDC attempts to map Dart to idiomatic EcmaScript 6 (ES6) as cleanly as possible, and it relies heavily on static typing to do this.  In general, where Dart concepts map directly to ES6, DDC generates code accordingly.  For example, Dart classes are mapped to ES6 classes, Dart fields to ES6 properties, Dart getters/setters to ES6 getters/setters, Dart methods to ES6 methods, and so on.  In most cases, names are preserved and calling conventions are natural JavaScript ones.
+- *Libraries*. Multiple Dart libraries are mapped to a single JS module. Each
+  library appears as a first class object in the generated JS module, with its
+  top-level symbols as members. We currently use a heuristic (based upon file
+  paths) to ensure unique naming of generated library objects.
 
-There are some import caveats where Dart concepts do not map directly:
+- *Generics*. Dart generics are *reified*, i.e., they are preserved at runtime.
+  Generic classes are mapped to factories that, given one or more type
+  parameters, return an actual ES6 class (e.g., `HashMap$(core.String,
+  core.int)` produces a class that represents a HashMap from strings to ints).
+  Similarly, generic methods are mapped to factories that, given one or more
+  type parameters, return a method.
 
-- *Libraries*.  Multiple Dart libraries are mapped to a single JS module.  Each library appears as a first class object in the generated JS module, with its top-level symbols as members.  We currently use a heuristic (based upon file paths) to ensure unique naming of generated library objects.
-- *Generics*.  Dart generics are *reified*, i.e., they are preserved at runtime.  Generic classes are mapped to factories that, given one or more type parameters, return an actual ES6 class (e.g., `HashMap$(core.String, core.int)` produces a class that represents a HashMap from strings to ints).  Similarly, generic methods are mapped to factories that, given one or more type parameters, return a method.  
-- *Dynamic*.  DDC supports dynamically typed code (i.e., Dart's `dynamic` type), but it will typically generate less readable and less efficient ES6 output as many type checks must be deferred to runtime.  All dynamic operations are invoked via runtime helper code.
-- *Constructors*.  Dart supports multiple, named and factory constructors for a given class with a different initialization order for fields.  Today, these are mapped to instance or static methods on the generated ES6 class.
-- *Private members*.  Dart maps private members (e.g., private fields or methods) to ES6 symbols.  For example, `a._x` may map to `a[_x]` where `_x` is a symbol only defined in the scope of the generated library.
-- *Scoping*.  Dart scoping rules and reserved words are slightly different than JavaScript.  While we try to preserve names wherever possible, in certain cases, we are required to rename.
+- *Dynamic*. DDC supports dynamically typed code (i.e., Dart's `dynamic` type),
+  but it will typically generate less readable and less efficient ES6 output as
+  many type checks must be deferred to runtime. All dynamic operations are
+  invoked via runtime helper code.
 
-In general, the current conventions (i.e., the Application Binary Interface or ABI in compiler terminology) should not be considered stable.  We reserve the right to change these in the future.
+- *Constructors*. Dart supports multiple, named and factory constructors for a
+  given class with a different initialization order for fields. Today, these
+  are mapped to instance or static methods on the generated ES6 class.
+
+- *Private members*. Dart maps private members (e.g., private fields or
+  methods) to ES6 symbols. For example, `a._x` may map to `a[_x]` where `_x` is
+  a symbol only defined in the scope of the generated library.
+
+- *Scoping*. Dart scoping rules and reserved words are slightly different than
+  JavaScript. While we try to preserve names wherever possible, in certain
+  cases, we are required to rename.
+
+In general, the current conventions (i.e., the Application Binary Interface or
+ABI in compiler terminology) should not be considered stable. We reserve the
+right to change these in the future.
 
 # Browser support
 
-DDC currently supports Chrome stable (though users have had success running on FireFox and Safari).  In the near future, we expect to target all common modern browsers that support ES6.  ES6 itself is in active development across all modern browsers, but at advanced stages of support:
-
-[kangax.github.io/compat-table/es6](https://kangax.github.io/compat-table/es6/).
+DDC currently supports Chrome stable (though users have had success running on
+FireFox and Safari).
diff --git a/pkg/dev_compiler/USAGE.md b/pkg/dev_compiler/USAGE.md
deleted file mode 100644
index e2f0b69..0000000
--- a/pkg/dev_compiler/USAGE.md
+++ /dev/null
@@ -1,81 +0,0 @@
-# Usage
-
-The [Dart Dev Compiler](README.md) (DDC) is an **experimental** development
-compiler from Dart to EcmaScript 6. It is still incomplete, under heavy
-development, and not yet ready for production use.
-
-With those caveats, we welcome feedback for those experimenting.
-
-The easiest way to compile and run DDC generated code for now is via NodeJS.
-The following instructions are in a state of flux -- please expect them to
-change. If you find issues, please let us know.
-
-1.  Follow the [Getting the Source](https://github.com/dart-lang/sdk/wiki/Building#getting-the-source) steps, and
-    set the environment variable `DDC_PATH` to the `pkg/dev_compiler`
-    subdirectory within wherever you check that out.
-
-2.  Install nodejs v6.0 or later and add it to your path. It can be installed
-    from:
-
-    https://nodejs.org/
-
-    Note, v6 or later is required for harmony / ES6 support.
-
-3.  Define a node path (you can add other directories if you want to separate
-    things out):
-
-    ```sh
-    export NODE_PATH=$DDC_PATH/lib/js/common:.
-    ```
-
-4.  Compile a test file with a `main` entry point:
-
-    ```sh
-    dart $DDC_PATH/bin/dartdevc.dart --modules node -o hello.js hello.dart
-    ```
-
-    Note, the `hello.js` built here is not fully linked. It loads the SDK via a `require` call.
-
-5.  Run it via your node built in step 1:
-
-    ```sh
-    node -e 'require("hello").hello.main()'
-    ```
-
-6.  Compile multiple libraries using summaries. E.g., write a `world.dart` that
-    imports `hello.dart` with it's own `main`. Step 5 above generated a summary
-    (`hello.sum`) for `hello.dart`. Build world:
-
-    ```sh
-    dart $DDC_PATH/bin/dartdevc.dart --modules node -s hello.sum -o world.js world.dart
-    ```
-
-    Run world just like hello above:
-
-    ```sh
-    node -e 'require("world").world.main()'
-    ```
-
-7.  Node modules do not run directly on the browser or v8. You can use a tool
-    like `browserify` to build a linked javascript file that can:
-
-    Install:
-
-    ```sh
-    sudo npm install -g browserify
-    ```
-
-    and run, e.g.,:
-
-    ```sh
-    echo 'require("world").world.main()' | browserify -d - > world.dart.js
-    ```
-
-    The produced `world.dart.js` fully links all dependencies (`dart_sdk`,
-    `hello`, and `world`) and executes `world.main`.  It can be loaded via
-    script tag and run in Chrome (stable or later).
-
-## Feedback
-
-Please file issues in our [GitHub issue
-tracker](https://github.com/dart-lang/sdk/issues).
diff --git a/pkg/dev_compiler/test/worker/worker_test.dart b/pkg/dev_compiler/test/worker/worker_test.dart
index 84111ba..25a4474 100644
--- a/pkg/dev_compiler/test/worker/worker_test.dart
+++ b/pkg/dev_compiler/test/worker/worker_test.dart
@@ -10,22 +10,21 @@
 
 import 'package:bazel_worker/bazel_worker.dart';
 import 'package:bazel_worker/testing.dart';
-import 'package:path/path.dart' show dirname, join, joinAll;
 import 'package:test/test.dart';
 
 Directory tmp = Directory.systemTemp.createTempSync('ddc_worker_test');
-File file(String path) => File(join(tmp.path, joinAll(path.split('/'))));
+File file(String path) => File.fromUri(tmp.uri.resolve(path));
 
 void main() {
   var baseArgs = <String>[];
-  final binDir = dirname(Platform.resolvedExecutable);
-  // Note, the bots use the dart binary in the top-level build directory.
-  // On windows, this is a .bat file.
-  final dartdevc = 'dartdevc${Platform.isWindows ? ".bat" : ""}';
-  final executable = binDir.endsWith('bin')
-      ? join(binDir, dartdevc)
-      : join(binDir, 'dart-sdk', 'bin', dartdevc);
-  final executableArgs = <String>[];
+  final executableArgs = <String>[
+    Platform.script.resolve('../../bin/dartdevc.dart').path,
+    '--sound-null-safety',
+    '--dart-sdk-summary',
+    Uri.parse(Platform.resolvedExecutable)
+        .resolve('ddc_outline_sound.dill')
+        .path
+  ];
   group('DDC: Hello World', () {
     final argsFile = file('hello_world.args');
     final inputDartFile = file('hello_world.dart');
@@ -54,7 +53,7 @@
 
     test('can compile in worker mode', () async {
       var args = executableArgs.toList()..add('--persistent_worker');
-      var process = await Process.start(executable, args);
+      var process = await Process.start(Platform.executable, args);
       var messageGrouper = AsyncMessageGrouper(process.stdout);
 
       var request = WorkRequest();
@@ -97,7 +96,7 @@
 
     test('can compile in basic mode', () {
       var args = executableArgs.toList()..addAll(compilerArgs);
-      var result = Process.runSync(executable, args);
+      var result = Process.runSync(Platform.executable, args);
 
       expect(result.exitCode, EXIT_CODE_OK);
       expect(result.stdout, isEmpty);
@@ -109,7 +108,7 @@
       var args = List<String>.from(executableArgs)
         ..add('--does-not-exist')
         ..addAll(compilerArgs);
-      var result = Process.runSync(executable, args);
+      var result = Process.runSync(Platform.executable, args);
 
       expect(result.exitCode, 64);
       expect(result.stdout,
@@ -123,7 +122,7 @@
         ..add('--does-not-exist')
         ..add('--ignore-unrecognized-flags')
         ..addAll(compilerArgs);
-      var result = Process.runSync(executable, args);
+      var result = Process.runSync(Platform.executable, args);
 
       expect(result.exitCode, EXIT_CODE_OK);
       expect(result.stdout, isEmpty);
@@ -135,7 +134,7 @@
       argsFile.createSync();
       argsFile.writeAsStringSync(compilerArgs.join('\n'));
       var args = executableArgs.toList()..add('@${argsFile.path}');
-      var process = await Process.start(executable, args);
+      var process = await Process.start(Platform.executable, args);
       await stderr.addStream(process.stderr);
       var futureProcessOutput = process.stdout.map(utf8.decode).toList();
 
@@ -149,7 +148,7 @@
         ..add('--modules')
         ..add('legacy')
         ..addAll(compilerArgs);
-      var result = Process.runSync(executable, args);
+      var result = Process.runSync(Platform.executable, args);
 
       expect(result.exitCode, EXIT_CODE_OK);
       expect(result.stdout, isEmpty);
@@ -187,7 +186,7 @@
 
     test('can compile in basic mode', () {
       var result = Process.runSync(
-          executable,
+          Platform.executable,
           executableArgs +
               baseArgs +
               [
@@ -203,7 +202,7 @@
       expect(greetingSummary.existsSync(), isTrue);
 
       result = Process.runSync(
-          executable,
+          Platform.executable,
           executableArgs +
               baseArgs +
               [
@@ -223,7 +222,7 @@
 
     test('reports error on overlapping summaries', () {
       var result = Process.runSync(
-          executable,
+          Platform.executable,
           executableArgs +
               baseArgs +
               [
@@ -239,7 +238,7 @@
       expect(greetingSummary.existsSync(), isTrue);
 
       result = Process.runSync(
-          executable,
+          Platform.executable,
           executableArgs +
               baseArgs +
               [
@@ -255,7 +254,7 @@
       expect(greeting2Summary.existsSync(), isTrue);
 
       result = Process.runSync(
-          executable,
+          Platform.executable,
           executableArgs +
               baseArgs +
               [
@@ -289,7 +288,7 @@
 
     test('incorrect usage', () {
       var result = Process.runSync(
-          executable,
+          Platform.executable,
           executableArgs +
               baseArgs +
               [
@@ -304,7 +303,7 @@
     test('compile errors', () {
       badFileDart.writeAsStringSync('main() => "hello world"');
       var result = Process.runSync(
-          executable,
+          Platform.executable,
           executableArgs +
               baseArgs +
               [
@@ -340,7 +339,7 @@
 
     test('works if part and library supplied', () {
       var result = Process.runSync(
-          executable,
+          Platform.executable,
           executableArgs +
               baseArgs +
               [
@@ -359,7 +358,7 @@
 
     test('works if part is not supplied', () {
       var result = Process.runSync(
-          executable,
+          Platform.executable,
           executableArgs +
               baseArgs +
               [
diff --git a/pkg/dev_compiler/tool/ddc b/pkg/dev_compiler/tool/ddc
deleted file mode 100755
index cfe8879..0000000
--- a/pkg/dev_compiler/tool/ddc
+++ /dev/null
@@ -1,120 +0,0 @@
-#!/bin/bash
-#
-# Compiles code with DDC and runs the resulting code in node.js.
-#
-# The first script supplied should be the one with `main()`.
-#
-# Saves the output in the same directory as the sources for convenient
-# inspection, modification or rerunning the code.
-set -e
-
-function follow_links() {
-  file="$1"
-  while [ -h "$file" ]; do
-    file="$(readlink "$file")"
-  done
-  echo "$file"
-}
-PROG_NAME="$(follow_links "$BASH_SOURCE")"
-SDK_DIR="$( cd "${PROG_NAME%/*}/../../.."; pwd -P)"
-
-if [[ `uname` == 'Darwin' ]];
-then
-  OUT_DIR="$SDK_DIR"/xcodebuild
-else
-  OUT_DIR="$SDK_DIR"/out
-fi
-
-if [ -z "$DART_CONFIGURATION" ];
-then
-  DIRS=$( ls "$OUT_DIR" )
-  # list of possible configurations in decreasing desirability
-  CONFIGS=("ReleaseX64" "ReleaseIA32" "DebugX64" "DebugIA32"
-    "ReleaseARM" "ReleaseARM64" "DebugARM" "DebugARM64")
-  DART_CONFIGURATION="None"
-  for CONFIG in ${CONFIGS[*]}
-  do
-    for DIR in $DIRS;
-    do
-      if [ "$CONFIG" = "$DIR" ];
-      then
-        # choose most desirable configuration that is available and break
-        DART_CONFIGURATION="$DIR"
-        break 2
-      fi
-    done
-  done
-  if [ "$DART_CONFIGURATION" = "None" ]
-  then
-    echo "No valid dart configuration found in $OUT_DIR"
-    exit 1
-  fi
-fi
-
-ROOT_OUT_DIR="$OUT_DIR"/"$DART_CONFIGURATION"
-GEN_DIR="$ROOT_OUT_DIR"/gen/utils/dartdevc
-
-KERNEL=false
-if [ "$1" = "-k" ]; then
-  KERNEL=true
-  shift
-fi
-
-BASENAME=$( basename "${1%.*}")
-LIBROOT=$(cd $( dirname "${1%.*}") && pwd)
-
-if [ "$KERNEL" = true ]; then
-
-  if [ ! -e $ROOT_OUT_DIR/ddc_sdk.dill ]; then
-    echo "DDC SDK must be built first, please run:"
-    echo "    pushd $SDKDIR"
-    echo "    ./tools/build.py -m release dartdevc_kernel_sdk"
-    exit 1
-  fi
-
-  NODE_PATH=$GEN_DIR/kernel/common:$LIBROOT:$NODE_PATH
-
-  $SDK_DIR/sdk/bin/dartdevc --kernel --modules=node \
-      --dart-sdk-summary=$ROOT_OUT_DIR/ddc_sdk.dill \
-      -o $LIBROOT/$BASENAME.js $*
-else
-
-  if [ ! -e $GEN_DIR/ddc_sdk.sum ]; then
-    echo "DDC SDK must be built first, please run:"
-    echo "    pushd $SDKDIR"
-    echo "    ./tools/build.py -m release dartdevc_sdk"
-    exit 1
-  fi
-
-  NODE_PATH=$GEN_DIR/js/common:$LIBROOT:$NODE_PATH
-
-  $SDK_DIR/sdk/bin/dartdevc --modules=node \
-      --library-root=$LIBROOT --dart-sdk-summary=$GEN_DIR/ddc_sdk.sum \
-      -o $LIBROOT/$BASENAME.js $*
-fi
-
-export NODE_PATH
-pushd $LIBROOT > /dev/null
-# TODO(jmesserly): we could have this output the same content as the devtool
-# script, so you could debug the output without recompiling?
-echo "
-    let source_maps;
-    try {
-      source_maps = require('source-map-support');
-      source_maps.install();
-    } catch(e) {
-    }
-    let sdk = require(\"dart_sdk\");
-    let main = require(\"./$BASENAME\").$BASENAME.main;
-    try {
-      sdk._isolate_helper.startRootIsolate(main, []);
-    } catch(e) {
-      if (!source_maps) {
-        console.log('For Dart source maps: npm install source-map-support');
-      }
-      console.error(e);
-      process.exit(1);
-    }" \
-    > $LIBROOT/$BASENAME.run.js
-node $BASENAME.run.js || exit 1
-popd > /dev/null
diff --git a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
index 10a9389..89b7847 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -75,7 +75,6 @@
         templateExperimentNotEnabled;
 import '../identifiers.dart'
     show Identifier, InitializedIdentifier, QualifiedName, flattenName;
-import '../kernel/utils.dart';
 import '../messages.dart' as messages show getLocationFromUri;
 import '../modifier.dart'
     show Modifier, constMask, covariantMask, finalMask, lateMask, requiredMask;
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
index 33786c8..9bad9b3 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
@@ -145,6 +145,14 @@
       /* charOffset = */ null,
       instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected);
 
+  final NamedTypeBuilder underscoreEnumType = new NamedTypeBuilder(
+      "_Enum",
+      const NullabilityBuilder.omitted(),
+      /* arguments = */ null,
+      /* fileUri = */ null,
+      /* charOffset = */ null,
+      instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected);
+
   final bool excludeSource = !CompilerContext.current.options.embedSourceText;
 
   final Map<String, String>? environmentDefines =
@@ -398,12 +406,10 @@
       loader.computeVariances();
       loader.computeDefaultTypes(
           dynamicType, nullType, bottomType, objectClassBuilder);
-      // TODO(johnniwinther): Enable this when supported in the isolate-based
-      //  macro executor.
-      /*if (macroApplications != null) {
+      if (macroApplications != null) {
         await macroApplications.applyTypeMacros();
-      }*/
-      List<SourceClassBuilder> sourceClassBuilders =
+      }
+      List<SourceClassBuilder>? sourceClassBuilders =
           loader.checkSemantics(objectClassBuilder);
       loader.finishTypeVariables(objectClassBuilder, dynamicType);
       loader.createTypeInferenceEngine();
@@ -416,11 +422,9 @@
       computeCoreTypes();
       loader.buildClassHierarchy(sourceClassBuilders, objectClassBuilder);
       loader.checkSupertypes(sourceClassBuilders, enumClass);
-      // TODO(johnniwinther): Enable this when supported in the isolate-based
-      //  macro executor.
-      /*if (macroApplications != null) {
+      if (macroApplications != null) {
         await macroApplications.applyDeclarationMacros();
-      }*/
+      }
       loader.buildClassHierarchyMembers(sourceClassBuilders);
       loader.computeHierarchy();
       loader.computeShowHideElements();
@@ -438,6 +442,11 @@
       loader.checkMainMethods();
       installAllComponentProblems(loader.allComponentProblems);
       loader.allComponentProblems.clear();
+      // For whatever reason sourceClassBuilders is kept alive for some amount
+      // of time, meaning that all source library builders will be kept alive
+      // (for whatever amount of time) even though we convert them to dill
+      // library builders. To avoid it we null it out here.
+      sourceClassBuilders = null;
       return new BuildResult(
           component: component, macroApplications: macroApplications);
     }, () => loader.currentUriForCrashReporting);
@@ -463,7 +472,7 @@
       finishSynthesizedParameters();
       loader.finishDeferredLoadTearoffs();
       loader.finishNoSuchMethodForwarders();
-      List<SourceClassBuilder> sourceClasses = loader.collectSourceClasses();
+      List<SourceClassBuilder>? sourceClasses = loader.collectSourceClasses();
       if (macroApplications != null) {
         await macroApplications.applyDefinitionMacros(
             loader.coreTypes, loader.hierarchy);
@@ -475,6 +484,12 @@
 
       if (verify) this.verify();
       installAllComponentProblems(loader.allComponentProblems);
+
+      // For whatever reason sourceClasses is kept alive for some amount
+      // of time, meaning that all source library builders will be kept alive
+      // (for whatever amount of time) even though we convert them to dill
+      // library builders. To avoid it we null it out here.
+      sourceClasses = null;
       return new BuildResult(
           component: component, macroApplications: macroApplications);
     }, () => loader.currentUriForCrashReporting);
@@ -992,6 +1007,8 @@
         .lookupLocalMember("Never", required: true) as TypeDeclarationBuilder);
     enumType.bind(loader.coreLibrary.lookupLocalMember("Enum", required: true)
         as TypeDeclarationBuilder);
+    underscoreEnumType.bind(loader.coreLibrary
+        .lookupLocalMember("_Enum", required: true) as TypeDeclarationBuilder);
   }
 
   void computeCoreTypes() {
diff --git a/pkg/front_end/lib/src/fasta/kernel/macro.dart b/pkg/front_end/lib/src/fasta/kernel/macro.dart
index 7a54280..a637145 100644
--- a/pkg/front_end/lib/src/fasta/kernel/macro.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/macro.dart
@@ -2,7 +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.
 
-import 'package:_fe_analyzer_shared/src/macros/api.dart' hide TypeBuilder;
+// TODO: Only import `Identifier` under a prefix if/when the presubmit check
+// allows duplicate imports if they have different prefixes.
+import 'package:_fe_analyzer_shared/src/macros/api.dart' as macro;
 import 'package:_fe_analyzer_shared/src/macros/executor.dart';
 import 'package:_fe_analyzer_shared/src/macros/executor_shared/introspection_impls.dart';
 import 'package:_fe_analyzer_shared/src/macros/executor_shared/remote_instance.dart';
@@ -27,6 +29,8 @@
 final Uri macroLibraryUri =
     Uri.parse('package:_fe_analyzer_shared/src/macros/api.dart');
 const String macroClassName = 'Macro';
+final IdentifierImpl dynamicIdentifier =
+    new IdentifierImpl(id: RemoteInstance.uniqueId, name: 'dynamic');
 
 class MacroDeclarationData {
   bool macrosAreAvailable = false;
@@ -66,6 +70,8 @@
 
 class MacroApplicationDataForTesting {
   Map<SourceLibraryBuilder, LibraryMacroApplicationData> libraryData = {};
+  Map<MemberBuilder, List<MacroExecutionResult>> memberTypesResults = {};
+  Map<MemberBuilder, List<MacroExecutionResult>> memberDeclarationsResults = {};
   Map<MemberBuilder, List<MacroExecutionResult>> memberDefinitionsResults = {};
 }
 
@@ -137,15 +143,15 @@
     return new MacroApplications(macroExecutor, libraryData, dataForTesting);
   }
 
-  Map<MemberBuilder, Declaration?> _memberDeclarations = {};
+  Map<MemberBuilder, macro.Declaration?> _memberDeclarations = {};
 
   // TODO(johnniwinther): Support all members.
-  Declaration? _getMemberDeclaration(MemberBuilder memberBuilder) {
+  macro.Declaration? _getMemberDeclaration(MemberBuilder memberBuilder) {
     return _memberDeclarations[memberBuilder] ??=
         _createMemberDeclaration(memberBuilder);
   }
 
-  Declaration? _createMemberDeclaration(MemberBuilder memberBuilder) {
+  macro.Declaration? _createMemberDeclaration(MemberBuilder memberBuilder) {
     if (memberBuilder is SourceProcedureBuilder) {
       return createTopLevelFunctionDeclaration(memberBuilder);
     } else {
@@ -155,12 +161,21 @@
     }
   }
 
-  Future<void> _applyTypeMacros(
-      Declaration declaration, List<MacroApplication> macroApplications) async {
+  Future<List<MacroExecutionResult>> _applyTypeMacros(
+      macro.Declaration declaration,
+      List<MacroApplication> macroApplications) async {
+    List<MacroExecutionResult> results = [];
     for (MacroApplication macroApplication in macroApplications) {
-      await _macroExecutor.executeTypesPhase(
-          macroApplication.instanceIdentifier, declaration);
+      if (macroApplication.instanceIdentifier.shouldExecute(
+          // TODO(johnniwinther): Get the declaration kind from [declaration].
+          DeclarationKind.function,
+          Phase.types)) {
+        MacroExecutionResult result = await _macroExecutor.executeTypesPhase(
+            macroApplication.instanceIdentifier, declaration);
+        results.add(result);
+      }
     }
+    return results;
   }
 
   Future<void> applyTypeMacros() async {
@@ -171,31 +186,42 @@
       for (MapEntry<MemberBuilder, List<MacroApplication>> memberEntry
           in libraryMacroApplicationData.memberApplications.entries) {
         MemberBuilder memberBuilder = memberEntry.key;
-        Declaration? declaration = _getMemberDeclaration(memberBuilder);
+        macro.Declaration? declaration = _getMemberDeclaration(memberBuilder);
         if (declaration != null) {
-          await _applyTypeMacros(declaration, memberEntry.value);
+          List<MacroExecutionResult> results =
+              await _applyTypeMacros(declaration, memberEntry.value);
+          dataForTesting?.memberTypesResults[memberBuilder] = results;
         }
       }
     }
   }
 
-  Future<void> _applyDeclarationMacros(
-      Declaration declaration,
+  Future<List<MacroExecutionResult>> _applyDeclarationMacros(
+      macro.Declaration declaration,
       List<MacroApplication> macroApplications,
-      TypeResolver typeResolver,
-      ClassIntrospector classIntrospector) async {
+      macro.TypeResolver typeResolver,
+      macro.ClassIntrospector classIntrospector) async {
+    List<MacroExecutionResult> results = [];
     for (MacroApplication macroApplication in macroApplications) {
-      await _macroExecutor.executeDeclarationsPhase(
-          macroApplication.instanceIdentifier,
-          declaration,
-          typeResolver,
-          classIntrospector);
+      if (macroApplication.instanceIdentifier.shouldExecute(
+          // TODO(johnniwinther): Get the declaration kind from [declaration].
+          DeclarationKind.function,
+          Phase.declarations)) {
+        MacroExecutionResult result =
+            await _macroExecutor.executeDeclarationsPhase(
+                macroApplication.instanceIdentifier,
+                declaration,
+                typeResolver,
+                classIntrospector);
+        results.add(result);
+      }
     }
+    return results;
   }
 
   Future<void> applyDeclarationMacros() async {
-    TypeResolver typeResolver = new _TypeResolver(this);
-    ClassIntrospector classIntrospector = new _ClassIntrospector();
+    macro.TypeResolver typeResolver = new _TypeResolver(this);
+    macro.ClassIntrospector classIntrospector = new _ClassIntrospector();
     for (MapEntry<SourceLibraryBuilder,
         LibraryMacroApplicationData> libraryEntry in libraryData.entries) {
       LibraryMacroApplicationData libraryMacroApplicationData =
@@ -203,31 +229,37 @@
       for (MapEntry<MemberBuilder, List<MacroApplication>> memberEntry
           in libraryMacroApplicationData.memberApplications.entries) {
         MemberBuilder memberBuilder = memberEntry.key;
-        Declaration? declaration = _getMemberDeclaration(memberBuilder);
+        macro.Declaration? declaration = _getMemberDeclaration(memberBuilder);
         if (declaration != null) {
-          await _applyDeclarationMacros(
+          List<MacroExecutionResult> results = await _applyDeclarationMacros(
               declaration, memberEntry.value, typeResolver, classIntrospector);
+          dataForTesting?.memberDeclarationsResults[memberBuilder] = results;
         }
       }
     }
   }
 
   Future<List<MacroExecutionResult>> _applyDefinitionMacros(
-      Declaration declaration,
+      macro.Declaration declaration,
       List<MacroApplication> macroApplications,
-      TypeResolver typeResolver,
-      ClassIntrospector classIntrospector,
-      TypeDeclarationResolver typeDeclarationResolver) async {
+      macro.TypeResolver typeResolver,
+      macro.ClassIntrospector classIntrospector,
+      macro.TypeDeclarationResolver typeDeclarationResolver) async {
     List<MacroExecutionResult> results = [];
     for (MacroApplication macroApplication in macroApplications) {
-      MacroExecutionResult result =
-          await _macroExecutor.executeDefinitionsPhase(
-              macroApplication.instanceIdentifier,
-              declaration,
-              typeResolver,
-              classIntrospector,
-              typeDeclarationResolver);
-      results.add(result);
+      if (macroApplication.instanceIdentifier.shouldExecute(
+          // TODO(johnniwinther): Get the declaration kind from [declaration].
+          DeclarationKind.function,
+          Phase.definitions)) {
+        MacroExecutionResult result =
+            await _macroExecutor.executeDefinitionsPhase(
+                macroApplication.instanceIdentifier,
+                declaration,
+                typeResolver,
+                classIntrospector,
+                typeDeclarationResolver);
+        results.add(result);
+      }
     }
     return results;
   }
@@ -237,9 +269,9 @@
   Future<void> applyDefinitionMacros(
       CoreTypes coreTypes, ClassHierarchy classHierarchy) async {
     typeEnvironment = new TypeEnvironment(coreTypes, classHierarchy);
-    TypeResolver typeResolver = new _TypeResolver(this);
-    ClassIntrospector classIntrospector = new _ClassIntrospector();
-    TypeDeclarationResolver typeDeclarationResolver =
+    macro.TypeResolver typeResolver = new _TypeResolver(this);
+    macro.ClassIntrospector classIntrospector = new _ClassIntrospector();
+    macro.TypeDeclarationResolver typeDeclarationResolver =
         new _TypeDeclarationResolver();
     for (MapEntry<SourceLibraryBuilder,
         LibraryMacroApplicationData> libraryEntry in libraryData.entries) {
@@ -248,7 +280,7 @@
       for (MapEntry<MemberBuilder, List<MacroApplication>> memberEntry
           in libraryMacroApplicationData.memberApplications.entries) {
         MemberBuilder memberBuilder = memberEntry.key;
-        Declaration? declaration = _getMemberDeclaration(memberBuilder);
+        macro.Declaration? declaration = _getMemberDeclaration(memberBuilder);
         if (declaration != null) {
           List<MacroExecutionResult> results = await _applyDefinitionMacros(
               declaration,
@@ -268,7 +300,7 @@
     _typeAnnotationCache.clear();
   }
 
-  FunctionDeclaration createTopLevelFunctionDeclaration(
+  macro.FunctionDeclaration createTopLevelFunctionDeclaration(
       SourceProcedureBuilder builder) {
     List<ParameterDeclarationImpl>? positionalParameters;
     List<ParameterDeclarationImpl>? namedParameters;
@@ -286,7 +318,8 @@
         if (formal.isNamed) {
           namedParameters.add(new ParameterDeclarationImpl(
               id: RemoteInstance.uniqueId,
-              name: formal.name,
+              identifier: new IdentifierImpl(
+                  id: RemoteInstance.uniqueId, name: formal.name),
               isRequired: formal.isNamedRequired,
               isNamed: true,
               type: type,
@@ -294,7 +327,8 @@
         } else {
           positionalParameters.add(new ParameterDeclarationImpl(
               id: RemoteInstance.uniqueId,
-              name: formal.name,
+              identifier: new IdentifierImpl(
+                  id: RemoteInstance.uniqueId, name: formal.name),
               isRequired: formal.isRequired,
               isNamed: false,
               type: type,
@@ -305,7 +339,8 @@
 
     return new FunctionDeclarationImpl(
         id: RemoteInstance.uniqueId,
-        name: builder.name,
+        identifier:
+            new IdentifierImpl(id: RemoteInstance.uniqueId, name: builder.name),
         isAbstract: builder.isAbstract,
         isExternal: builder.isExternal,
         isGetter: builder.isGetter,
@@ -339,7 +374,8 @@
               typeBuilder: typeBuilder,
               libraryBuilder: libraryBuilder,
               id: RemoteInstance.uniqueId,
-              name: name,
+              identifier:
+                  new IdentifierImpl(id: RemoteInstance.uniqueId, name: name),
               typeArguments: typeArguments,
               isNullable: isNullable);
         } else if (name is QualifiedName) {
@@ -348,7 +384,13 @@
               typeBuilder: typeBuilder,
               libraryBuilder: libraryBuilder,
               id: RemoteInstance.uniqueId,
-              name: '${name.qualifier}.${name.name}',
+              identifier: new IdentifierImpl(
+                  id: RemoteInstance.uniqueId,
+                  // TODO: We probably shouldn't be including the qualifier
+                  // here. Kernel should probably have its own implementation
+                  // of Identifier which holds on to the qualified reference
+                  // instead.
+                  name: '${name.qualifier}.${name.name}'),
               typeArguments: typeArguments,
               isNullable: isNullable);
         }
@@ -358,7 +400,7 @@
         typeBuilder: typeBuilder,
         libraryBuilder: libraryBuilder,
         id: RemoteInstance.uniqueId,
-        name: 'dynamic',
+        identifier: dynamicIdentifier,
         isNullable: false,
         typeArguments: const []);
   }
@@ -369,7 +411,8 @@
         _computeTypeAnnotation(libraryBuilder, typeBuilder);
   }
 
-  StaticType resolveTypeAnnotation(_NamedTypeAnnotationImpl typeAnnotation) {
+  macro.StaticType resolveTypeAnnotation(
+      _NamedTypeAnnotationImpl typeAnnotation) {
     TypeBuilder? typeBuilder = typeAnnotation.typeBuilder;
     LibraryBuilder libraryBuilder = typeAnnotation.libraryBuilder;
     DartType dartType;
@@ -383,7 +426,7 @@
 
   Map<DartType, _StaticTypeImpl> _staticTypeCache = {};
 
-  StaticType createStaticType(DartType dartType) {
+  macro.StaticType createStaticType(DartType dartType) {
     return _staticTypeCache[dartType] ??= new _StaticTypeImpl(this, dartType);
   }
 }
@@ -397,16 +440,16 @@
     required this.libraryBuilder,
     required int id,
     required bool isNullable,
-    required String name,
+    required IdentifierImpl identifier,
     required List<TypeAnnotationImpl> typeArguments,
   }) : super(
             id: id,
             isNullable: isNullable,
-            name: name,
+            identifier: identifier,
             typeArguments: typeArguments);
 }
 
-class _StaticTypeImpl extends StaticType {
+class _StaticTypeImpl extends macro.StaticType {
   final MacroApplications macroApplications;
   final DartType type;
 
@@ -424,60 +467,69 @@
   }
 }
 
-class _TypeResolver implements TypeResolver {
+class _TypeResolver implements macro.TypeResolver {
   final MacroApplications macroApplications;
 
   _TypeResolver(this.macroApplications);
 
   @override
-  Future<StaticType> resolve(
+  Future<macro.StaticType> instantiateCode(macro.ExpressionCode code) {
+    // TODO: implement instantiateCode
+    throw new UnimplementedError();
+  }
+
+  @override
+  Future<macro.StaticType> instantiateType(
       covariant _NamedTypeAnnotationImpl typeAnnotation) {
     return new Future.value(
         macroApplications.resolveTypeAnnotation(typeAnnotation));
   }
 }
 
-class _ClassIntrospector implements ClassIntrospector {
+class _ClassIntrospector implements macro.ClassIntrospector {
   @override
-  Future<List<ConstructorDeclaration>> constructorsOf(ClassDeclaration clazz) {
+  Future<List<macro.ConstructorDeclaration>> constructorsOf(
+      macro.ClassDeclaration clazz) {
     // TODO: implement constructorsOf
     throw new UnimplementedError('_ClassIntrospector.constructorsOf');
   }
 
   @override
-  Future<List<FieldDeclaration>> fieldsOf(ClassDeclaration clazz) {
+  Future<List<macro.FieldDeclaration>> fieldsOf(macro.ClassDeclaration clazz) {
     // TODO: implement fieldsOf
     throw new UnimplementedError('_ClassIntrospector.fieldsOf');
   }
 
   @override
-  Future<List<ClassDeclaration>> interfacesOf(ClassDeclaration clazz) {
+  Future<List<macro.ClassDeclaration>> interfacesOf(
+      macro.ClassDeclaration clazz) {
     // TODO: implement interfacesOf
     throw new UnimplementedError('_ClassIntrospector.interfacesOf');
   }
 
   @override
-  Future<List<MethodDeclaration>> methodsOf(ClassDeclaration clazz) {
+  Future<List<macro.MethodDeclaration>> methodsOf(
+      macro.ClassDeclaration clazz) {
     // TODO: implement methodsOf
     throw new UnimplementedError('_ClassIntrospector.methodsOf');
   }
 
   @override
-  Future<List<ClassDeclaration>> mixinsOf(ClassDeclaration clazz) {
+  Future<List<macro.ClassDeclaration>> mixinsOf(macro.ClassDeclaration clazz) {
     // TODO: implement mixinsOf
     throw new UnimplementedError('_ClassIntrospector.mixinsOf');
   }
 
   @override
-  Future<ClassDeclaration?> superclassOf(ClassDeclaration clazz) {
+  Future<macro.ClassDeclaration?> superclassOf(macro.ClassDeclaration clazz) {
     // TODO: implement superclassOf
     throw new UnimplementedError('_ClassIntrospector.superclassOf');
   }
 }
 
-class _TypeDeclarationResolver implements TypeDeclarationResolver {
+class _TypeDeclarationResolver implements macro.TypeDeclarationResolver {
   @override
-  Future<TypeDeclaration> declarationOf(NamedStaticType annotation) {
+  Future<macro.TypeDeclaration> declarationOf(macro.Identifier identifier) {
     // TODO: implement declarationOf
     throw new UnimplementedError('_TypeDeclarationResolver.declarationOf');
   }
diff --git a/pkg/front_end/lib/src/fasta/source/outline_builder.dart b/pkg/front_end/lib/src/fasta/source/outline_builder.dart
index 8510a02..47620d5 100644
--- a/pkg/front_end/lib/src/fasta/source/outline_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/outline_builder.dart
@@ -3230,16 +3230,10 @@
     if (mixins is ParserRecovery) {
       push(new ParserRecovery(withKeyword.charOffset));
     } else {
-      NamedTypeBuilder enumType = new NamedTypeBuilder(
-          "_Enum",
-          const NullabilityBuilder.omitted(),
-          /* arguments = */ null,
-          /* fileUri = */ null,
-          /* charOffset = */ null,
-          instanceTypeVariableAccess:
-              InstanceTypeVariableAccessState.Unexpected);
       push(libraryBuilder.addMixinApplication(
-          enumType, mixins as List<TypeBuilder>, withKeyword.charOffset));
+          libraryBuilder.loader.target.underscoreEnumType,
+          mixins as List<TypeBuilder>,
+          withKeyword.charOffset));
     }
   }
 
diff --git a/pkg/front_end/lib/src/fasta/source/source_class_builder.dart b/pkg/front_end/lib/src/fasta/source/source_class_builder.dart
index 2e98155..50fad75 100644
--- a/pkg/front_end/lib/src/fasta/source/source_class_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_class_builder.dart
@@ -105,8 +105,6 @@
 
   SourceClassBuilder? _patchBuilder;
 
-  final bool isEnumMixin;
-
   SourceClassBuilder(
       List<MetadataBuilder>? metadata,
       int modifiers,
@@ -126,8 +124,7 @@
       {Class? cls,
       this.mixedInTypeBuilder,
       this.isMixinDeclaration = false,
-      this.isMacro: false,
-      this.isEnumMixin: false})
+      this.isMacro: false})
       : actualCls = initializeClass(cls, typeVariables, name, parent,
             startCharOffset, nameOffset, charEndOffset, referencesFromIndexed),
         super(metadata, modifiers, name, typeVariables, supertype, interfaces,
@@ -200,11 +197,6 @@
 
     scope.forEach(buildBuilders);
     constructors.forEach(buildBuilders);
-    if (isEnumMixin) {
-      assert(supertypeBuilder?.name == "_Enum");
-      supertypeBuilder?.resolveIn(coreLibrary.scope,
-          supertypeBuilder?.charOffset ?? charOffset, fileUri, library);
-    }
     if (supertypeBuilder != null) {
       supertypeBuilder = _checkSupertype(supertypeBuilder!);
     }
diff --git a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
index bbcbbca..a0bf299 100644
--- a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
@@ -2103,8 +2103,7 @@
       List<TypeVariableBuilder>? typeVariables,
       int modifiers: 0,
       List<TypeBuilder>? interfaces,
-      required bool isMacro,
-      bool isEnumMixin: false}) {
+      required bool isMacro}) {
     if (name == null) {
       // The following parameters should only be used when building a named
       // mixin application.
@@ -2323,8 +2322,7 @@
             charEndOffset,
             referencesFromIndexedClass,
             mixedInTypeBuilder: isMixinDeclaration ? null : mixin,
-            isMacro: isNamedMixinApplication && isMacro,
-            isEnumMixin: isEnumMixin && i == 0);
+            isMacro: isNamedMixinApplication && isMacro);
         // TODO(ahe, kmillikin): Should always be true?
         // pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart can't
         // handle that :(
@@ -2818,7 +2816,7 @@
         typeVariables,
         applyMixins(supertypeBuilder, startCharOffset, charOffset,
             charEndOffset, name, /* isMixinDeclaration = */ false,
-            typeVariables: typeVariables, isMacro: false, isEnumMixin: true),
+            typeVariables: typeVariables, isMacro: false),
         interfaceBuilders,
         enumConstantInfos,
         this,
diff --git a/pkg/front_end/lib/src/fasta/source/source_loader.dart b/pkg/front_end/lib/src/fasta/source/source_loader.dart
index 08c9e9b..97db119 100644
--- a/pkg/front_end/lib/src/fasta/source/source_loader.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_loader.dart
@@ -642,6 +642,9 @@
       currentUriForCrashReporting = library.importUri;
       await buildBody(library);
     }
+    // Workaround: This will return right away but avoid a "semi leak"
+    // where the latest library is saved in a context somewhere.
+    await buildBody(null);
     currentUriForCrashReporting = null;
     logSummary(templateSourceBodySummary);
   }
@@ -1076,7 +1079,10 @@
   }
 
   /// Builds all the method bodies found in the given [library].
-  Future<Null> buildBody(SourceLibraryBuilder library) async {
+  Future<Null> buildBody(SourceLibraryBuilder? library) async {
+    // [library] is only nullable so we can call this a "dummy-time" to get rid
+    // of a semi-leak.
+    if (library == null) return;
     Iterable<SourceLibraryBuilder>? patches = library.patchLibraries;
     if (patches != null) {
       for (SourceLibraryBuilder patchLibrary in patches) {
diff --git a/pkg/front_end/test/incremental_compiler_leak_tester.dart b/pkg/front_end/test/incremental_compiler_leak_test.dart
similarity index 80%
rename from pkg/front_end/test/incremental_compiler_leak_tester.dart
rename to pkg/front_end/test/incremental_compiler_leak_test.dart
index d05460b..581d63f 100644
--- a/pkg/front_end/test/incremental_compiler_leak_tester.dart
+++ b/pkg/front_end/test/incremental_compiler_leak_test.dart
@@ -85,30 +85,48 @@
       // For now ignore anything not in package:kernel or package:front_end.
       if (ignoredClass(classDetails)) continue;
 
+      bool isStrictClass = strictClass(classDetails);
+
+      int expectedStrictClassNumber = -1;
+      if (isStrictClass) {
+        expectedStrictClassNumber = strictClassExpectedNumber(classDetails);
+      }
+
       // If they're all equal there's nothing to talk about.
-      bool same = true;
-      for (int i = 1; i < listOfInstanceCounts.length; i++) {
+      bool sameAndAsExpected = true;
+      for (int i = 0; i < listOfInstanceCounts.length; i++) {
+        if (expectedStrictClassNumber > -1 &&
+            expectedStrictClassNumber != listOfInstanceCounts[i]) {
+          sameAndAsExpected = false;
+          break;
+        }
         if (listOfInstanceCounts[i] != listOfInstanceCounts[0]) {
-          same = false;
+          sameAndAsExpected = false;
           break;
         }
       }
-      if (same) continue;
+      if (sameAndAsExpected) continue;
 
       int midPoint = listOfInstanceCounts.length ~/ 2;
       List<int> firstHalf = listOfInstanceCounts.sublist(0, midPoint);
       List<int> secondHalf = listOfInstanceCounts.sublist(midPoint);
       TTestResult ttestResult = SimpleTTestStat.ttest(secondHalf, firstHalf);
 
-      if (!strictClass(classDetails)) {
+      if (!isStrictClass) {
         if (!ttestResult.significant) continue;
 
         // TODO(jensj): We could possibly also ignore if it's less (i.e. a
         // negative change), or if the change is < 1%, or the change minus the
         // confidence is < 1% etc.
       }
-      print("Differences on ${c.name} (${uriString}): "
-          "$listOfInstanceCounts ($ttestResult)");
+      if (expectedStrictClassNumber > -1) {
+        print("Differences on ${c.name} (${uriString}): "
+            "Expected exactly $expectedStrictClassNumber but found "
+            "$listOfInstanceCounts ($ttestResult)");
+      } else {
+        print("Differences on ${c.name} (${uriString}): "
+            "$listOfInstanceCounts ($ttestResult)");
+      }
       foundLeak = true;
     }
 
@@ -219,20 +237,26 @@
     return true;
   }
 
-  // I have commented out the lazy ones below.
-  Set<String> frontEndStrictClasses = {
+  Map<String, int> frontEndStrictClasses = {
+    // The inner working of dills are created lazily:
     // "DillClassBuilder",
     // "DillExtensionBuilder",
     // "DillExtensionMemberBuilder",
-    "DillLibraryBuilder",
-    "DillLoader",
     // "DillMemberBuilder",
-    "DillTarget",
     // "DillTypeAliasBuilder",
-    "SourceClassBuilder",
-    "SourceExtensionBuilder",
-    "SourceLibraryBuilder",
-    "SourceLoader",
+
+    "DillLibraryBuilder": -1 /* unknown amount */,
+    "DillLoader": 1,
+    "DillTarget": 1,
+
+    // We convert all source builders to dill builders so we expect none to
+    // exist after that.
+    "SourceClassBuilder": 0,
+    "SourceExtensionBuilder": 0,
+    "SourceLibraryBuilder": 0,
+
+    // We still expect exactly 1 source loader though.
+    "SourceLoader": 1,
   };
 
   Set<String> kernelAstStrictClasses = {
@@ -248,13 +272,13 @@
 
   bool strictClass(vmService.Class classDetails) {
     if (!kernelAstStrictClasses.contains(classDetails.name) &&
-        !frontEndStrictClasses.contains(classDetails.name)) return false;
+        !frontEndStrictClasses.containsKey(classDetails.name)) return false;
 
     if (kernelAstStrictClasses.contains(classDetails.name) &&
         classDetails.location?.script?.uri == "package:kernel/ast.dart") {
       return true;
     }
-    if (frontEndStrictClasses.contains(classDetails.name) &&
+    if (frontEndStrictClasses.containsKey(classDetails.name) &&
         classDetails.location?.script?.uri?.startsWith("package:front_end/") ==
             true) {
       return true;
@@ -262,4 +286,20 @@
 
     throw "$classDetails: ${classDetails.name} --- ${classDetails.location}";
   }
+
+  int strictClassExpectedNumber(vmService.Class classDetails) {
+    if (!strictClass(classDetails)) return -1;
+    if (kernelAstStrictClasses.contains(classDetails.name) &&
+        classDetails.location?.script?.uri == "package:kernel/ast.dart") {
+      return -1;
+    }
+    int? result = frontEndStrictClasses[classDetails.name];
+    if (result != null &&
+        classDetails.location?.script?.uri?.startsWith("package:front_end/") ==
+            true) {
+      return result;
+    }
+
+    throw "$classDetails: ${classDetails.name} --- ${classDetails.location}";
+  }
 }
diff --git a/pkg/front_end/test/lint_suite.dart b/pkg/front_end/test/lint_suite.dart
index cd16042..d61759d 100644
--- a/pkg/front_end/test/lint_suite.dart
+++ b/pkg/front_end/test/lint_suite.dart
@@ -296,7 +296,14 @@
 }
 
 class ImportsTwiceLintListener extends LintListener {
-  Set<Uri> seenImports = new Set<Uri>();
+  Map<Uri, Set<String?>> seenImports = {};
+
+  Token? seenAsKeyword;
+
+  @override
+  void handleImportPrefix(Token? deferredKeyword, Token? asKeyword) {
+    seenAsKeyword = asKeyword;
+  }
 
   @override
   void endImport(Token importKeyword, Token? semicolon) {
@@ -313,9 +320,16 @@
         resolved = description.cache.packages!.resolve(resolved)!;
       }
     }
-    if (!seenImports.add(resolved)) {
-      onProblem(importUriToken.offset, importUriToken.lexeme.length,
-          "Uri '$resolved' already imported once.");
+    String? asName = seenAsKeyword?.lexeme;
+    Set<String?> asNames = seenImports[resolved] ??= {};
+    if (!asNames.add(asName)) {
+      if (asName != null) {
+        onProblem(importUriToken.offset, importUriToken.lexeme.length,
+            "Uri '$resolved' already imported once as '${asName}'.");
+      } else {
+        onProblem(importUriToken.offset, importUriToken.lexeme.length,
+            "Uri '$resolved' already imported once.");
+      }
     }
   }
 }
diff --git a/pkg/front_end/test/lint_test.status b/pkg/front_end/test/lint_test.status
index 9f581ba..c74d14d 100644
--- a/pkg/front_end/test/lint_test.status
+++ b/pkg/front_end/test/lint_test.status
@@ -3,12 +3,7 @@
 # BSD-style license that can be found in the LICENSE.md file.
 
 _fe_analyzer_shared/lib/src/parser/parser/Exports: Fail
-_fe_analyzer_shared/lib/src/scanner/abstract_scanner/ImportsTwice: Fail
 _fe_analyzer_shared/lib/src/scanner/scanner/Exports: Fail
-_fe_analyzer_shared/lib/src/scanner/string_scanner/ImportsTwice: Fail
-_fe_analyzer_shared/lib/src/scanner/token_impl/ImportsTwice: Fail
-_fe_analyzer_shared/lib/src/scanner/utf8_bytes_scanner/ImportsTwice: Fail
-front_end/lib/src/api_prototype/compiler_options/ImportsTwice: Fail
 front_end/lib/src/api_prototype/compiler_options/Exports: Fail
 front_end/lib/src/api_prototype/constant_evaluator/Exports: Fail
 front_end/lib/src/api_prototype/front_end/Exports: Fail
@@ -17,11 +12,7 @@
 front_end/lib/src/api_prototype/lowering_predicates/Exports: Fail
 front_end/lib/src/api_prototype/terminal_color_support/Exports: Fail
 front_end/lib/src/fasta/fasta_codes/Exports: Fail
-front_end/lib/src/fasta/incremental_compiler/ImportsTwice: Fail
-front_end/lib/src/fasta/kernel/body_builder/ImportsTwice: Fail
 front_end/lib/src/fasta/messages/Exports: Fail
-front_end/lib/src/fasta/source/value_kinds/ImportsTwice: Fail
 front_end/lib/src/testing/id_testing_helper/Exports: Fail
 kernel/lib/ast/Exports: Fail
 kernel/lib/kernel/Exports: Fail
-kernel/lib/testing/type_parser_environment/ImportsTwice: Fail
diff --git a/pkg/front_end/test/macro_application/data/pkgs/macro/lib/macro.dart b/pkg/front_end/test/macro_application/data/pkgs/macro/lib/macro.dart
index b686cc0..4979c76 100644
--- a/pkg/front_end/test/macro_application/data/pkgs/macro/lib/macro.dart
+++ b/pkg/front_end/test/macro_application/data/pkgs/macro/lib/macro.dart
@@ -24,12 +24,35 @@
     if (function.positionalParameters.isEmpty) {
       return;
     }
-    StaticType returnType = await builder.resolve(function.returnType);
+    StaticType returnType = await builder.instantiateType(function.returnType);
     StaticType parameterType =
-        await builder.resolve(function.positionalParameters.first.type);
+        await builder.instantiateType(function.positionalParameters.first.type);
     builder.augment(new FunctionBodyCode.fromString('''{
   print('isExactly=${await returnType.isExactly(parameterType)}');
   print('isSubtype=${await returnType.isSubtypeOf(parameterType)}');
 }'''));
   }
 }
+
+
+macro class FunctionTypesMacro1 implements FunctionTypesMacro {
+  const FunctionTypesMacro1();
+
+  FutureOr<void> buildTypesForFunction(
+      FunctionDeclaration function, TypeBuilder builder) {
+    builder.declareType(new DeclarationCode.fromString('''
+class ${function.identifier.name}GeneratedClass {}
+'''));
+  }
+}
+
+macro class FunctionDeclarationsMacro1 implements FunctionDeclarationsMacro {
+  const FunctionDeclarationsMacro1();
+
+  FutureOr<void> buildDeclarationsForFunction(
+      FunctionDeclaration function, DeclarationBuilder builder) {
+    builder.declareInLibrary(new DeclarationCode.fromString('''
+void ${function.identifier.name}GeneratedMethod() {}
+'''));
+  }
+}
diff --git a/pkg/front_end/test/macro_application/data/tests/declarations.dart b/pkg/front_end/test/macro_application/data/tests/declarations.dart
new file mode 100644
index 0000000..a992685
--- /dev/null
+++ b/pkg/front_end/test/macro_application/data/tests/declarations.dart
@@ -0,0 +1,17 @@
+// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:macro/macro.dart';
+
+/*member: topLevelFunction1:
+void topLevelFunction1GeneratedMethod() {}
+*/
+@FunctionDeclarationsMacro1()
+void topLevelFunction1() {}
+
+@FunctionDeclarationsMacro1()
+/*member: topLevelFunction2:
+void topLevelFunction2GeneratedMethod() {}
+*/
+void topLevelFunction2() {}
diff --git a/pkg/front_end/test/macro_application/data/tests/types.dart b/pkg/front_end/test/macro_application/data/tests/types.dart
new file mode 100644
index 0000000..c10a353
--- /dev/null
+++ b/pkg/front_end/test/macro_application/data/tests/types.dart
@@ -0,0 +1,17 @@
+// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:macro/macro.dart';
+
+@FunctionTypesMacro1()
+/*member: topLevelFunction1:
+class topLevelFunction1GeneratedClass {}
+*/
+void topLevelFunction1() {}
+
+@FunctionTypesMacro1()
+/*member: topLevelFunction2:
+class topLevelFunction2GeneratedClass {}
+*/
+void topLevelFunction2() {}
diff --git a/pkg/front_end/test/macro_application/macro_application_test.dart b/pkg/front_end/test/macro_application/macro_application_test.dart
index d24b4ae..0ad035b 100644
--- a/pkg/front_end/test/macro_application/macro_application_test.dart
+++ b/pkg/front_end/test/macro_application/macro_application_test.dart
@@ -29,6 +29,8 @@
   'package:macro/macro.dart': {
     'FunctionDefinitionMacro1': [''],
     'FunctionDefinitionMacro2': [''],
+    'FunctionTypesMacro1': [''],
+    'FunctionDeclarationsMacro1': [''],
   }
 };
 
@@ -110,18 +112,36 @@
         .loader
         .dataForTesting!
         .macroApplicationData;
+    StringBuffer sb = new StringBuffer();
     for (MapEntry<MemberBuilder, List<MacroExecutionResult>> entry
-        in macroApplicationData.memberDefinitionsResults.entries) {
+        in macroApplicationData.memberTypesResults.entries) {
       if (entry.key.member == member) {
-        StringBuffer sb = new StringBuffer();
         for (MacroExecutionResult result in entry.value) {
           sb.write('\n${codeToString(result.augmentations.first)}');
         }
-        Id id = computeMemberId(member);
-        registry.registerValue(
-            member.fileUri, member.fileOffset, id, sb.toString(), member);
       }
     }
+    for (MapEntry<MemberBuilder, List<MacroExecutionResult>> entry
+        in macroApplicationData.memberDeclarationsResults.entries) {
+      if (entry.key.member == member) {
+        for (MacroExecutionResult result in entry.value) {
+          sb.write('\n${codeToString(result.augmentations.first)}');
+        }
+      }
+    }
+    for (MapEntry<MemberBuilder, List<MacroExecutionResult>> entry
+        in macroApplicationData.memberDefinitionsResults.entries) {
+      if (entry.key.member == member) {
+        for (MacroExecutionResult result in entry.value) {
+          sb.write('\n${codeToString(result.augmentations.first)}');
+        }
+      }
+    }
+    if (sb.isNotEmpty) {
+      Id id = computeMemberId(member);
+      registry.registerValue(
+          member.fileUri, member.fileOffset, id, sb.toString(), member);
+    }
   }
 }
 
@@ -129,8 +149,8 @@
   for (Object part in code.parts) {
     if (part is Code) {
       _codeToString(sb, part);
-    } else if (part is TypeAnnotation) {
-      _codeToString(sb, part.code);
+    } else if (part is Identifier) {
+      sb.write(part.name);
     } else {
       sb.write(part);
     }
diff --git a/pkg/front_end/test/macros/macro_test.dart b/pkg/front_end/test/macros/macro_test.dart
index e6ff78d..47c4300 100644
--- a/pkg/front_end/test/macros/macro_test.dart
+++ b/pkg/front_end/test/macros/macro_test.dart
@@ -375,12 +375,10 @@
   void serialize(Serializer serializer) => throw UnimplementedError();
 
   @override
-  bool shouldExecute(DeclarationKind declarationKind, Phase phase) =>
-      throw new UnimplementedError();
+  bool shouldExecute(DeclarationKind declarationKind, Phase phase) => false;
 
   @override
-  bool supportsDeclarationKind(DeclarationKind declarationKind) =>
-      throw new UnimplementedError();
+  bool supportsDeclarationKind(DeclarationKind declarationKind) => false;
 }
 
 class _MacroExecutionResult implements MacroExecutionResult {
diff --git a/pkg/front_end/test/spell_checking_list_code.txt b/pkg/front_end/test/spell_checking_list_code.txt
index 22b6b5a..19431ef 100644
--- a/pkg/front_end/test/spell_checking_list_code.txt
+++ b/pkg/front_end/test/spell_checking_list_code.txt
@@ -54,7 +54,6 @@
 applicable
 arg
 args
-argument1
 arise
 arising
 arity
@@ -87,17 +86,6 @@
 awaiting
 awaits
 b
-b0i
-b0m
-b0n
-b1a
-b1i
-b1m
-b1n
-b23d3b125e9d246e07a2b43b61740759a0dace
-b2i
-b2m
-b2n
 backlog
 backping
 backstop
@@ -126,8 +114,6 @@
 binder
 binders
 binds
-bit1
-bit2
 bj
 bk
 blindly
@@ -202,18 +188,6 @@
 clarification
 clashes
 class's
-class2a
-class2b
-class3a
-class3b
-class3c
-class4a
-class4b
-class4c
-class4d
-class4e
-class6a
-class6b
 clazz
 cli
 client's
@@ -232,7 +206,6 @@
 com
 combinations
 combinator
-combine2
 combiner
 communication
 compared
@@ -294,14 +267,12 @@
 cwd
 cyclically
 d
-d11e
-d7c
+dace
 dag
 dangerous
 dangling
 danrubel
 daringfireball
-dart2native
 dartbug
 dartdoc
 dartfix
@@ -310,8 +281,8 @@
 dashes
 dc
 ddc
+ddfea
 ddk
-dea112b090073317d
 debuggable
 dec
 decl
@@ -323,7 +294,6 @@
 deeply
 def
 defaulting
-definitions
 degrades
 degree
 del
@@ -335,7 +305,6 @@
 demangled
 dep
 deps
-dereferenced
 dereferencing
 deregister
 descent
@@ -395,6 +364,7 @@
 dynamically
 e
 easy
+eb
 ecma
 ecosystem
 ed
@@ -432,7 +402,6 @@
 equation
 equivalences
 erased
-erasure
 es
 establish
 established
@@ -477,12 +446,10 @@
 fff
 ffff
 fffff
+ffffff
+fffffff
 ffffffff
 ffi
-field1
-field1a
-field1b
-field2
 fieldformal
 file's
 filenames
@@ -495,12 +462,6 @@
 fits
 fixnum
 fleshed
-float32
-float32x
-float32x4
-float64
-float64x
-float64x2
 floitsch
 flowed
 flushed
@@ -536,8 +497,6 @@
 getable
 getables
 gets
-getter1a
-getter1b
 getting
 gft
 git
@@ -592,7 +551,6 @@
 human
 i
 i'll
-i2b
 ic
 id
 ideal
@@ -646,12 +604,6 @@
 inst
 instanceof
 instantiator
-int16
-int32
-int32x
-int32x4
-int64
-int8
 integrate
 intends
 intentionally
@@ -672,7 +624,6 @@
 ints
 invariants
 io
-is64
 isolate
 isolated
 isolates
@@ -701,7 +652,6 @@
 k
 kallentu
 kernel's
-kernel2kernel
 kill
 klass
 kmillikin
@@ -788,32 +738,6 @@
 meta
 metadata's
 metadatum
-method10a
-method10b
-method1a
-method1b
-method1c
-method2a
-method2b
-method2c
-method3a
-method3b
-method3c
-method4a
-method4b
-method4c
-method5a
-method5b
-method5c
-method6a
-method6b
-method6c
-method7a
-method7b
-method8a
-method8b
-method9a
-method9b
 mi
 migrated
 migration
@@ -869,9 +793,6 @@
 nt
 nth
 nullabilities
-nullable1
-nullable2
-nullable3
 nullary
 nullification
 nullify
@@ -888,7 +809,6 @@
 occupied
 occurences
 offending
-offs
 ogham
 oked
 op
@@ -896,8 +816,6 @@
 opt
 optimizations
 opting
-option1
-option2
 opts
 ordered
 orders
@@ -920,16 +838,6 @@
 overwriting
 ownership
 p
-p0i
-p0k
-p1
-p1i
-p1k
-p1l
-p2
-p2i
-p2k
-p2q
 par
 parallel
 param
@@ -986,6 +894,7 @@
 precompiled
 preexisted
 preexisting
+prefixing
 premark
 preorder
 prepares
@@ -1037,10 +946,6 @@
 r'\t
 r'\u
 r'\v
-r0i
-r0j
-r1i
-r2i
 ra
 radix
 raises
@@ -1109,6 +1014,7 @@
 relax
 relaxes
 released
+reliably
 relink
 reload
 reloading
@@ -1198,7 +1104,7 @@
 setables
 setaf
 sh
-sha1hash
+sha
 shadowed
 shallow
 shas
@@ -1400,25 +1306,11 @@
 ts
 tty
 tuple
-tuple2
-tuple3
-tuple4
-tuple5
-tuple6
-tuple7
-tuple8
-type1
-type2
 typeref
 u
-u001b
 ufeff
 ui
 uint
-uint16
-uint32
-uint64
-uint8
 umbrella
 un
 unaffected
@@ -1452,14 +1344,12 @@
 uninstantiable
 uninstantiated
 unintentionally
-unions
 uniqueness
 unittest
 universally
 unlinked
 unlower
 unmark
-unmodifiable
 unneeded
 unordered
 unpaired
@@ -1471,14 +1361,12 @@
 unshadowed
 unsortable
 unsound
-unsoundness
 untouched
 unwrapper
 unwraps
 unwritten
 unzip
 upcast
-update2018
 ur
 uri's
 url
@@ -1487,8 +1375,6 @@
 usr
 usual
 usually
-utf16
-utf8
 util
 utils
 v
@@ -1543,7 +1429,6 @@
 wind
 wise
 wiser
-with1
 wn
 worthwhile
 worthy
@@ -1555,30 +1440,6 @@
 wtf
 www
 x
-x0
-x00
-x00003fff
-x0007ffff
-x03ffffff
-x10
-x10ffff
-x180
-x1b
-x1f
-x1ff
-x1fffffff
-x2
-x200
-x202
-x205
-x3
-x3f
-x3fffffff
-x5
-x7
-x7fff
-x90
-x9ddfea08eb
 xb
 xbb
 xbf
diff --git a/pkg/front_end/test/spell_checking_list_messages.txt b/pkg/front_end/test/spell_checking_list_messages.txt
index f38dd3a..3230d25 100644
--- a/pkg/front_end/test/spell_checking_list_messages.txt
+++ b/pkg/front_end/test/spell_checking_list_messages.txt
@@ -31,7 +31,6 @@
 dartbug.com
 dname
 e.g
-enum's
 f
 ffi
 flutter_runner
diff --git a/pkg/front_end/test/spell_checking_list_tests.txt b/pkg/front_end/test/spell_checking_list_tests.txt
index 1da0854..bea0c4d 100644
--- a/pkg/front_end/test/spell_checking_list_tests.txt
+++ b/pkg/front_end/test/spell_checking_list_tests.txt
@@ -9,15 +9,8 @@
 # Comments on a line by itself will be considered a header of the file and
 # automatic tools might move it to the top of the file.
 
-a0x
-a1x
-a2i
-a2x
-a3i
-a4i
 aa
 aaa
-abc
 abcompile
 adapter
 adaptor
@@ -33,12 +26,12 @@
 amended
 amortized
 analyses
+andahalf
 animal
 animated
 annoying
 anon
 aoo
-aot
 applier
 approval
 approximation
@@ -55,9 +48,6 @@
 averaged
 averages
 axis
-b0x
-b1x
-b2x
 ba
 baba
 backed
@@ -65,12 +55,8 @@
 bail
 bailing
 bailout
-bar1a
-bar1b
-bar2a
-bar2b
-bar3a
-bar3b
+bar'baz
+bar\'baz
 barbar
 bash
 bat
@@ -85,12 +71,9 @@
 bkonyi
 bla
 blah
-blindly
-blocked
 blorp
 bold
 boo
-bootstrap
 bots
 boundarykey
 bowtie
@@ -100,56 +83,13 @@
 brave
 brown
 bt
-bt3a
-bt3b
-bt4a
-bt4b
 btw
 builddir
-bulk2
 bulkcompile
 busy
 busywait
 bye
 c's
-c1a
-c1b
-c1c
-c1d
-c1e
-c1f
-c2a
-c2b
-c2c
-c2d
-c2e
-c3a
-c3b
-c3c
-c3d
-c3e
-c3f
-c4a
-c4b
-c4c
-c4d
-c4e
-c4f
-c4g
-c4h
-c59cdee365b94ce066344840f9e3412d642019b
-c5a
-c5b
-c5c
-c5d
-c6a
-c6b
-c6c
-c7a
-c8a
-c8b
-c8c
-c8d
 ca
 cafebabe
 calloc
@@ -160,7 +100,7 @@
 cb
 cc
 ccc
-cell
+cdee
 certificate
 cf
 characteristics
@@ -170,22 +110,6 @@
 chunked
 cipd
 circular
-class1a
-class1b
-class2c
-class2d
-class2e
-class2f
-class3d
-class4int
-class5a
-class5b
-class5c
-class5d
-class7a
-class7b
-class8a
-class8b
 cloneable
 cm
 cmd
@@ -198,14 +122,11 @@
 commented
 commit
 commits
-communication
 companion
 comparative
 comparer
-compilations
 compiler's
 complement
-completers
 complicated
 concurrently
 confidence
@@ -213,33 +134,24 @@
 confirm
 consecutive
 considering
-consist
 constr
 constrains
 consts
 contract
-conversion
 conversions
 coo
 corge
 corners
-costly
 cov
-coverage
 coverages
 cp
 csi
-ct3a
-ct3b
-ct4a
-ct4b
+ct
 ctrl
 cumulative
 cursor
 cuts
 cx
-d1a
-d1b
 da
 dacoharkes
 dadd
@@ -254,7 +166,6 @@
 dartfmt
 darttest
 dash
-dashes
 datatype
 datatypes
 day
@@ -267,8 +178,6 @@
 decrease
 decrements
 dectcem
-deduplication
-defaulting
 defintions
 deleting
 denylist
@@ -277,16 +186,13 @@
 desc
 descending
 descriptors
-detector
 deviation
 dfast
 di
 diagnosticable
 dictionaries
 dictionary
-differences
 differentiate
-differs
 dijkstra
 dijkstras
 dillfile
@@ -294,7 +200,6 @@
 dirname
 disagree
 disagreement
-disallowed
 disconnect
 discovering
 discrepancies
@@ -318,12 +223,9 @@
 dupe
 durations
 dw
-dyn
 e's
-e2e
 ea
 ease
-eb
 ec
 echo
 edits
@@ -333,15 +235,11 @@
 elegantly
 ell
 emethod
-enters
-entrypoint
 entrypoints
 eoo
 epoch
 equally
-equivalences
 erase
-erased
 err
 esc
 estat
@@ -351,72 +249,21 @@
 exceed
 excess
 exe
-execute
 exercised
 exercises
-existence
 exitcode
 exiting
 expanded
 expansive
 explainer
 extern
-f1
-f1a
-f1b
-f1c
-f1d
-f1e
-f1f
-f1g
-f1h
-f1i
-f2
-f2a
-f2b
-f2c
-f2d
-f2e
-f2f
-f2g
-f2h
-f2i
-f3
-f3a
-f3b
-f3c
-f3d
-f3e
-f3f
-f4
-f4a
-f4b
-f4c
-f4d
-f4e
-f4f
-f5a
-f5b
-f6a
-f6b
-f7a
-f8a
-f8b
+f\u
 fac
 faking
 falling
 favors
 fi
 fibonacci
-field1c
-field2a
-field2b
-field2c
-field3a
-field3b
-field3c
-field4a
-field4b
 filesystem
 filler
 filters
@@ -424,38 +271,7 @@
 five
 floor
 fluctuate
-foo"bar"baz
 foo'bar'baz
-foo1
-foo10
-foo12
-foo13
-foo14
-foo15
-foo1a
-foo1b
-foo2
-foo2a
-foo2b
-foo3a
-foo3b
-foo4
-foo4a
-foo4b
-foo5
-foo5a
-foo5b
-foo6
-foo6a
-foo6b
-foo7
-foo7a
-foo7b
-foo8
-foo9
-foo\"bar'baz
-foo\"bar\"baz
-foo\"bar\'baz
 foos
 forbidden
 forces
@@ -474,23 +290,12 @@
 fuzzed
 fuzzing
 fx
-g1a
-g1b
-g1c
-g2a
-g2b
-g2c
-g3a
-g3b
 gallery
 gamma
 gave
 gc
 gcd
 gesture
-getter1c
-getter1d
-getter1e
 gi
 gm
 goo
@@ -501,23 +306,8 @@
 gtgt
 gulp
 gunk
-h1a
-h1b
-h1c
-h2a
-h2b
-h2c
-h3a
-h3b
-h4a
-h4b
-h5a
-h5b
-h6a
-h6b
 hackish
 hardly
-helper2
 hest
 heuristics
 hi
@@ -534,11 +324,7 @@
 hunk
 hurray
 i'm
-i2a
-i3a
-i3b
 ia
-ideal
 identification
 idle
 ikg
@@ -548,58 +334,27 @@
 implementor
 implementors
 imprecision
-in1
-in2
 inclosure
 inconsistencies
-increased
 increasing
 incrementally
 increments
 indents
 ing
-initializer2
 inlinable
 inlineable
-inlines
 insights
-instance2
 instrument
 insufficient
 intdiv
 interactive
 interchangeable
-interested
 internet
 interpolate
 introducer
 inv
-invocation1a
-invocation1b
-invocation2a
-invocation2b
-invocation3a
-invocation3b
-invocation4a
-invocation4b
-invocation5a
-invocation5b
-invocation6a
-invocation6b
-invocation7a
-invocation7b
-invocation7c
-invocation7d
-invocation7e
 ioo
 ish
-isolate
-isolates
-issue41210b
-issue41436c
-issue41496b
-issue41498b
-issue41499b
 it'll
 italic
 iter
@@ -607,7 +362,6 @@
 joo
 jumped
 kernels
-kill
 kitty
 ko
 koo
@@ -615,67 +369,29 @@
 launch
 launching
 law
-layered
-layers
 le
 legs
 lengths
-lib2a
-lib2b
 lightly
 likewise
 lily
 linebreaks
 lints
-linux
 listening
 listing
-literal2
 ln
-local1a
-local1b
-local1c
-local1d
-local1e
-local1f
-local1g
-local1h
-local1i
-local2a
-local2b
-local2c
-local2d
-local2e
-local2f
-local2g
-local2h
-local3a
-local3b
-local3c
-local3d
-local3e
-local3f
-local3g
-local3h
 logd
 logs
 loo
 lookahead
 loopback
 mac
-macro
-macro2a
-macro2b
-macros
 maker
 matters
 mds
 meaningless
 measured
 measurement
-method1d
-metric
-metrics
 mf
 mfs
 micro
@@ -693,8 +409,6 @@
 misspelled
 mistake
 mistakes
-mixin1
-mixin2
 mmethod
 mod
 modelled
@@ -706,17 +420,13 @@
 mx
 mxn
 mysdk
-n1a
-n1b
 naively
 naturally
 negatable
 newworld
-nil
 ninja
 noisy
 nominal
-nominality
 nondefault
 nonexisting
 noo
@@ -742,11 +452,8 @@
 ops
 optimal
 oracle
-out1
-out2
 outbound
 outliers
-outlined
 overhead
 overlay
 overly
@@ -756,6 +463,7 @@
 paint
 parallax
 parameterized
+partfoo
 party
 pause
 paused
@@ -768,14 +476,11 @@
 placement
 planned
 plug
-pointed
 policy
 pooled
 population
 portions
 pp
-precompilation
-precompilations
 preliminary
 prematurely
 press
@@ -786,19 +491,9 @@
 producer
 profile
 profiler
-propagated
-property2a
-property2b
-property4a
-property4b
-property5a
-property5b
-property8a
-property8b
 proportional
 protected
 proved
-provider
 proxy
 pseudocode
 pubspec
@@ -811,38 +506,22 @@
 quot
 quux
 quuz
-qux
-qux1
-qux3x
-qux4x
-r"
-r"\s
-r"k
-r"tools
-rd
-reachability
 reality
-recompile
 recompiles
-recorder
 redir
 redirections
 rediscover
 reducer
 reenable
 referential
-referring
-reflectee
 refusing
 regards
 regenerate
 regressions
 reify
 reject
-reload
 remap
 remaps
-renames
 rendition
 reorder
 reordering
@@ -850,13 +529,9 @@
 repro
 reproduce
 reproduction
-response
-result1
-result2
 resuming
 retaining
 retainingpath
-retains
 rev
 revealed
 risky
@@ -865,7 +540,6 @@
 rows
 runtimes
 rv
-sandboxed
 sanitize
 saves
 scans
@@ -877,19 +551,13 @@
 sdkroot
 sdks
 secondary
-secondtest12part1usage
+secondtest
 segment
 selection
 semifuzz
 sensitive
 series
-serves
 services
-setter1a
-setter1b
-setter1c
-setter1d
-setter1e
 setups
 severe
 sheets
@@ -898,7 +566,6 @@
 shot
 sidebar
 sigint
-signaling
 signalled
 sigwinch
 slashes
@@ -909,7 +576,6 @@
 somehow
 sorter
 spans
-spawn
 spell
 spellcheck
 spelled
@@ -929,7 +595,6 @@
 stay
 std
 stress
-string2
 stringy
 strip
 strongest
@@ -940,42 +605,18 @@
 subfolder
 subtool
 subtools
-subtyping1a
-subtyping1b
-subtyping2a
-subtyping2b
 successes
-suite
 summarization
 summarized
 sup
 supermixin
 supplement
 suspension
-symbolic
-t3a
-t3b
-t4a
-t4b
 t\b\f\u
-t\u0008\f\u
+t\u
 ta
 tails
-talk
 templates
-test10
-test12
-test12part1usage
-test13
-test13andahalf
-test15thing
-test16
-test16toplevel
-test3a
-test3b
-test3partfoo
-test8
-test9
 theoretically
 thereof
 thread
@@ -997,7 +638,6 @@
 trimming
 tripped
 tripping
-trivially
 truncated
 tt
 tta
@@ -1008,7 +648,6 @@
 typeargs
 typeparam
 typeparambounds
-u250c
 ugly
 unassignment
 unawaited
@@ -1029,33 +668,23 @@
 unversioned
 upload
 upward
-usages
-uses8
 uuid
-v1
-v2
 val
-vars
 verbatim
 versioned
 vf
-visitor0
-visitor1
 vp
 vt
 vte
 waited
-waiting
 waits
 walt
-wants
 warmup
 week
 weekly
 wherever
 whiskers
 wins
-wise
 wording
 workflow
 worlds
diff --git a/pkg/front_end/test/spell_checking_utils.dart b/pkg/front_end/test/spell_checking_utils.dart
index 19347ef..072a3f2 100644
--- a/pkg/front_end/test/spell_checking_utils.dart
+++ b/pkg/front_end/test/spell_checking_utils.dart
@@ -188,9 +188,10 @@
   String regExpStringInner = r"\s-=\|\/,";
   if (splitAsCode) {
     // If splitting as code also split by "_", ":", ".", "(", ")", "<", ">",
-    // "[", "]", "{", "}", "@", "&", "#", "?", "%", "`".
+    // "[", "]", "{", "}", "@", "&", "#", "?", "%", "`", '"', and numbers.
     // (As well as doing stuff to camel casing further below).
-    regExpStringInner = "${regExpStringInner}_:\\.\\(\\)<>\\[\\]\{\}@&#\\?%`";
+    regExpStringInner =
+        "${regExpStringInner}_:\\.\\(\\)<>\\[\\]\{\}@&#\\?%`\"0123456789";
   }
   // Match one or more of the characters specified above.
   String regExp = "[$regExpStringInner]+";
diff --git a/pkg/front_end/test/spell_checking_utils_test.dart b/pkg/front_end/test/spell_checking_utils_test.dart
index b91ed891..c4aa4dc 100644
--- a/pkg/front_end/test/spell_checking_utils_test.dart
+++ b/pkg/front_end/test/spell_checking_utils_test.dart
@@ -57,7 +57,7 @@
       ["Platform", "environment", "TERM"], [0, 9, 22]);
 
   expectSplit("DART2JS_PLATFORM", false, ["DART2JS_PLATFORM"], [0]);
-  expectSplit("DART2JS_PLATFORM", true, ["DART2JS", "PLATFORM"], [0, 8]);
+  expectSplit("DART2JS_PLATFORM", true, ["DART", "JS", "PLATFORM"], [0, 5, 8]);
 
   expectSplit("Foo\\n", false, ["Foo\\n"], [0]);
   expectSplit("Foo\\n", true, ["Foo"], [0]);
@@ -80,6 +80,12 @@
   expectSplit("foo%bar", false, ["foo%bar"], [0]);
   expectSplit("foo%bar", true, ["foo", "bar"], [0, 4]);
 
+  expectSplit("foo42bar", false, ["foo42bar"], [0]);
+  expectSplit("foo42bar", true, ["foo", "bar"], [0, 5]);
+
+  expectSplit('foo"bar', false, ['foo"bar'], [0]);
+  expectSplit('foo"bar', true, ["foo", "bar"], [0, 4]);
+
   expectAlternative(
       "explicitley", ["explicitly"], {"foo", "explicitly", "bar"});
   expectAlternative("explicitlqqqqy", null, {"foo", "explicitly", "bar"});
diff --git a/pkg/front_end/testcases/general/ffi_sample.dart.weak.expect b/pkg/front_end/testcases/general/ffi_sample.dart.weak.expect
index 8c513a4..d92782a 100644
--- a/pkg/front_end/testcases/general/ffi_sample.dart.weak.expect
+++ b/pkg/front_end/testcases/general/ffi_sample.dart.weak.expect
@@ -40,7 +40,7 @@
 
 Constructor coverage from constants:
 org-dartlang-testcase:///ffi_sample.dart:
-- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:144:9)
+- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:114:9)
 - _NativeDouble. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:34:9)
 - NativeType. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:12:9)
 - Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
diff --git a/pkg/front_end/testcases/general/ffi_sample.dart.weak.modular.expect b/pkg/front_end/testcases/general/ffi_sample.dart.weak.modular.expect
index 8c513a4..d92782a 100644
--- a/pkg/front_end/testcases/general/ffi_sample.dart.weak.modular.expect
+++ b/pkg/front_end/testcases/general/ffi_sample.dart.weak.modular.expect
@@ -40,7 +40,7 @@
 
 Constructor coverage from constants:
 org-dartlang-testcase:///ffi_sample.dart:
-- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:144:9)
+- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:114:9)
 - _NativeDouble. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:34:9)
 - NativeType. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:12:9)
 - Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
diff --git a/pkg/front_end/testcases/general/ffi_sample.dart.weak.transformed.expect b/pkg/front_end/testcases/general/ffi_sample.dart.weak.transformed.expect
index ae497d5a..0765c4c 100644
--- a/pkg/front_end/testcases/general/ffi_sample.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/general/ffi_sample.dart.weak.transformed.expect
@@ -74,7 +74,7 @@
 
 Constructor coverage from constants:
 org-dartlang-testcase:///ffi_sample.dart:
-- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:144:9)
+- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:114:9)
 - _NativeDouble. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:34:9)
 - NativeType. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:12:9)
 - Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_50_ffi.yaml.world.1.expect b/pkg/front_end/testcases/incremental/no_outline_change_50_ffi.yaml.world.1.expect
index 6c37a20d..cf7f401 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_50_ffi.yaml.world.1.expect
+++ b/pkg/front_end/testcases/incremental/no_outline_change_50_ffi.yaml.world.1.expect
@@ -63,6 +63,7 @@
   ffi::FloatArray,
   ffi::FloatPointer,
   ffi::Handle,
+  ffi::Int,
   ffi::Int16,
   ffi::Int16Array,
   ffi::Int16Pointer,
@@ -76,6 +77,8 @@
   ffi::Int8Array,
   ffi::Int8Pointer,
   ffi::IntPtr,
+  ffi::Long,
+  ffi::LongLong,
   ffi::NativeApi,
   ffi::NativeFunction,
   ffi::NativeFunctionPointer,
@@ -86,6 +89,9 @@
   ffi::Pointer,
   ffi::PointerArray,
   ffi::PointerPointer,
+  ffi::Short,
+  ffi::SignedChar,
+  ffi::Size,
   ffi::Struct,
   ffi::StructArray,
   ffi::StructPointer,
@@ -101,11 +107,18 @@
   ffi::Uint8,
   ffi::Uint8Array,
   ffi::Uint8Pointer,
+  ffi::UintPtr,
   ffi::Union,
   ffi::UnionArray,
   ffi::UnionPointer,
+  ffi::UnsignedChar,
+  ffi::UnsignedInt,
+  ffi::UnsignedLong,
+  ffi::UnsignedLongLong,
+  ffi::UnsignedShort,
   ffi::Unsized,
-  ffi::Void)
+  ffi::Void,
+  ffi::WChar)
 
   export "org-dartlang-test:///lib3.dart";
 
@@ -139,6 +152,7 @@
   ffi::FloatArray,
   ffi::FloatPointer,
   ffi::Handle,
+  ffi::Int,
   ffi::Int16,
   ffi::Int16Array,
   ffi::Int16Pointer,
@@ -152,6 +166,8 @@
   ffi::Int8Array,
   ffi::Int8Pointer,
   ffi::IntPtr,
+  ffi::Long,
+  ffi::LongLong,
   ffi::NativeApi,
   ffi::NativeFunction,
   ffi::NativeFunctionPointer,
@@ -162,6 +178,9 @@
   ffi::Pointer,
   ffi::PointerArray,
   ffi::PointerPointer,
+  ffi::Short,
+  ffi::SignedChar,
+  ffi::Size,
   ffi::Struct,
   ffi::StructArray,
   ffi::StructPointer,
@@ -177,11 +196,18 @@
   ffi::Uint8,
   ffi::Uint8Array,
   ffi::Uint8Pointer,
+  ffi::UintPtr,
   ffi::Union,
   ffi::UnionArray,
   ffi::UnionPointer,
+  ffi::UnsignedChar,
+  ffi::UnsignedInt,
+  ffi::UnsignedLong,
+  ffi::UnsignedLongLong,
+  ffi::UnsignedShort,
   ffi::Unsized,
-  ffi::Void)
+  ffi::Void,
+  ffi::WChar)
 
   export "dart:ffi";
 
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_50_ffi.yaml.world.2.expect b/pkg/front_end/testcases/incremental/no_outline_change_50_ffi.yaml.world.2.expect
index e7c047a..cb6c619 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_50_ffi.yaml.world.2.expect
+++ b/pkg/front_end/testcases/incremental/no_outline_change_50_ffi.yaml.world.2.expect
@@ -63,6 +63,7 @@
   ffi::FloatArray,
   ffi::FloatPointer,
   ffi::Handle,
+  ffi::Int,
   ffi::Int16,
   ffi::Int16Array,
   ffi::Int16Pointer,
@@ -76,6 +77,8 @@
   ffi::Int8Array,
   ffi::Int8Pointer,
   ffi::IntPtr,
+  ffi::Long,
+  ffi::LongLong,
   ffi::NativeApi,
   ffi::NativeFunction,
   ffi::NativeFunctionPointer,
@@ -86,6 +89,9 @@
   ffi::Pointer,
   ffi::PointerArray,
   ffi::PointerPointer,
+  ffi::Short,
+  ffi::SignedChar,
+  ffi::Size,
   ffi::Struct,
   ffi::StructArray,
   ffi::StructPointer,
@@ -101,11 +107,18 @@
   ffi::Uint8,
   ffi::Uint8Array,
   ffi::Uint8Pointer,
+  ffi::UintPtr,
   ffi::Union,
   ffi::UnionArray,
   ffi::UnionPointer,
+  ffi::UnsignedChar,
+  ffi::UnsignedInt,
+  ffi::UnsignedLong,
+  ffi::UnsignedLongLong,
+  ffi::UnsignedShort,
   ffi::Unsized,
-  ffi::Void)
+  ffi::Void,
+  ffi::WChar)
 
   export "org-dartlang-test:///lib3.dart";
 
@@ -139,6 +152,7 @@
   ffi::FloatArray,
   ffi::FloatPointer,
   ffi::Handle,
+  ffi::Int,
   ffi::Int16,
   ffi::Int16Array,
   ffi::Int16Pointer,
@@ -152,6 +166,8 @@
   ffi::Int8Array,
   ffi::Int8Pointer,
   ffi::IntPtr,
+  ffi::Long,
+  ffi::LongLong,
   ffi::NativeApi,
   ffi::NativeFunction,
   ffi::NativeFunctionPointer,
@@ -162,6 +178,9 @@
   ffi::Pointer,
   ffi::PointerArray,
   ffi::PointerPointer,
+  ffi::Short,
+  ffi::SignedChar,
+  ffi::Size,
   ffi::Struct,
   ffi::StructArray,
   ffi::StructPointer,
@@ -177,11 +196,18 @@
   ffi::Uint8,
   ffi::Uint8Array,
   ffi::Uint8Pointer,
+  ffi::UintPtr,
   ffi::Union,
   ffi::UnionArray,
   ffi::UnionPointer,
+  ffi::UnsignedChar,
+  ffi::UnsignedInt,
+  ffi::UnsignedLong,
+  ffi::UnsignedLongLong,
+  ffi::UnsignedShort,
   ffi::Unsized,
-  ffi::Void)
+  ffi::Void,
+  ffi::WChar)
 
   export "dart:ffi";
 
diff --git a/pkg/front_end/testcases/nnbd/ffi_sample.dart.strong.expect b/pkg/front_end/testcases/nnbd/ffi_sample.dart.strong.expect
index 35dda10..b190b3a 100644
--- a/pkg/front_end/testcases/nnbd/ffi_sample.dart.strong.expect
+++ b/pkg/front_end/testcases/nnbd/ffi_sample.dart.strong.expect
@@ -34,7 +34,7 @@
 
 Constructor coverage from constants:
 org-dartlang-testcase:///ffi_sample.dart:
-- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:144:9)
+- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:114:9)
 - _NativeDouble. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:34:9)
 - NativeType. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:12:9)
 - Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
diff --git a/pkg/front_end/testcases/nnbd/ffi_sample.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/ffi_sample.dart.strong.transformed.expect
index 02dfd2a..fccf634 100644
--- a/pkg/front_end/testcases/nnbd/ffi_sample.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/ffi_sample.dart.strong.transformed.expect
@@ -65,7 +65,7 @@
 
 Constructor coverage from constants:
 org-dartlang-testcase:///ffi_sample.dart:
-- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:144:9)
+- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:114:9)
 - _NativeDouble. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:34:9)
 - NativeType. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:12:9)
 - Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
diff --git a/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.expect b/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.expect
index 35dda10..b190b3a 100644
--- a/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.expect
+++ b/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.expect
@@ -34,7 +34,7 @@
 
 Constructor coverage from constants:
 org-dartlang-testcase:///ffi_sample.dart:
-- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:144:9)
+- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:114:9)
 - _NativeDouble. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:34:9)
 - NativeType. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:12:9)
 - Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
diff --git a/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.modular.expect b/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.modular.expect
index 35dda10..b190b3a 100644
--- a/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.modular.expect
+++ b/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.modular.expect
@@ -34,7 +34,7 @@
 
 Constructor coverage from constants:
 org-dartlang-testcase:///ffi_sample.dart:
-- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:144:9)
+- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:114:9)
 - _NativeDouble. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:34:9)
 - NativeType. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:12:9)
 - Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
diff --git a/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.transformed.expect
index 02dfd2a..fccf634 100644
--- a/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.transformed.expect
@@ -65,7 +65,7 @@
 
 Constructor coverage from constants:
 org-dartlang-testcase:///ffi_sample.dart:
-- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:144:9)
+- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:114:9)
 - _NativeDouble. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:34:9)
 - NativeType. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:12:9)
 - Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
diff --git a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.strong.expect b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.strong.expect
index 0db513d..4d771b3 100644
--- a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.strong.expect
+++ b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.strong.expect
@@ -25,5 +25,5 @@
 
 Constructor coverage from constants:
 org-dartlang-testcase:///ffi_struct_inline_array.dart:
-- _ArraySize. (from org-dartlang-sdk:///sdk/lib/ffi/ffi.dart:138:9)
+- _ArraySize. (from org-dartlang-sdk:///sdk/lib/ffi/ffi.dart:139:9)
 - Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
diff --git a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.strong.transformed.expect
index 525cfd9..f3903c0 100644
--- a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.strong.transformed.expect
@@ -52,5 +52,5 @@
 
 Constructor coverage from constants:
 org-dartlang-testcase:///ffi_struct_inline_array.dart:
-- _ArraySize. (from org-dartlang-sdk:///sdk/lib/ffi/ffi.dart:138:9)
+- _ArraySize. (from org-dartlang-sdk:///sdk/lib/ffi/ffi.dart:139:9)
 - Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
diff --git a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.weak.expect b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.weak.expect
index e6c0f95..e179ab5 100644
--- a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.weak.expect
+++ b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.weak.expect
@@ -25,5 +25,5 @@
 
 Constructor coverage from constants:
 org-dartlang-testcase:///ffi_struct_inline_array.dart:
-- _ArraySize. (from org-dartlang-sdk:///sdk/lib/ffi/ffi.dart:138:9)
+- _ArraySize. (from org-dartlang-sdk:///sdk/lib/ffi/ffi.dart:139:9)
 - Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
diff --git a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.weak.modular.expect b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.weak.modular.expect
index e6c0f95..e179ab5 100644
--- a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.weak.modular.expect
+++ b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.weak.modular.expect
@@ -25,5 +25,5 @@
 
 Constructor coverage from constants:
 org-dartlang-testcase:///ffi_struct_inline_array.dart:
-- _ArraySize. (from org-dartlang-sdk:///sdk/lib/ffi/ffi.dart:138:9)
+- _ArraySize. (from org-dartlang-sdk:///sdk/lib/ffi/ffi.dart:139:9)
 - Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
diff --git a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.weak.transformed.expect
index b38ad34..24cfa96 100644
--- a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.weak.transformed.expect
@@ -52,5 +52,5 @@
 
 Constructor coverage from constants:
 org-dartlang-testcase:///ffi_struct_inline_array.dart:
-- _ArraySize. (from org-dartlang-sdk:///sdk/lib/ffi/ffi.dart:138:9)
+- _ArraySize. (from org-dartlang-sdk:///sdk/lib/ffi/ffi.dart:139:9)
 - Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
diff --git a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.strong.expect b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.strong.expect
index 0e058b1..dd7fa30 100644
--- a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.strong.expect
+++ b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.strong.expect
@@ -33,5 +33,5 @@
 
 Constructor coverage from constants:
 org-dartlang-testcase:///ffi_struct_inline_array_multi_dimensional.dart:
-- _ArraySize. (from org-dartlang-sdk:///sdk/lib/ffi/ffi.dart:138:9)
+- _ArraySize. (from org-dartlang-sdk:///sdk/lib/ffi/ffi.dart:139:9)
 - Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
diff --git a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.strong.transformed.expect
index ecf21c0..a16945b 100644
--- a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.strong.transformed.expect
@@ -84,5 +84,5 @@
 
 Constructor coverage from constants:
 org-dartlang-testcase:///ffi_struct_inline_array_multi_dimensional.dart:
-- _ArraySize. (from org-dartlang-sdk:///sdk/lib/ffi/ffi.dart:138:9)
+- _ArraySize. (from org-dartlang-sdk:///sdk/lib/ffi/ffi.dart:139:9)
 - Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
diff --git a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.weak.expect b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.weak.expect
index 5e4b756..be09548 100644
--- a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.weak.expect
+++ b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.weak.expect
@@ -33,5 +33,5 @@
 
 Constructor coverage from constants:
 org-dartlang-testcase:///ffi_struct_inline_array_multi_dimensional.dart:
-- _ArraySize. (from org-dartlang-sdk:///sdk/lib/ffi/ffi.dart:138:9)
+- _ArraySize. (from org-dartlang-sdk:///sdk/lib/ffi/ffi.dart:139:9)
 - Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
diff --git a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.weak.modular.expect b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.weak.modular.expect
index 5e4b756..be09548 100644
--- a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.weak.modular.expect
+++ b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.weak.modular.expect
@@ -33,5 +33,5 @@
 
 Constructor coverage from constants:
 org-dartlang-testcase:///ffi_struct_inline_array_multi_dimensional.dart:
-- _ArraySize. (from org-dartlang-sdk:///sdk/lib/ffi/ffi.dart:138:9)
+- _ArraySize. (from org-dartlang-sdk:///sdk/lib/ffi/ffi.dart:139:9)
 - Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
diff --git a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.weak.transformed.expect
index a9ba39c..a83a86b 100644
--- a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.weak.transformed.expect
@@ -84,5 +84,5 @@
 
 Constructor coverage from constants:
 org-dartlang-testcase:///ffi_struct_inline_array_multi_dimensional.dart:
-- _ArraySize. (from org-dartlang-sdk:///sdk/lib/ffi/ffi.dart:138:9)
+- _ArraySize. (from org-dartlang-sdk:///sdk/lib/ffi/ffi.dart:139:9)
 - Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
diff --git a/pkg/nnbd_migration/lib/src/edge_builder.dart b/pkg/nnbd_migration/lib/src/edge_builder.dart
index 0fc0c32..5ab9d26 100644
--- a/pkg/nnbd_migration/lib/src/edge_builder.dart
+++ b/pkg/nnbd_migration/lib/src/edge_builder.dart
@@ -3174,7 +3174,7 @@
       var argument = node.argumentList.arguments.first;
       if (argument is SimpleIdentifier && _isReferenceInScope(argument)) {
         var argumentType =
-            _variables!.decoratedElementType(argument.staticElement!);
+            getOrComputeElementType(argument, argument.staticElement!);
         _graph.makeNonNullable(
             argumentType.node, QuiverCheckNotNullOrigin(source, argument));
       }
diff --git a/pkg/nnbd_migration/lib/src/node_builder.dart b/pkg/nnbd_migration/lib/src/node_builder.dart
index 2dad8d1..0f1e8f4 100644
--- a/pkg/nnbd_migration/lib/src/node_builder.dart
+++ b/pkg/nnbd_migration/lib/src/node_builder.dart
@@ -476,7 +476,7 @@
         var type = decoratedType.positionalParameters![0];
         _variables!.recordDecoratedElementType(declaredElement.variable, type,
             soft: true);
-        if (_hasAngularChildAnnotation(node.metadata)) {
+        if (_getAngularAnnotation(node.metadata) == _AngularAnnotation.child) {
           _graph.makeNullable(
               type!.node!, AngularAnnotationOrigin(source, node));
         }
@@ -686,9 +686,18 @@
       _variables!.recordDecoratedElementType(declaredElement, type);
       variable.initializer?.accept(this);
       if (parent is FieldDeclaration) {
-        if (_hasAngularChildAnnotation(parent.metadata)) {
-          _graph.makeNullable(
-              type.node!, AngularAnnotationOrigin(source, node));
+        var angularAnnotation = _getAngularAnnotation(parent.metadata);
+        if (angularAnnotation != null) {
+          switch (angularAnnotation) {
+            case _AngularAnnotation.child:
+              _graph.makeNullable(
+                  type.node!, AngularAnnotationOrigin(source, node));
+              break;
+            case _AngularAnnotation.children:
+              _graph.preventLate(
+                  type.node!, AngularAnnotationOrigin(source, node));
+              break;
+          }
         }
       }
     }
@@ -712,6 +721,26 @@
     );
   }
 
+  /// Determines if the given [metadata] contains a reference to one of the
+  /// Angular annotations that we have special behaviors for.  If it does,
+  /// returns an enumerated value describing the type of annotation.
+  _AngularAnnotation? _getAngularAnnotation(NodeList<Annotation> metadata) {
+    for (var annotation in metadata) {
+      var element = annotation.element;
+      if (element is ConstructorElement) {
+        var name = element.enclosingElement.name;
+        if (_isAngularUri(element.librarySource.uri)) {
+          if (name == 'ViewChild' || name == 'ContentChild') {
+            return _AngularAnnotation.child;
+          } else if (name == 'ViewChildren' || name == 'ContentChildren') {
+            return _AngularAnnotation.children;
+          }
+        }
+      }
+    }
+    return null;
+  }
+
   /// Common handling of function and method declarations.
   DecoratedType _handleExecutableDeclaration(
       AstNode node,
@@ -938,23 +967,6 @@
         .recordDecoratedDirectSupertypes(declaredElement, decoratedSupertypes);
   }
 
-  /// Determines if the given [metadata] contains a reference to one of the
-  /// Angular annotations `ViewChild` or `ContentChild`, either of which implies
-  /// nullability of the underlying property.
-  bool _hasAngularChildAnnotation(NodeList<Annotation> metadata) {
-    for (var annotation in metadata) {
-      var element = annotation.element;
-      if (element is ConstructorElement) {
-        var name = element.enclosingElement.name;
-        if ((name == 'ViewChild' || name == 'ContentChild') &&
-            _isAngularUri(element.librarySource.uri)) {
-          return true;
-        }
-      }
-    }
-    return false;
-  }
-
   /// Determines whether the given [uri] comes from the Angular package.
   bool _isAngularUri(Uri uri) {
     if (uri.scheme != 'package') return false;
@@ -993,3 +1005,15 @@
     throw UnimplementedError(buffer.toString());
   }
 }
+
+/// Enum describing the kinds of annotations supplied by the angular package for
+/// which we have special migration behaviors.
+enum _AngularAnnotation {
+  /// Either the `@ViewChild` or `@ContentChild` annotation.  Fields with these
+  /// annotations should always be nullable and should never be late.
+  child,
+
+  /// Either the `@ViewChildren` or `@ContentChildren` annotation.  Fields with
+  /// these annotations should never be late.
+  children,
+}
diff --git a/pkg/nnbd_migration/lib/src/nullability_node.dart b/pkg/nnbd_migration/lib/src/nullability_node.dart
index 8030833..f730d53 100644
--- a/pkg/nnbd_migration/lib/src/nullability_node.dart
+++ b/pkg/nnbd_migration/lib/src/nullability_node.dart
@@ -337,6 +337,12 @@
     _pathsBeingMigrated.add(source.fullName);
   }
 
+  /// Creates a graph edge that will try to prevent the given [node] from being
+  /// marked `late`.
+  void preventLate(NullabilityNode node, EdgeOrigin origin) {
+    connect(node, always, origin);
+  }
+
   /// Determines the nullability of each node in the graph by propagating
   /// nullability information from one node to another.
   PropagationResult propagate() {
diff --git a/pkg/nnbd_migration/test/abstract_context.dart b/pkg/nnbd_migration/test/abstract_context.dart
index 3d5267f..51c7632 100644
--- a/pkg/nnbd_migration/test/abstract_context.dart
+++ b/pkg/nnbd_migration/test/abstract_context.dart
@@ -60,12 +60,18 @@
 class ContentChild {
   const ContentChild(Object selector, {Object? read});
 }
+class ContentChildren {
+  const ContentChildren(Object selector, {Object? read});
+}
 class Optional {
   const Optional();
 }
 class ViewChild {
   const ViewChild(Object selector, {Object? read});
 }
+class ViewChildren {
+  const ViewChildren(Object selector, {Object? read});
+}
 ''');
     if (internalUris) {
       addPackageFile('angular', 'angular.dart', '''
diff --git a/pkg/nnbd_migration/test/api_test.dart b/pkg/nnbd_migration/test/api_test.dart
index a2bbb70..2301e5b 100644
--- a/pkg/nnbd_migration/test/api_test.dart
+++ b/pkg/nnbd_migration/test/api_test.dart
@@ -387,6 +387,88 @@
     await _checkSingleFileChanges(content, expected);
   }
 
+  Future<void> test_angular_contentChild_field_not_late() async {
+    addAngularPackage();
+    var content = '''
+import 'dart:html';
+import 'package:angular/angular.dart';
+
+class MyComponent {
+  @ContentChild('foo')
+  Element bar;
+  Element baz;
+
+  f(Element e) {
+    bar = e;
+    baz = e;
+  }
+  g() => bar.id;
+  h() => baz.id;
+}
+''';
+    // `late` heuristics are disabled for `bar` since it's marked with
+    // `ContentChild`.  But they do apply to `baz`.
+    var expected = '''
+import 'dart:html';
+import 'package:angular/angular.dart';
+
+class MyComponent {
+  @ContentChild('foo')
+  Element? bar;
+  late Element baz;
+
+  f(Element e) {
+    bar = e;
+    baz = e;
+  }
+  g() => bar!.id;
+  h() => baz.id;
+}
+''';
+    await _checkSingleFileChanges(content, expected);
+  }
+
+  Future<void> test_angular_contentChildren_field_not_late() async {
+    addAngularPackage();
+    var content = '''
+import 'dart:html';
+import 'package:angular/angular.dart';
+
+class myComponent {
+  @ContentChildren('foo')
+  Element bar;
+  Element baz;
+
+  f(Element e) {
+    bar = e;
+    baz = e;
+  }
+  g() => bar.id;
+  h() => baz.id;
+}
+''';
+    // `late` heuristics are disabled for `bar` since it's marked with
+    // `ContentChildren`.  But they do apply to `baz`.
+    var expected = '''
+import 'dart:html';
+import 'package:angular/angular.dart';
+
+class myComponent {
+  @ContentChildren('foo')
+  Element? bar;
+  late Element baz;
+
+  f(Element e) {
+    bar = e;
+    baz = e;
+  }
+  g() => bar!.id;
+  h() => baz.id;
+}
+''';
+    await _checkSingleFileChanges(content, expected);
+  }
+
   Future<void> test_angular_optional_constructor_param() async {
     addAngularPackage();
     var content = '''
@@ -508,6 +590,47 @@
     await _checkSingleFileChanges(content, expected);
   }
 
+  Future<void> test_angular_viewChild_field_not_late() async {
+    addAngularPackage();
+    var content = '''
+import 'dart:html';
+import 'package:angular/angular.dart';
+
+class MyComponent {
+  @ViewChild('foo')
+  Element bar;
+  Element baz;
+
+  f(Element e) {
+    bar = e;
+    baz = e;
+  }
+  g() => bar.id;
+  h() => baz.id;
+}
+''';
+    // `late` heuristics are disabled for `bar` since it's marked with
+    // `ViewChild`.  But they do apply to `baz`.
+    var expected = '''
+import 'dart:html';
+import 'package:angular/angular.dart';
+
+class MyComponent {
+  @ViewChild('foo')
+  Element? bar;
+  late Element baz;
+
+  f(Element e) {
+    bar = e;
+    baz = e;
+  }
+  g() => bar!.id;
+  h() => baz.id;
+}
+''';
+    await _checkSingleFileChanges(content, expected);
+  }
+
   Future<void> test_angular_viewChild_setter() async {
     addAngularPackage();
     var content = '''
@@ -531,6 +654,47 @@
     await _checkSingleFileChanges(content, expected);
   }
 
+  Future<void> test_angular_viewChildren_field_not_late() async {
+    addAngularPackage();
+    var content = '''
+import 'dart:html';
+import 'package:angular/angular.dart';
+
+class myComponent {
+  @ViewChildren('foo')
+  Element bar;
+  Element baz;
+
+  f(Element e) {
+    bar = e;
+    baz = e;
+  }
+  g() => bar.id;
+  h() => baz.id;
+}
+''';
+    // `late` heuristics are disabled for `bar` since it's marked with
+    // `ViewChildren`.  But they do apply to `baz`.
+    var expected = '''
+import 'dart:html';
+import 'package:angular/angular.dart';
+
+class myComponent {
+  @ViewChildren('foo')
+  Element? bar;
+  late Element baz;
+
+  f(Element e) {
+    bar = e;
+    baz = e;
+  }
+  g() => bar!.id;
+  h() => baz.id;
+}
+''';
+    await _checkSingleFileChanges(content, expected);
+  }
+
   Future<void> test_argumentError_checkNotNull_implies_non_null_intent() async {
     var content = '''
 void f(int i) {
@@ -7574,6 +7738,47 @@
     await _checkSingleFileChanges(content, expected);
   }
 
+  Future<void> test_quiver_checkNotNull_field_formal_initializer() async {
+    addQuiverPackage();
+    var content = '''
+import 'package:quiver/check.dart';
+class C {
+  final int i;
+  C(this.i) {
+    checkNotNull(i);
+  }
+}
+void f(bool b, int i) {
+  if (b) new C(i);
+}
+main() {
+  f(false, null);
+}
+''';
+    // Note: since the reference to `i` in `checkNotNull(i)` refers to the field
+    // rather than the formal parameter, this isn't considered sufficient to
+    // mark the field as non-nullable (even though that's the clear intention
+    // in this case).  Changing the behavior to match user intent would require
+    // more development work; for now we just want to make sure we provide a
+    // fairly reasonable migration without crashing.
+    var expected = '''
+import 'package:quiver/check.dart';
+class C {
+  final int? i;
+  C(this.i) {
+    checkNotNull(i);
+  }
+}
+void f(bool b, int? i) {
+  if (b) new C(i);
+}
+main() {
+  f(false, null);
+}
+''';
+    await _checkSingleFileChanges(content, expected);
+  }
+
   Future<void> test_quiver_checkNotNull_implies_non_null_intent() async {
     addQuiverPackage();
     var content = '''
diff --git a/pkg/test_runner/lib/src/command.dart b/pkg/test_runner/lib/src/command.dart
index c14af03..45fa5d2 100644
--- a/pkg/test_runner/lib/src/command.dart
+++ b/pkg/test_runner/lib/src/command.dart
@@ -186,12 +186,6 @@
     if (displayName == 'precompiler' || displayName == 'app_jit') {
       return VMCommandOutput(
           this, exitCode, timedOut, stdout, stderr, time, pid);
-    } else if (displayName == 'dart2js') {
-      return Dart2jsCompilerCommandOutput(
-          this, exitCode, timedOut, stdout, stderr, time, compilationSkipped);
-    } else if (displayName == 'dartdevc') {
-      return DevCompilerCommandOutput(this, exitCode, timedOut, stdout, stderr,
-          time, compilationSkipped, pid);
     }
 
     return CompilationCommandOutput(
@@ -263,7 +257,7 @@
       int index = 0})
       : super("dart2js", outputFile, bootstrapDependencies, executable,
             arguments, environmentOverrides,
-            alwaysCompile: alwaysCompile || true,
+            alwaysCompile: alwaysCompile,
             workingDirectory: workingDirectory,
             index: index);
 
@@ -303,6 +297,61 @@
   }
 }
 
+class DevCompilerCompilationCommand extends CompilationCommand {
+  final String compilerPath;
+
+  DevCompilerCompilationCommand(
+      String outputFile,
+      List<Uri> bootstrapDependencies,
+      String executable,
+      List<String> arguments,
+      Map<String, String> environmentOverrides,
+      {this.compilerPath,
+      bool alwaysCompile,
+      String workingDirectory,
+      int index = 0})
+      : super("dartdevc", outputFile, bootstrapDependencies, executable,
+            arguments, environmentOverrides,
+            alwaysCompile: alwaysCompile,
+            workingDirectory: workingDirectory,
+            index: index);
+
+  @override
+  CommandOutput createOutput(int exitCode, bool timedOut, List<int> stdout,
+      List<int> stderr, Duration time, bool compilationSkipped,
+      [int pid = 0]) {
+    return DevCompilerCommandOutput(this, exitCode, timedOut, stdout, stderr,
+        time, compilationSkipped, pid);
+  }
+
+  @override
+  List<String> get batchArguments {
+    return <String>[
+      compilerPath,
+      ...super.batchArguments,
+    ];
+  }
+
+  @override
+  List<String> get nonBatchArguments {
+    return <String>[
+      compilerPath,
+      ...super.nonBatchArguments,
+    ];
+  }
+
+  @override
+  void _buildHashCode(HashCodeBuilder builder) {
+    super._buildHashCode(builder);
+    builder.addJson(compilerPath);
+  }
+
+  @override
+  bool _equal(DevCompilerCompilationCommand other) {
+    return super._equal(other) && compilerPath == other.compilerPath;
+  }
+}
+
 class FastaCompilationCommand extends CompilationCommand {
   final Uri _compilerLocation;
 
diff --git a/pkg/test_runner/lib/src/compiler_configuration.dart b/pkg/test_runner/lib/src/compiler_configuration.dart
index 1ef049d..6d72e22 100644
--- a/pkg/test_runner/lib/src/compiler_configuration.dart
+++ b/pkg/test_runner/lib/src/compiler_configuration.dart
@@ -504,11 +504,14 @@
   DevCompilerConfiguration(TestConfiguration configuration)
       : super._subclass(configuration);
 
-  bool get useKernel => _configuration.compiler == Compiler.dartdevk;
-
   String computeCompilerPath() {
-    var dir = _useSdk ? "${_configuration.buildDirectory}/dart-sdk" : "sdk";
-    return "$dir/bin/dartdevc$shellScriptExtension";
+    // The compiler is a Dart program and not an executable itself, so the
+    // command to spawn as a subprocess is a Dart VM. Internally the
+    // [DevCompilerCompilationCommand] will prepend the snapshot or Dart library
+    // entrypoint that is executed by the VM.
+    // This will change once we update the DDC to use AOT instead of a snapshot.
+    var dir = _useSdk ? '${_configuration.buildDirectory}/dart-sdk' : 'sdk';
+    return '$dir/bin/dart$executableExtension';
   }
 
   List<String> computeCompilerArguments(
@@ -581,11 +584,12 @@
       }
     }
 
-    var inputDir = Path(inputFile).append("..").canonicalize().toNativePath();
-    var displayName = useKernel ? 'dartdevk' : 'dartdevc';
-    return CompilationCommand(displayName, outputFile, bootstrapDependencies(),
+    var compilerPath = _useSdk
+        ? '${_configuration.buildDirectory}/dart-sdk/bin/snapshots/dartdevc.dart.snapshot'
+        : Repository.uri.resolve('pkg/dev_compiler/bin/dartdevc.dart').path;
+    return DevCompilerCompilationCommand(outputFile, bootstrapDependencies(),
         computeCompilerPath(), args, environment,
-        workingDirectory: inputDir);
+        compilerPath: compilerPath);
   }
 
   CommandArtifact computeCompilationArtifact(String tempDir,
diff --git a/runtime/bin/dartdev_isolate.cc b/runtime/bin/dartdev_isolate.cc
index 4b9fe69..93259b0 100644
--- a/runtime/bin/dartdev_isolate.cc
+++ b/runtime/bin/dartdev_isolate.cc
@@ -206,7 +206,7 @@
   Dart_IsolateFlags flags;
   Dart_IsolateFlagsInitialize(&flags);
   flags.enable_asserts = false;
-  flags.null_safety = false;
+  flags.null_safety = true;
   flags.use_field_guards = true;
   flags.use_osr = true;
   flags.is_system_isolate = true;
diff --git a/runtime/bin/ffi_test/ffi_test_functions.cc b/runtime/bin/ffi_test/ffi_test_functions.cc
index dd5e41f..1545f8e 100644
--- a/runtime/bin/ffi_test/ffi_test_functions.cc
+++ b/runtime/bin/ffi_test/ffi_test_functions.cc
@@ -1138,27 +1138,36 @@
 typedef intptr_t ssize_t;
 #endif
 
-#define DEFINE_SIZE_OF(type_modifier, type)                                    \
-  DART_EXPORT uint64_t FfiSizeOf_##type_modifier##_##type() {                  \
-    return sizeof(type_modifier type);                                         \
+#define DEFINE_SIZE_OF_AND_SIGN_OF(type_modifier, type, type2)                 \
+  DART_EXPORT uint64_t FfiSizeOf_##type_modifier##_##type##_##type2() {        \
+    return sizeof(type_modifier type type2);                                   \
+  }                                                                            \
+                                                                               \
+  DART_EXPORT uint64_t FfiSignOf_##type_modifier##_##type##_##type2() {        \
+    return std::numeric_limits<type_modifier type type2>::is_signed;           \
   }
 
-#define SIZES(F)                                                               \
-  F(, intptr_t)                                                                \
-  F(, uintptr_t)                                                               \
-  F(, int)                                                                     \
-  F(unsigned, int)                                                             \
-  F(, long)         /* NOLINT */                                               \
-  F(unsigned, long) /* NOLINT */                                               \
-  F(, wchar_t)                                                                 \
-  F(, size_t)                                                                  \
-  F(, ssize_t)                                                                 \
-  F(, off_t)
+#define TYPES(F)                                                               \
+  F(, char, )             /* NOLINT */                                         \
+  F(signed, char, )       /* NOLINT */                                         \
+  F(unsigned, char, )     /* NOLINT */                                         \
+  F(, short, )            /* NOLINT */                                         \
+  F(unsigned, short, )    /* NOLINT */                                         \
+  F(, int, )              /* NOLINT */                                         \
+  F(unsigned, int, )      /* NOLINT */                                         \
+  F(, long, )             /* NOLINT */                                         \
+  F(unsigned, long, )     /* NOLINT */                                         \
+  F(, long, long)         /* NOLINT */                                         \
+  F(unsigned, long, long) /* NOLINT */                                         \
+  F(, intptr_t, )         /* NOLINT */                                         \
+  F(, uintptr_t, )        /* NOLINT */                                         \
+  F(, size_t, )           /* NOLINT */                                         \
+  F(, wchar_t, )          /* NOLINT */
 
-SIZES(DEFINE_SIZE_OF)
+TYPES(DEFINE_SIZE_OF_AND_SIGN_OF)
 
-#undef DEFINE_SIZE_OF
-#undef SIZES
+#undef DEFINE_SIZE_OF_AND_SIGN_OF
+#undef TYPES
 
 DART_EXPORT int64_t WCharMinValue() {
   return WCHAR_MIN;
diff --git a/runtime/observatory/lib/src/elements/debugger.dart b/runtime/observatory/lib/src/elements/debugger.dart
index c7c4dc5..7f63140 100644
--- a/runtime/observatory/lib/src/elements/debugger.dart
+++ b/runtime/observatory/lib/src/elements/debugger.dart
@@ -2545,7 +2545,7 @@
     if (_expanded) {
       final homeMethod = _frame.function!.homeMethod;
       String? homeMethodName;
-      if ((homeMethod.dartOwner is S.Class) && homeMethod.isStatic!) {
+      if ((homeMethod.dartOwner is S.Class) && homeMethod.isStatic == true) {
         homeMethodName = '<class>';
       } else if (homeMethod.dartOwner is S.Library) {
         homeMethodName = '<library>';
diff --git a/runtime/observatory/lib/src/service/object.dart b/runtime/observatory/lib/src/service/object.dart
index f449b78..a3e51a4 100644
--- a/runtime/observatory/lib/src/service/object.dart
+++ b/runtime/observatory/lib/src/service/object.dart
@@ -3098,7 +3098,11 @@
     } else {
       var localVariables = <ContextElement>[];
       for (var element in map['variables']) {
-        localVariables.add(new ContextElement(element));
+        try {
+          localVariables.add(new ContextElement(element));
+        } catch (e) {
+          // Swallowing '$e' to still show stuff...
+        }
       }
       variables = localVariables;
     }
diff --git a/runtime/tests/vm/dart/hash_map_probes_limit_test.dart b/runtime/tests/vm/dart/hash_map_probes_limit_test.dart
new file mode 100644
index 0000000..d1ab065
--- /dev/null
+++ b/runtime/tests/vm/dart/hash_map_probes_limit_test.dart
@@ -0,0 +1,14 @@
+// Copyright (c) 2022, 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.
+
+// This test verifies that a relatively large program (kernel compiler)
+// can be compiled with --hash_map_probes_limit.
+
+// VMOptions=--hash_map_probes_limit=1000
+
+import "package:vm/kernel_front_end.dart";
+
+main(List<String> args) async {
+  await runCompiler(createCompilerArgParser().parse(['--help']), '');
+}
diff --git a/runtime/tests/vm/dart/regress_48196_test.dart b/runtime/tests/vm/dart/regress_48196_test.dart
new file mode 100644
index 0000000..4330ef9
--- /dev/null
+++ b/runtime/tests/vm/dart/regress_48196_test.dart
@@ -0,0 +1,44 @@
+// Copyright (c) 2022, 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.
+
+// Regression test for https://github.com/dart-lang/sdk/issues/48196.
+// Verifies that compiler doesn't crash on unreachable code with conflicting
+// types in Unbox instruction.
+
+// Reduced from
+// The Dart Project Fuzz Tester (1.93).
+// Program generated as:
+//   dart dartfuzz.dart --seed 2879764895 --no-fp --no-ffi --flat
+
+// VMOptions=--deterministic --intrinsify=false --use-slow-path
+
+import 'dart:typed_data';
+
+Uint8List var8 = Uint8List.fromList(Uint16List.fromList(new Int8List(31)));
+String var82 = 'Ub#H-k';
+
+foo2() {
+  return Int32x4List(29).sublist(0, 1).sublist(-1, -59);
+}
+
+foo0_Extension0() {
+  Uri.encodeComponent(var82);
+}
+
+MapEntry<String, bool> foo1_Extension0() {
+  for (int loc2 in (Int8List.fromList(var8))) {}
+  return foo1_Extension0();
+}
+
+main() {
+  try {
+    foo2();
+  } catch (e, st) {}
+  try {
+    foo0_Extension0();
+  } catch (e, st) {}
+  try {
+    foo1_Extension0();
+  } catch (e, st) {}
+}
diff --git a/runtime/tests/vm/dart_2/hash_map_probes_limit_test.dart b/runtime/tests/vm/dart_2/hash_map_probes_limit_test.dart
new file mode 100644
index 0000000..09ff68b
--- /dev/null
+++ b/runtime/tests/vm/dart_2/hash_map_probes_limit_test.dart
@@ -0,0 +1,16 @@
+// Copyright (c) 2022, 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.
+
+// This test verifies that a relatively large program (kernel compiler)
+// can be compiled with --hash_map_probes_limit.
+
+// VMOptions=--hash_map_probes_limit=1000
+
+// @dart = 2.9
+
+import "package:vm/kernel_front_end.dart";
+
+main(List<String> args) async {
+  await runCompiler(createCompilerArgParser().parse(['--help']), '');
+}
diff --git a/runtime/tests/vm/dart_2/regress_48196_test.dart b/runtime/tests/vm/dart_2/regress_48196_test.dart
new file mode 100644
index 0000000..4330ef9
--- /dev/null
+++ b/runtime/tests/vm/dart_2/regress_48196_test.dart
@@ -0,0 +1,44 @@
+// Copyright (c) 2022, 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.
+
+// Regression test for https://github.com/dart-lang/sdk/issues/48196.
+// Verifies that compiler doesn't crash on unreachable code with conflicting
+// types in Unbox instruction.
+
+// Reduced from
+// The Dart Project Fuzz Tester (1.93).
+// Program generated as:
+//   dart dartfuzz.dart --seed 2879764895 --no-fp --no-ffi --flat
+
+// VMOptions=--deterministic --intrinsify=false --use-slow-path
+
+import 'dart:typed_data';
+
+Uint8List var8 = Uint8List.fromList(Uint16List.fromList(new Int8List(31)));
+String var82 = 'Ub#H-k';
+
+foo2() {
+  return Int32x4List(29).sublist(0, 1).sublist(-1, -59);
+}
+
+foo0_Extension0() {
+  Uri.encodeComponent(var82);
+}
+
+MapEntry<String, bool> foo1_Extension0() {
+  for (int loc2 in (Int8List.fromList(var8))) {}
+  return foo1_Extension0();
+}
+
+main() {
+  try {
+    foo2();
+  } catch (e, st) {}
+  try {
+    foo0_Extension0();
+  } catch (e, st) {}
+  try {
+    foo1_Extension0();
+  } catch (e, st) {}
+}
diff --git a/runtime/tests/vm/vm.status b/runtime/tests/vm/vm.status
index 98ecdc0..fdb96d1 100644
--- a/runtime/tests/vm/vm.status
+++ b/runtime/tests/vm/vm.status
@@ -15,6 +15,7 @@
 dart/byte_array_optimized_test: Pass, Slow
 dart/data_uri_import_test/none: SkipByDesign
 dart/emit_aot_size_info_flag_test: Pass, Slow # Spawns several subprocesses
+dart/hash_map_probes_limit_test: Pass, Slow # Test includes large program compilation.
 dart/isolates/*: Pass, Slow # Tests use many isolates and take a longer time.
 dart/isolates/concurrency_stress_sanity_test: Pass, Slow # Spawns subprocesses
 dart/isolates/fast_object_copy_test: Pass, Slow # Slow due to doing a lot of transitive object copies.
@@ -28,6 +29,7 @@
 dart_2/byte_array_optimized_test: Pass, Slow
 dart_2/data_uri_import_test/none: SkipByDesign
 dart_2/emit_aot_size_info_flag_test: Pass, Slow # Spawns several subprocesses
+dart_2/hash_map_probes_limit_test: Pass, Slow # Test includes large program compilation.
 dart_2/isolates/*: Pass, Slow # Tests use many isolates and take a longer time.
 dart_2/isolates/concurrency_stress_sanity_test: Pass, Slow # Spawns subprocesses
 dart_2/isolates/fast_object_copy_test: Pass, Slow # Slow due to doing a lot of transitive object copies.
@@ -64,12 +66,14 @@
 
 [ $builder_tag == tsan ]
 dart/appjit_cha_deopt_test: SkipSlow
+dart/hash_map_probes_limit_test: SkipSlow # Test includes large program compilation.
 dart/regress_40462_test: SkipSlow
 dart/regress_40753_test: Skip # This test crashes on the bot, but not locally, and infrastructure repeatly fails to locate its coredump.
 dart/trigger_gc_in_native_test: Skip # This test crashes on the bot, but not locally, and infrastructure repeatly fails to locate its coredump.
 dart/use_strip_flag_test: Pass, Slow # This test can take a longer time to complete.
 dart/v8_snapshot_profile_writer_test: SkipSlow
 dart_2/appjit_cha_deopt_test: SkipSlow
+dart_2/hash_map_probes_limit_test: SkipSlow # Test includes large program compilation.
 dart_2/regress_40462_test: SkipSlow
 dart_2/regress_40753_test: Skip # This test crashes on the bot, but not locally, and infrastructure repeatly fails to locate its coredump.
 dart_2/trigger_gc_in_native_test: Skip # This test crashes on the bot, but not locally, and infrastructure repeatly fails to locate its coredump.
@@ -127,12 +131,14 @@
 cc/VerifyImplicit_Crash: Crash # Negative tests of VerifiedMemory should crash iff in DEBUG mode. TODO(koda): Improve support for negative tests.
 dart/appjit_cha_deopt_test: Pass, Slow # Quite slow in debug mode, uses --optimization-counter-threshold=100
 dart/b162922506_test: SkipSlow # Generates very large input file
+dart/hash_map_probes_limit_test: SkipSlow # Test includes large program compilation.
 dart/minimal_kernel_test: SkipSlow # gen_kernel is too slow in debug mode
 dart/null_safety_autodetection_in_kernel_compiler_test: SkipSlow # gen_kernel is too slow in debug mode
 dart/spawn_shutdown_test: Pass, Slow # VM Shutdown test, It can take some time for all the isolates to shutdown in a Debug build.
 dart/type_casts_with_null_safety_autodetection_test: Pass, Slow # Very slow in debug mode, uses --optimization-counter-threshold=10
 dart_2/appjit_cha_deopt_test: Pass, Slow # Quite slow in debug mode, uses --optimization-counter-threshold=100
 dart_2/b162922506_test: SkipSlow # Generates very large input file
+dart_2/hash_map_probes_limit_test: SkipSlow # Test includes large program compilation.
 dart_2/minimal_kernel_test: SkipSlow # gen_kernel is too slow in debug mode
 dart_2/null_safety_autodetection_in_kernel_compiler_test: SkipSlow # gen_kernel is too slow in debug mode
 dart_2/spawn_shutdown_test: Pass, Slow # VM Shutdown test, It can take some time for all the isolates to shutdown in a Debug build.
diff --git a/runtime/vm/compiler/aot/precompiler.cc b/runtime/vm/compiler/aot/precompiler.cc
index 0a66815..756c8b1 100644
--- a/runtime/vm/compiler/aot/precompiler.cc
+++ b/runtime/vm/compiler/aot/precompiler.cc
@@ -87,7 +87,6 @@
 DECLARE_FLAG(bool, trace_compiler);
 DECLARE_FLAG(bool, trace_optimizing_compiler);
 DECLARE_FLAG(bool, trace_bailout);
-DECLARE_FLAG(bool, huge_method_cutoff_in_code_size);
 DECLARE_FLAG(bool, trace_failed_optimization_attempts);
 DECLARE_FLAG(bool, trace_inlining_intervals);
 DECLARE_FLAG(int, inlining_hotness);
@@ -872,6 +871,17 @@
               function.token_pos().ToCString(),
               Function::KindToCString(function.kind()));
   }
+  if (function.SourceSize() >= FLAG_huge_method_cutoff_in_tokens) {
+    THR_Print(
+        "Warning: %s from %s is too large. Some optimizations have been "
+        "disabled, and the compiler might run out of memory. "
+        "Consider refactoring this code into smaller components.\n",
+        function.QualifiedUserVisibleNameCString(),
+        String::Handle(
+            Z, Library::Handle(Z, Class::Handle(Z, function.Owner()).library())
+                   .url())
+            .ToCString());
+  }
 
   ASSERT(!function.is_abstract());
 
diff --git a/runtime/vm/compiler/aot/precompiler.h b/runtime/vm/compiler/aot/precompiler.h
index 4be44f3..ba2aee7 100644
--- a/runtime/vm/compiler/aot/precompiler.h
+++ b/runtime/vm/compiler/aot/precompiler.h
@@ -119,7 +119,9 @@
 
   static Value ValueOf(Pair kv) { return kv; }
 
-  static inline uword Hash(Key key) { return key->token_pos().Hash(); }
+  static inline uword Hash(Key key) {
+    return Utils::WordHash(CombineHashes(key->id(), key->token_pos().Hash()));
+  }
 
   static inline bool IsKeyEqual(Pair pair, Key key) {
     return pair->ptr() == key->ptr();
diff --git a/runtime/vm/compiler/backend/il.cc b/runtime/vm/compiler/backend/il.cc
index df288f5..0a52e22 100644
--- a/runtime/vm/compiler/backend/il.cc
+++ b/runtime/vm/compiler/backend/il.cc
@@ -5729,10 +5729,9 @@
       EmitLoadInt32FromBoxOrSmi(compiler);
     } else if (representation() == kUnboxedInt64 && value()->Type()->IsInt()) {
       EmitLoadInt64FromBoxOrSmi(compiler);
-    } else if (value_cid == box_cid) {
+    } else if ((value_cid == box_cid) || !CanDeoptimize()) {
       EmitLoadFromBox(compiler);
     } else {
-      ASSERT(CanDeoptimize());
       EmitLoadFromBoxWithDeopt(compiler);
     }
   }
diff --git a/runtime/vm/compiler/backend/il_x64.cc b/runtime/vm/compiler/backend/il_x64.cc
index 3066d10..c966f53 100644
--- a/runtime/vm/compiler/backend/il_x64.cc
+++ b/runtime/vm/compiler/backend/il_x64.cc
@@ -4204,9 +4204,13 @@
   compiler::Label done;
 #if !defined(DART_COMPRESSED_POINTERS)
   ASSERT(value == result);
+  // Optimistically untag value.
   __ SmiUntag(value);
   __ j(NOT_CARRY, &done, compiler::Assembler::kNearJump);
-  __ movsxd(result, compiler::Address(value, TIMES_2, Mint::value_offset()));
+  // Undo untagging by multiplying value by 2.
+  // [reg + reg + disp8] has a shorter encoding than [reg*2 + disp32]
+  __ movsxd(result,
+            compiler::Address(value, value, TIMES_1, Mint::value_offset()));
 #else
   ASSERT(value != result);
   // Cannot speculatively untag with value == result because it erases the
@@ -4224,9 +4228,13 @@
   compiler::Label done;
 #if !defined(DART_COMPRESSED_POINTERS)
   ASSERT(value == result);
+  // Optimistically untag value.
   __ SmiUntag(value);
   __ j(NOT_CARRY, &done, compiler::Assembler::kNearJump);
-  __ movq(result, compiler::Address(value, TIMES_2, Mint::value_offset()));
+  // Undo untagging by multiplying value by 2.
+  // [reg + reg + disp8] has a shorter encoding than [reg*2 + disp32]
+  __ movq(result,
+          compiler::Address(value, value, TIMES_1, Mint::value_offset()));
 #else
   ASSERT(value != result);
   // Cannot speculatively untag with value == result because it erases the
@@ -4272,9 +4280,13 @@
     ASSERT(is_truncating());
     compiler::Label done;
 #if !defined(DART_COMPRESSED_POINTERS)
+    // Optimistically untag value.
     __ SmiUntag(value);
     __ j(NOT_CARRY, &done, compiler::Assembler::kNearJump);
-    __ movq(value, compiler::Address(value, TIMES_2, Mint::value_offset()));
+    // Undo untagging by multiplying value by 2.
+    // [reg + reg + disp8] has a shorter encoding than [reg*2 + disp32]
+    __ movq(value,
+            compiler::Address(value, value, TIMES_1, Mint::value_offset()));
 #else
     // Cannot speculatively untag because it erases the upper bits needed to
     // dereference when it is a Mint.
@@ -4293,8 +4305,10 @@
     // Optimistically untag value.
     __ SmiUntagOrCheckClass(value, kMintCid, &done);
     __ j(NOT_EQUAL, deopt);
-    // Undo untagging by multiplying value with 2.
-    __ movq(value, compiler::Address(value, TIMES_2, Mint::value_offset()));
+    // Undo untagging by multiplying value by 2.
+    // [reg + reg + disp8] has a shorter encoding than [reg*2 + disp32]
+    __ movq(value,
+            compiler::Address(value, value, TIMES_1, Mint::value_offset()));
 #else
     // Cannot speculatively untag because it erases the upper bits needed to
     // dereference when it is a Mint.
diff --git a/runtime/vm/compiler/jit/compiler.cc b/runtime/vm/compiler/jit/compiler.cc
index 150980e..5dacd56 100644
--- a/runtime/vm/compiler/jit/compiler.cc
+++ b/runtime/vm/compiler/jit/compiler.cc
@@ -83,7 +83,6 @@
             "Trace only optimizing compiler operations.");
 DEFINE_FLAG(bool, trace_bailout, false, "Print bailout from ssa compiler.");
 
-DECLARE_FLAG(bool, huge_method_cutoff_in_code_size);
 DECLARE_FLAG(bool, trace_failed_optimization_attempts);
 
 static void PrecompilationModeHandler(bool value) {
diff --git a/runtime/vm/heap/pages.cc b/runtime/vm/heap/pages.cc
index 440bcd0..48fbd5f 100644
--- a/runtime/vm/heap/pages.cc
+++ b/runtime/vm/heap/pages.cc
@@ -263,6 +263,7 @@
 PageSpace::~PageSpace() {
   {
     MonitorLocker ml(tasks_lock());
+    AssistTasks(&ml);
     while (tasks() > 0) {
       ml.Wait();
     }
@@ -1048,6 +1049,12 @@
     marker_->AssistConcurrentMark();
     ml->Enter();
   }
+  if ((phase() == kSweepingLarge) || (phase() == kSweepingRegular)) {
+    ml->Exit();
+    Sweep(/*exclusive*/ false);
+    SweepLarge();
+    ml->Enter();
+  }
 }
 
 void PageSpace::TryReleaseReservation() {
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 3554f67..d3cb9c6 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -7118,9 +7118,12 @@
 }
 
 uword Function::Hash() const {
-  const uword hash = String::HashRawSymbol(name());
+  uword hash = String::HashRawSymbol(name());
+  if (IsClosureFunction()) {
+    hash = hash ^ token_pos().Hash();
+  }
   if (untag()->owner()->IsClass()) {
-    return hash ^ Class::RawCast(untag()->owner())->untag()->id();
+    hash = hash ^ Class::RawCast(untag()->owner())->untag()->id();
   }
   return hash;
 }
diff --git a/runtime/vm/program_visitor.cc b/runtime/vm/program_visitor.cc
index feba7b0..d813ce9 100644
--- a/runtime/vm/program_visitor.cc
+++ b/runtime/vm/program_visitor.cc
@@ -1189,7 +1189,10 @@
   static Value ValueOf(Pair kv) { return kv; }
 
   static inline uword Hash(Key key) {
-    return Utils::WordHash(Instructions::Hash(key->instructions()));
+    ASSERT(Thread::Current()->no_safepoint_scope_depth() > 0);
+    return Utils::WordHash(
+        CombineHashes(Instructions::Hash(key->instructions()),
+                      static_cast<uword>(key->static_calls_target_table())));
   }
 
   static inline bool IsKeyEqual(Pair pair, Key key) {
@@ -1397,6 +1400,9 @@
 
   if (FLAG_precompiled_mode) {
     StackZone stack_zone(thread);
+    // CodeKeyValueTrait::Hash is based on object addresses, so make
+    // sure GC doesn't happen and doesn't move objects.
+    NoSafepointScope no_safepoint;
     DedupInstructionsWithSameMetadataVisitor visitor(thread->zone());
     WalkProgram(thread->zone(), thread->isolate_group(), &visitor);
     visitor.PostProcess(thread->isolate_group());
diff --git a/runtime/vm/thread.h b/runtime/vm/thread.h
index aa38703..8c352db 100644
--- a/runtime/vm/thread.h
+++ b/runtime/vm/thread.h
@@ -914,8 +914,12 @@
     return UnwindErrorInProgressField::decode(safepoint_state_);
   }
   void SetUnwindErrorInProgress(bool value) {
-    safepoint_state_ =
-        UnwindErrorInProgressField::update(value, safepoint_state_);
+    const uword mask = UnwindErrorInProgressField::mask_in_place();
+    if (value) {
+      safepoint_state_.fetch_or(mask);
+    } else {
+      safepoint_state_.fetch_and(~mask);
+    }
   }
 
   uword safepoint_state() { return safepoint_state_; }
diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn
index 2b4fa76..867dd32 100644
--- a/sdk/BUILD.gn
+++ b/sdk/BUILD.gn
@@ -35,7 +35,6 @@
 # ......dart or dart.exe (executable)
 # ......dart.lib (import library for VM native extensions on Windows)
 # ......dartaotruntime or dartaotruntime.exe (executable)
-# ......dartdoc
 # ......dart2js
 # ......dartanalyzer
 # ......dartdevc
@@ -48,7 +47,6 @@
 # ........dartdev.dart.snapshot
 # ........dartdev.dill
 # ........dartdevc.dart.snapshot
-# ........dartdoc.dart.snapshot
 # ........dds.dart.snapshot
 # ........frontend_server.dart.snapshot
 # ........gen_kernel.dart.snapshot (if not on ia32)
@@ -102,9 +100,6 @@
   "pub",
 ]
 
-# Scripts not ending in _sdk that go under bin/
-_scripts = [ "dartdoc" ]
-
 # Snapshots that go under bin/snapshots
 _platform_sdk_snapshots = [
   [
@@ -120,10 +115,6 @@
     "../utils/dartdev:dartdev",
   ],
   [
-    "dartdoc",
-    "../utils/dartdoc",
-  ],
-  [
     "dds",
     "../utils/dds:dds",
   ],
@@ -381,21 +372,6 @@
   }
 }
 
-foreach(script, _scripts) {
-  copy("copy_${script}_script") {
-    visibility = [
-      ":copy_full_sdk_scripts",
-      ":copy_platform_sdk_scripts",
-    ]
-    ext = ""
-    if (is_win) {
-      ext = ".bat"
-    }
-    sources = [ "bin/$script$ext" ]
-    outputs = [ "$root_out_dir/$dart_sdk_output/bin/{{source_file_part}}" ]
-  }
-}
-
 # This is the main target for copying scripts in _platform_sdk_scripts to bin/
 group("copy_platform_sdk_scripts") {
   visibility = [ ":_create_platform_sdk" ]
@@ -403,9 +379,6 @@
   foreach(sdk_script, _platform_sdk_scripts) {
     public_deps += [ ":copy_${sdk_script}_script" ]
   }
-  foreach(script, _scripts) {
-    public_deps += [ ":copy_${script}_script" ]
-  }
 }
 
 # This is the main target for copying scripts in _full_sdk_scripts to bin/
@@ -415,9 +388,6 @@
   foreach(sdk_script, _full_sdk_scripts) {
     public_deps += [ ":copy_${sdk_script}_script" ]
   }
-  foreach(script, _scripts) {
-    public_deps += [ ":copy_${script}_script" ]
-  }
 }
 
 # This loop generates "copy" targets that put snapshots into bin/snapshots
@@ -461,10 +431,6 @@
   }
 }
 
-# This rule writes the .packages file for dartdoc resources.
-write_file("$root_out_dir/$dart_sdk_output/bin/resources/dartdoc/.packages",
-           "dartdoc:.")
-
 # This is the main rule for copying the files that dartdoc needs.
 group("copy_dartdoc_files") {
   visibility = [ ":create_common_sdk" ]
diff --git a/sdk/bin/dartdevc b/sdk/bin/dartdevc
deleted file mode 100755
index c2c25d9..0000000
--- a/sdk/bin/dartdevc
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/env bash
-# Copyright (c) 2013, 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.
-
-# Run dev compiler on the Dart VM. This script assumes the Dart repo's
-# directory structure.
-
-function follow_links() {
-  file="$1"
-  while [ -h "$file" ]; do
-    # On Mac OS, readlink -f doesn't work.
-    file="$(readlink "$file")"
-  done
-  echo "$file"
-}
-
-# Unlike $0, $BASH_SOURCE points to the absolute path of this file.
-PROG_NAME="$(follow_links "$BASH_SOURCE")"
-
-# Handle the case where dart-sdk/bin has been symlinked to.
-BIN_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)"
-SDK_DIR="$(cd "${BIN_DIR}/.." ; pwd -P)"
-
-SDK_ARG="--dart-sdk=$SDK_DIR"
-
-DART="$BIN_DIR/dart"
-
-unset EXTRA_VM_OPTIONS
-declare -a EXTRA_VM_OPTIONS
-
-case $0 in
-  *_developer)
-    EXTRA_VM_OPTIONS+=('--checked')
-    ;;
-esac
-
-# We allow extra vm options to be passed in through an environment variable.
-if [[ $DART_VM_OPTIONS ]]; then
-  read -a OPTIONS <<< "$DART_VM_OPTIONS"
-  EXTRA_VM_OPTIONS+=("${OPTIONS[@]}")
-fi
-
-DART_ROOT="$(cd "${SDK_DIR}/.." ; pwd -P)"
-
-DEV_COMPILER="$DART_ROOT/pkg/dev_compiler/bin/dartdevc.dart"
-
-exec "$DART" "--packages=$DART_ROOT/.packages" --enable_experiment=non-nullable "${EXTRA_VM_OPTIONS[@]}" "$DEV_COMPILER" "$SDK_ARG" "$@"
diff --git a/sdk/bin/dartdevc.bat b/sdk/bin/dartdevc.bat
deleted file mode 100644
index 6091a3a..0000000
--- a/sdk/bin/dartdevc.bat
+++ /dev/null
@@ -1,66 +0,0 @@
-@echo off
-REM Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS file
-REM for details. All rights reserved. Use of this source code is governed by a
-REM BSD-style license that can be found in the LICENSE file.
-
-setlocal
-rem Handle the case where dart-sdk/bin has been symlinked to.
-set DIR_NAME_WITH_SLASH=%~dp0
-set DIR_NAME=%DIR_NAME_WITH_SLASH:~0,-1%%
-call :follow_links "%DIR_NAME%", RETURNED_BIN_DIR
-rem Get rid of surrounding quotes.
-for %%i in ("%RETURNED_BIN_DIR%") do set BIN_DIR=%%~fi
-
-set DART=%BIN_DIR%\dart
-
-rem Get absolute full name for SDK_DIR.
-for %%i in ("%BIN_DIR%\..\") do set SDK_DIR=%%~fi
-
-rem Remove trailing backslash if there is one
-if %SDK_DIR:~-1%==\ set SDK_DIR=%SDK_DIR:~0,-1%
-
-set SDK_ARG=--dart-sdk=%SDK_DIR%
-
-set EXTRA_VM_OPTIONS=
-
-rem We allow extra vm options to be passed in through an environment variable.
-if not "_%DART_VM_OPTIONS%_" == "__" (
-  set EXTRA_VM_OPTIONS=%EXTRA_VM_OPTIONS% %DART_VM_OPTIONS%
-)
-
-rem Get absolute full name for DART_ROOT.
-for %%i in ("%SDK_DIR%\..\") do set DART_ROOT=%%~fi
-
-rem Remove trailing backslash if there is one
-if %DART_ROOT:~-1%==\ set DART_ROOT=%DART_ROOT:~0,-1%
-
-set DEV_COMPILER=%DART_ROOT%\third_party\pkg\dev_compiler\bin\dartdevc.dart
-
-"%DART%" "--packages=%DART_ROOT%\.packages" %EXTRA_VM_OPTIONS% "DEV_COMPILER%" "%SDK_ARG%" %*
-
-endlocal
-
-exit /b %errorlevel%
-
-rem Follow the symbolic links (junctions points) using `dir to determine the
-rem canonical path. Output with a link looks something like this
-rem
-rem 01/03/2013  10:11 PM    <JUNCTION>     abc def
-rem [c:\dart_bleeding\dart-repo.9\dart\out\ReleaseIA32\dart-sdk]
-rem
-rem So in the output of 'dir /a:l "targetdir"' we are looking for a filename
-rem surrounded by right angle bracket and left square bracket. Once we get
-rem the filename, which is name of the link, we recursively follow that.
-:follow_links
-setlocal
-for %%i in (%1) do set result=%%~fi
-set current=
-for /f "usebackq tokens=2 delims=[]" %%i in (`dir /a:l "%~dp1" 2^>nul ^
-                                             ^| %SystemRoot%\System32\find.exe ">     %~n1 [" 2^>nul`) do (
-  set current=%%i
-)
-if not "%current%"=="" call :follow_links "%current%", result
-endlocal & set %~2=%result%
-goto :eof
-
-:end
diff --git a/sdk/bin/dartdevc_sdk b/sdk/bin/dartdevc_sdk
index c687bdd..ba71205 100755
--- a/sdk/bin/dartdevc_sdk
+++ b/sdk/bin/dartdevc_sdk
@@ -6,6 +6,9 @@
 # Run dev compiler on the Dart VM. This script assumes the Dart SDK's
 # directory structure.
 
+echo "Warning: this 'dartdevc' script is deprecated and will be removed. " 1>&2
+echo "More details at https://github.com/dart-lang/sdk/issues/46100." 1>&2
+
 function follow_links() {
   file="$1"
   while [ -h "$file" ]; do
diff --git a/sdk/bin/dartdevc_sdk.bat b/sdk/bin/dartdevc_sdk.bat
index 74b4c18..931e410 100644
--- a/sdk/bin/dartdevc_sdk.bat
+++ b/sdk/bin/dartdevc_sdk.bat
@@ -3,6 +3,9 @@
 REM for details. All rights reserved. Use of this source code is governed by a
 REM BSD-style license that can be found in the LICENSE file.
 
+echo Warning: this 'dartdevc' script is deprecated and will be removed.  1>&2
+echo More details at https://github.com/dart-lang/sdk/issues/46100.      1>&2
+
 setlocal
 rem Handle the case where dart-sdk/bin has been symlinked to.
 set DIR_NAME_WITH_SLASH=%~dp0
diff --git a/sdk/bin/dartdoc b/sdk/bin/dartdoc
deleted file mode 100755
index b7817c8..0000000
--- a/sdk/bin/dartdoc
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/env bash
-# Copyright (c) 2015, 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.
-
-echo "Warning: 'dartdoc' is deprecated. Please use 'dart doc'." 1>&2
-
-function follow_links() {
-  file="$1"
-  while [ -h "$file" ]; do
-    # On Mac OS, readlink -f doesn't work.
-    file="$(readlink "$file")"
-  done
-  echo "$file"
-}
-
-# Unlike $0, $BASH_SOURCE points to the absolute path of this file.
-PROG_NAME="$(follow_links "$BASH_SOURCE")"
-
-# Handle the case where dart-sdk/bin has been symlinked to.
-BIN_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)"
-SDK_DIR="$(cd "${BIN_DIR}/.." ; pwd -P)"
-
-SNAPSHOT="$BIN_DIR/snapshots/dartdoc.dart.snapshot"
-
-# We are running the snapshot in the built SDK.
-DART="$BIN_DIR/dart"
-exec "$DART" "--packages=$BIN_DIR/resources/dartdoc/.packages" "$SNAPSHOT" "--resources-dir=$BIN_DIR/resources/dartdoc/resources/" "$@"
diff --git a/sdk/bin/dartdoc.bat b/sdk/bin/dartdoc.bat
deleted file mode 100644
index ea32a87..0000000
--- a/sdk/bin/dartdoc.bat
+++ /dev/null
@@ -1,46 +0,0 @@
-@echo off
-REM Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
-REM for details. All rights reserved. Use of this source code is governed by a
-REM BSD-style license that can be found in the LICENSE file.
-
-echo Warning: 'dartdoc' is deprecated. Please use 'dart doc'. 1>&2
-
-setlocal
-rem Handle the case where dart-sdk/bin has been symlinked to.
-set DIR_NAME_WITH_SLASH=%~dp0
-set DIR_NAME=%DIR_NAME_WITH_SLASH:~0,-1%%
-call :follow_links "%DIR_NAME%", RETURNED_BIN_DIR
-rem Get rid of surrounding quotes.
-for %%i in ("%RETURNED_BIN_DIR%") do set BIN_DIR=%%~fi
-
-set DART=%BIN_DIR%\dart
-set SNAPSHOT=%BIN_DIR%\snapshots\dartdoc.dart.snapshot
-
-"%DART%" "--packages=%BIN_DIR%/resources/dartdoc/.packages" "%SNAPSHOT%" %*
-
-endlocal
-
-exit /b %errorlevel%
-
-rem Follow the symbolic links (junctions points) using `dir to determine the
-rem canonical path. Output with a link looks something like this
-rem
-rem 01/03/2013  10:11 PM    <JUNCTION>     abc def
-rem [c:\dart_bleeding\dart-repo.9\dart\out\ReleaseIA32\dart-sdk]
-rem
-rem So in the output of 'dir /a:l "targetdir"' we are looking for a filename
-rem surrounded by right angle bracket and left square bracket. Once we get
-rem the filename, which is name of the link, we recursively follow that.
-:follow_links
-setlocal
-for %%i in (%1) do set result=%%~fi
-set current=
-for /f "usebackq tokens=2 delims=[]" %%i in (`dir /a:l "%~dp1" 2^>nul ^
-                                             ^| %SystemRoot%\System32\find.exe ">     %~n1 [" 2^>nul`) do (
-  set current=%%i
-)
-if not "%current%"=="" call :follow_links "%current%", result
-endlocal & set %~2=%result%
-goto :eof
-
-:end
diff --git a/sdk/lib/_http/http.dart b/sdk/lib/_http/http.dart
index b63102a..fdb4de0 100644
--- a/sdk/lib/_http/http.dart
+++ b/sdk/lib/_http/http.dart
@@ -1715,8 +1715,39 @@
   /// following the redirect.
   ///
   /// All headers added to the request will be added to the redirection
-  /// request(s). However, any body send with the request will not be
-  /// part of the redirection request(s).
+  /// request(s) except when forwarding sensitive headers like
+  /// "Authorization", "WWW-Authenticate", and "Cookie". Those headers
+  /// will be skipped if following a redirect to a domain that is not a
+  /// subdomain match or exact match of the initial domain.
+  /// For example, a redirect from "foo.com" to either "foo.com" or
+  /// "sub.foo.com" will forward the sensitive headers, but a redirect to
+  /// "bar.com" will not.
+  ///
+  /// Any body send with the request will not be part of the redirection
+  /// request(s).
+  ///
+  /// For precise control of redirect handling, set this property to `false`
+  /// and make a separate HTTP request to process the redirect. For example:
+  ///
+  /// ```dart
+  /// final client = HttpClient();
+  /// var uri = Uri.parse("http://localhost/");
+  /// var request = await client.getUrl(uri);
+  /// request.followRedirects = false;
+  /// var response = await request.close();
+  /// while (response.isRedirect) {
+  ///   response.drain();
+  ///   final location = response.headers.value(HttpHeaders.locationHeader);
+  ///   if (location != null) {
+  ///     uri = uri.resolve(location);
+  ///     request = await client.getUrl(uri);
+  ///     // Set the body or headers as desired.
+  ///     request.followRedirects = false;
+  ///     response = await request.close();
+  ///   }
+  /// }
+  /// // Do something with the final response.
+  /// ```
   bool followRedirects = true;
 
   /// Set this property to the maximum number of redirects to follow
diff --git a/sdk/lib/_http/http_impl.dart b/sdk/lib/_http/http_impl.dart
index 6c9c786..622c662 100644
--- a/sdk/lib/_http/http_impl.dart
+++ b/sdk/lib/_http/http_impl.dart
@@ -667,7 +667,7 @@
       }
     }
     return _httpClient
-        ._openUrlFromRequest(method, url, _httpRequest)
+        ._openUrlFromRequest(method, url, _httpRequest, isRedirect: true)
         .then((request) {
       request._responseRedirects
         ..addAll(redirects)
@@ -751,7 +751,8 @@
       return drain().then((_) {
         return _httpClient
             ._openUrlFromRequest(
-                _httpRequest.method, _httpRequest.uri, _httpRequest)
+                _httpRequest.method, _httpRequest.uri, _httpRequest,
+                isRedirect: false)
             .then((request) => request.close());
       });
     }
@@ -2715,8 +2716,31 @@
     });
   }
 
+  static bool _isSubdomain(Uri subdomain, Uri domain) {
+    return (subdomain.scheme == domain.scheme &&
+        subdomain.port == domain.port &&
+        (subdomain.host == domain.host ||
+            subdomain.host.endsWith("." + domain.host)));
+  }
+
+  static bool _shouldCopyHeaderOnRedirect(
+      String headerKey, Uri originalUrl, Uri redirectUri) {
+    if (_isSubdomain(redirectUri, originalUrl)) {
+      return true;
+    }
+
+    const nonRedirectHeaders = [
+      "authorization",
+      "www-authenticate",
+      "cookie",
+      "cookie2"
+    ];
+    return !nonRedirectHeaders.contains(headerKey.toLowerCase());
+  }
+
   Future<_HttpClientRequest> _openUrlFromRequest(
-      String method, Uri uri, _HttpClientRequest previous) {
+      String method, Uri uri, _HttpClientRequest previous,
+      {required bool isRedirect}) {
     // If the new URI is relative (to either '/' or some sub-path),
     // construct a full URI from the previous one.
     Uri resolved = previous.uri.resolveUri(uri);
@@ -2728,7 +2752,9 @@
         ..maxRedirects = previous.maxRedirects;
       // Copy headers.
       for (var header in previous.headers._headers.keys) {
-        if (request.headers[header] == null) {
+        if (request.headers[header] == null &&
+            (!isRedirect ||
+                _shouldCopyHeaderOnRedirect(header, resolved, previous.uri))) {
           request.headers.set(header, previous.headers[header]!);
         }
       }
diff --git a/sdk/lib/_internal/vm/lib/ffi_native_type_patch.dart b/sdk/lib/_internal/vm/lib/ffi_native_type_patch.dart
index 92e23c1..ca47a83 100644
--- a/sdk/lib/_internal/vm/lib/ffi_native_type_patch.dart
+++ b/sdk/lib/_internal/vm/lib/ffi_native_type_patch.dart
@@ -55,11 +55,6 @@
 @pragma("vm:entry-point")
 class Uint64 extends _NativeInteger {}
 
-// TODO(http://dartbug.com/47938): Implement as AbiSpecificInteger.
-@patch
-@pragma("vm:entry-point")
-class IntPtr extends _NativeInteger {}
-
 @patch
 @pragma("vm:entry-point")
 class Float extends _NativeDouble {}
diff --git a/sdk/lib/async/future_impl.dart b/sdk/lib/async/future_impl.dart
index c3dc65b..4d13cc8 100644
--- a/sdk/lib/async/future_impl.dart
+++ b/sdk/lib/async/future_impl.dart
@@ -80,7 +80,6 @@
   static const int stateWhenComplete = maskWhenComplete;
   static const int maskType =
       maskValue | maskError | maskTestError | maskWhenComplete;
-  static const int stateIsAwait = 16;
 
   // Listeners on the same future are linked through this link.
   _FutureListener? _nextListener;
@@ -110,8 +109,7 @@
       this.result, _FutureOnValue<S, T> onValue, Function errorCallback)
       : callback = onValue,
         errorCallback = errorCallback,
-        state = ((errorCallback == null) ? stateThen : stateThenOnerror) |
-            stateIsAwait;
+        state = stateThenOnerror;
 
   _FutureListener.catchError(this.result, this.errorCallback, this.callback)
       : state = (callback == null) ? stateCatchError : stateCatchErrorTest;
@@ -126,7 +124,6 @@
   bool get handlesError => (state & maskError != 0);
   bool get hasErrorTest => (state & maskType == stateCatchErrorTest);
   bool get handlesComplete => (state & maskType == stateWhenComplete);
-  bool get isAwait => (state & stateIsAwait != 0);
 
   FutureOr<T> Function(S) get _onValue {
     assert(handlesValue);
@@ -304,27 +301,6 @@
   bool get _hasError => (_state & _stateError) != 0;
   bool get _ignoreError => (_state & _stateIgnoreError) != 0;
 
-  static List<Function>? _continuationFunctions(_Future<Object> future) {
-    List<Function>? result = null;
-    while (true) {
-      if (future._mayAddListener) return result;
-      assert(!future._isComplete);
-      assert(!future._isChained);
-      // So _resultOrListeners contains listeners.
-      _FutureListener<Object, Object>? listener = future._resultOrListeners;
-      if (listener != null &&
-          listener._nextListener == null &&
-          listener.isAwait) {
-        (result ??= <Function>[]).add(listener.handleValue);
-        future = listener.result;
-        assert(!future._isComplete);
-      } else {
-        break;
-      }
-    }
-    return result;
-  }
-
   void _setChained(_Future source) {
     assert(_mayAddListener);
     _state = _stateChained | (_state & _stateIgnoreError);
@@ -360,9 +336,7 @@
   /// Registers a system created result and error continuation.
   ///
   /// Used by the implementation of `await` to listen to a future.
-  /// The system created listeners are not registered in the zone,
-  /// and the listener is marked as being from an `await`.
-  /// This marker is used in [_continuationFunctions].
+  /// The system created listeners are not registered in the zone.
   Future<E> _thenAwait<E>(FutureOr<E> f(T value), Function onError) {
     _Future<E> result = new _Future<E>();
     _addListener(new _FutureListener<T, E>.thenAwait(result, f, onError));
diff --git a/sdk/lib/ffi/abi_specific.dart b/sdk/lib/ffi/abi_specific.dart
index d84f74e..a41308c 100644
--- a/sdk/lib/ffi/abi_specific.dart
+++ b/sdk/lib/ffi/abi_specific.dart
@@ -13,10 +13,12 @@
 /// For example:
 ///
 /// ```
-/// /// Represents a `uintptr_t` in C.
+/// /// The C `uintptr_t` type.
 /// ///
-/// /// [UintPtr] is not constructible in the Dart code and serves purely as
-/// /// marker in type signatures.
+/// /// The [UintPtr] type is a native type, and should not be constructed in
+/// /// Dart code.
+/// /// It occurs only in native type signatures and as annotation on [Struct]
+/// /// and [Union] fields.
 /// @AbiSpecificIntegerMapping({
 ///   Abi.androidArm: Uint32(),
 ///   Abi.androidArm64: Uint64(),
diff --git a/sdk/lib/ffi/c_type.dart b/sdk/lib/ffi/c_type.dart
new file mode 100644
index 0000000..b1bc764
--- /dev/null
+++ b/sdk/lib/ffi/c_type.dart
@@ -0,0 +1,503 @@
+// Copyright (c) 2022, 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.
+
+/// This library defines [NativeType]s for common C types.
+///
+/// Many C types only define a minimal size in the C standard, but they are
+/// consistent per [Abi]. Therefore we use [AbiSpecificInteger]s to define
+/// these C types in this library.
+part of dart.ffi;
+
+/// The C `signed char` type.
+///
+/// Typically a signed 8-bit integer.
+/// For a guaranteed 8-bit integer, use [Int8] with the C `int8_t` type.
+/// For an `unsigned char`, use [UnsignedChar].
+///
+/// The [SignedChar] type is a native type, and should not be constructed in
+/// Dart code.
+/// It occurs only in native type signatures and as annotation on [Struct] and
+/// [Union] fields.
+@AbiSpecificIntegerMapping({
+  Abi.androidArm: Int8(),
+  Abi.androidArm64: Int8(),
+  Abi.androidIA32: Int8(),
+  Abi.androidX64: Int8(),
+  Abi.fuchsiaArm64: Int8(),
+  Abi.fuchsiaX64: Int8(),
+  Abi.iosArm: Int8(),
+  Abi.iosArm64: Int8(),
+  Abi.iosX64: Int8(),
+  Abi.linuxArm: Int8(),
+  Abi.linuxArm64: Int8(),
+  Abi.linuxIA32: Int8(),
+  Abi.linuxX64: Int8(),
+  Abi.linuxRiscv32: Int8(),
+  Abi.linuxRiscv64: Int8(),
+  Abi.macosArm64: Int8(),
+  Abi.macosX64: Int8(),
+  Abi.windowsArm64: Int8(),
+  Abi.windowsIA32: Int8(),
+  Abi.windowsX64: Int8(),
+})
+class SignedChar extends AbiSpecificInteger {
+  const SignedChar();
+}
+
+/// The C `unsigned char` type.
+///
+/// Typically an unsigned 8-bit integer.
+/// For a guaranteed 8-bit integer, use [Uint8] with the C `uint8_t` type.
+/// For a `signed char`, use [SignedChar].
+///
+/// The [UnsignedChar] type is a native type, and should not be constructed in
+/// Dart code.
+/// It occurs only in native type signatures and as annotation on [Struct] and
+/// [Union] fields.
+@AbiSpecificIntegerMapping({
+  Abi.androidArm: Uint8(),
+  Abi.androidArm64: Uint8(),
+  Abi.androidIA32: Uint8(),
+  Abi.androidX64: Uint8(),
+  Abi.fuchsiaArm64: Uint8(),
+  Abi.fuchsiaX64: Uint8(),
+  Abi.iosArm: Uint8(),
+  Abi.iosArm64: Uint8(),
+  Abi.iosX64: Uint8(),
+  Abi.linuxArm: Uint8(),
+  Abi.linuxArm64: Uint8(),
+  Abi.linuxIA32: Uint8(),
+  Abi.linuxX64: Uint8(),
+  Abi.linuxRiscv32: Uint8(),
+  Abi.linuxRiscv64: Uint8(),
+  Abi.macosArm64: Uint8(),
+  Abi.macosX64: Uint8(),
+  Abi.windowsArm64: Uint8(),
+  Abi.windowsIA32: Uint8(),
+  Abi.windowsX64: Uint8(),
+})
+class UnsignedChar extends AbiSpecificInteger {
+  const UnsignedChar();
+}
+
+/// The C `short` type.
+///
+/// Typically a signed 16-bit integer.
+/// For a guaranteed 16-bit integer, use [Int16] with the C `int16_t` type.
+/// For an `unsigned short`, use [UnsignedShort].
+///
+/// The [Short] type is a native type, and should not be constructed in
+/// Dart code.
+/// It occurs only in native type signatures and as annotation on [Struct] and
+/// [Union] fields.
+@AbiSpecificIntegerMapping({
+  Abi.androidArm: Int16(),
+  Abi.androidArm64: Int16(),
+  Abi.androidIA32: Int16(),
+  Abi.androidX64: Int16(),
+  Abi.fuchsiaArm64: Int16(),
+  Abi.fuchsiaX64: Int16(),
+  Abi.iosArm: Int16(),
+  Abi.iosArm64: Int16(),
+  Abi.iosX64: Int16(),
+  Abi.linuxArm: Int16(),
+  Abi.linuxArm64: Int16(),
+  Abi.linuxIA32: Int16(),
+  Abi.linuxX64: Int16(),
+  Abi.linuxRiscv32: Int16(),
+  Abi.linuxRiscv64: Int16(),
+  Abi.macosArm64: Int16(),
+  Abi.macosX64: Int16(),
+  Abi.windowsArm64: Int16(),
+  Abi.windowsIA32: Int16(),
+  Abi.windowsX64: Int16(),
+})
+class Short extends AbiSpecificInteger {
+  const Short();
+}
+
+/// The C `unsigned short` type.
+///
+/// Typically an unsigned 16-bit integer.
+/// For a guaranteed 16-bit integer, use [Uint16] with the C `uint16_t` type.
+/// For a signed `short`, use [Short].
+///
+/// The [UnsignedShort] type is a native type, and should not be constructed in
+/// Dart code.
+/// It occurs only in native type signatures and as annotation on [Struct] and
+/// [Union] fields.
+@AbiSpecificIntegerMapping({
+  Abi.androidArm: Uint16(),
+  Abi.androidArm64: Uint16(),
+  Abi.androidIA32: Uint16(),
+  Abi.androidX64: Uint16(),
+  Abi.fuchsiaArm64: Uint16(),
+  Abi.fuchsiaX64: Uint16(),
+  Abi.iosArm: Uint16(),
+  Abi.iosArm64: Uint16(),
+  Abi.iosX64: Uint16(),
+  Abi.linuxArm: Uint16(),
+  Abi.linuxArm64: Uint16(),
+  Abi.linuxIA32: Uint16(),
+  Abi.linuxX64: Uint16(),
+  Abi.linuxRiscv32: Uint16(),
+  Abi.linuxRiscv64: Uint16(),
+  Abi.macosArm64: Uint16(),
+  Abi.macosX64: Uint16(),
+  Abi.windowsArm64: Uint16(),
+  Abi.windowsIA32: Uint16(),
+  Abi.windowsX64: Uint16(),
+})
+class UnsignedShort extends AbiSpecificInteger {
+  const UnsignedShort();
+}
+
+/// The C `int` type.
+///
+/// Typically a signed 32-bit integer.
+/// For a guaranteed 32-bit integer, use [Int32] with the C `int32_t` type.
+/// For an `unsigned int`, use [UnsignedInt].
+///
+/// The [Int] type is a native type, and should not be constructed in
+/// Dart code.
+/// It occurs only in native type signatures and as annotation on [Struct] and
+/// [Union] fields.
+@AbiSpecificIntegerMapping({
+  Abi.androidArm: Int32(),
+  Abi.androidArm64: Int32(),
+  Abi.androidIA32: Int32(),
+  Abi.androidX64: Int32(),
+  Abi.fuchsiaArm64: Int32(),
+  Abi.fuchsiaX64: Int32(),
+  Abi.iosArm: Int32(),
+  Abi.iosArm64: Int32(),
+  Abi.iosX64: Int32(),
+  Abi.linuxArm: Int32(),
+  Abi.linuxArm64: Int32(),
+  Abi.linuxIA32: Int32(),
+  Abi.linuxX64: Int32(),
+  Abi.linuxRiscv32: Int32(),
+  Abi.linuxRiscv64: Int32(),
+  Abi.macosArm64: Int32(),
+  Abi.macosX64: Int32(),
+  Abi.windowsArm64: Int32(),
+  Abi.windowsIA32: Int32(),
+  Abi.windowsX64: Int32(),
+})
+class Int extends AbiSpecificInteger {
+  const Int();
+}
+
+/// The C `unsigned int` type.
+///
+/// Typically an unsigned 32-bit integer.
+/// For a guaranteed 32-bit integer, use [Uint32] with the C `uint32_t` type.
+/// For a signed `int`, use [Int].
+///
+/// The [UnsignedInt] type is a native type, and should not be constructed in
+/// Dart code.
+/// It occurs only in native type signatures and as annotation on [Struct] and
+/// [Union] fields.
+@AbiSpecificIntegerMapping({
+  Abi.androidArm: Uint32(),
+  Abi.androidArm64: Uint32(),
+  Abi.androidIA32: Uint32(),
+  Abi.androidX64: Uint32(),
+  Abi.fuchsiaArm64: Uint32(),
+  Abi.fuchsiaX64: Uint32(),
+  Abi.iosArm: Uint32(),
+  Abi.iosArm64: Uint32(),
+  Abi.iosX64: Uint32(),
+  Abi.linuxArm: Uint32(),
+  Abi.linuxArm64: Uint32(),
+  Abi.linuxIA32: Uint32(),
+  Abi.linuxX64: Uint32(),
+  Abi.linuxRiscv32: Uint32(),
+  Abi.linuxRiscv64: Uint32(),
+  Abi.macosArm64: Uint32(),
+  Abi.macosX64: Uint32(),
+  Abi.windowsArm64: Uint32(),
+  Abi.windowsIA32: Uint32(),
+  Abi.windowsX64: Uint32(),
+})
+class UnsignedInt extends AbiSpecificInteger {
+  const UnsignedInt();
+}
+
+/// The C `long int`, aka. `long`, type.
+///
+/// Typically a signed 32- or 64-bit integer.
+/// For a guaranteed 32-bit integer, use [Int32] with the C `int32_t` type.
+/// For a guaranteed 64-bit integer, use [Int64] with the C `int64_t` type.
+/// For an `unsigned long`, use [UnsignedLong].
+///
+/// The [Long] type is a native type, and should not be constructed in
+/// Dart code.
+/// It occurs only in native type signatures and as annotation on [Struct] and
+/// [Union] fields.
+@AbiSpecificIntegerMapping({
+  Abi.androidArm: Int32(),
+  Abi.androidArm64: Int64(),
+  Abi.androidIA32: Int32(),
+  Abi.androidX64: Int64(),
+  Abi.fuchsiaArm64: Int64(),
+  Abi.fuchsiaX64: Int64(),
+  Abi.iosArm: Int32(),
+  Abi.iosArm64: Int64(),
+  Abi.iosX64: Int64(),
+  Abi.linuxArm: Int32(),
+  Abi.linuxArm64: Int64(),
+  Abi.linuxIA32: Int32(),
+  Abi.linuxX64: Int64(),
+  Abi.linuxRiscv32: Int32(),
+  Abi.linuxRiscv64: Int64(),
+  Abi.macosArm64: Int64(),
+  Abi.macosX64: Int64(),
+  Abi.windowsArm64: Int32(),
+  Abi.windowsIA32: Int32(),
+  Abi.windowsX64: Int32(),
+})
+class Long extends AbiSpecificInteger {
+  const Long();
+}
+
+/// The C `unsigned long int`, aka. `unsigned long`, type.
+///
+/// Typically an unsigned 32- or 64-bit integer.
+/// For a guaranteed 32-bit integer, use [Uint32] with the C `uint32_t` type.
+/// For a guaranteed 64-bit integer, use [Uint64] with the C `uint64_t` type.
+/// For a signed `long`, use [Long].
+///
+/// The [UnsignedLong] type is a native type, and should not be constructed in
+/// Dart code.
+/// It occurs only in native type signatures and as annotation on [Struct] and
+/// [Union] fields.
+@AbiSpecificIntegerMapping({
+  Abi.androidArm: Uint32(),
+  Abi.androidArm64: Uint64(),
+  Abi.androidIA32: Uint32(),
+  Abi.androidX64: Uint64(),
+  Abi.fuchsiaArm64: Uint64(),
+  Abi.fuchsiaX64: Uint64(),
+  Abi.iosArm: Uint32(),
+  Abi.iosArm64: Uint64(),
+  Abi.iosX64: Uint64(),
+  Abi.linuxArm: Uint32(),
+  Abi.linuxArm64: Uint64(),
+  Abi.linuxIA32: Uint32(),
+  Abi.linuxX64: Uint64(),
+  Abi.linuxRiscv32: Uint32(),
+  Abi.linuxRiscv64: Uint64(),
+  Abi.macosArm64: Uint64(),
+  Abi.macosX64: Uint64(),
+  Abi.windowsArm64: Uint32(),
+  Abi.windowsIA32: Uint32(),
+  Abi.windowsX64: Uint32(),
+})
+class UnsignedLong extends AbiSpecificInteger {
+  const UnsignedLong();
+}
+
+/// The C `long long` type.
+///
+/// Typically a signed 64-bit integer.
+/// For a guaranteed 64-bit integer, use [Int64] with the C `int64_t` type.
+/// For an `unsigned long long`, use [UnsignedLongLong].
+///
+/// The [LongLong] type is a native type, and should not be constructed in
+/// Dart code.
+/// It occurs only in native type signatures and as annotation on [Struct] and
+/// [Union] fields.
+@AbiSpecificIntegerMapping({
+  Abi.androidArm: Int64(),
+  Abi.androidArm64: Int64(),
+  Abi.androidIA32: Int64(),
+  Abi.androidX64: Int64(),
+  Abi.fuchsiaArm64: Int64(),
+  Abi.fuchsiaX64: Int64(),
+  Abi.iosArm: Int64(),
+  Abi.iosArm64: Int64(),
+  Abi.iosX64: Int64(),
+  Abi.linuxArm: Int64(),
+  Abi.linuxArm64: Int64(),
+  Abi.linuxIA32: Int64(),
+  Abi.linuxX64: Int64(),
+  Abi.linuxRiscv32: Int64(),
+  Abi.linuxRiscv64: Int64(),
+  Abi.macosArm64: Int64(),
+  Abi.macosX64: Int64(),
+  Abi.windowsArm64: Int64(),
+  Abi.windowsIA32: Int64(),
+  Abi.windowsX64: Int64(),
+})
+class LongLong extends AbiSpecificInteger {
+  const LongLong();
+}
+
+/// The C `unsigned long long` type.
+///
+/// Typically an unsigned 64-bit integer.
+/// For a guaranteed 64-bit integer, use [Uint64] with the C `uint64_t` type.
+/// For a signed `long long`, use [LongLong].
+///
+/// The [UnsignedLongLong] type is a native type, and should not be constructed
+/// in Dart code.
+/// It occurs only in native type signatures and as annotation on [Struct] and
+/// [Union] fields.
+@AbiSpecificIntegerMapping({
+  Abi.androidArm: Uint64(),
+  Abi.androidArm64: Uint64(),
+  Abi.androidIA32: Uint64(),
+  Abi.androidX64: Uint64(),
+  Abi.fuchsiaArm64: Uint64(),
+  Abi.fuchsiaX64: Uint64(),
+  Abi.iosArm: Uint64(),
+  Abi.iosArm64: Uint64(),
+  Abi.iosX64: Uint64(),
+  Abi.linuxArm: Uint64(),
+  Abi.linuxArm64: Uint64(),
+  Abi.linuxIA32: Uint64(),
+  Abi.linuxX64: Uint64(),
+  Abi.linuxRiscv32: Uint64(),
+  Abi.linuxRiscv64: Uint64(),
+  Abi.macosArm64: Uint64(),
+  Abi.macosX64: Uint64(),
+  Abi.windowsArm64: Uint64(),
+  Abi.windowsIA32: Uint64(),
+  Abi.windowsX64: Uint64(),
+})
+class UnsignedLongLong extends AbiSpecificInteger {
+  const UnsignedLongLong();
+}
+
+/// The C `intptr_t` type.
+///
+/// The [IntPtr] type is a native type, and should not be constructed in
+/// Dart code.
+/// It occurs only in native type signatures and as annotation on [Struct] and
+/// [Union] fields.
+@AbiSpecificIntegerMapping({
+  Abi.androidArm: Int32(),
+  Abi.androidArm64: Int64(),
+  Abi.androidIA32: Int32(),
+  Abi.androidX64: Int64(),
+  Abi.fuchsiaArm64: Int64(),
+  Abi.fuchsiaX64: Int64(),
+  Abi.iosArm: Int32(),
+  Abi.iosArm64: Int64(),
+  Abi.iosX64: Int64(),
+  Abi.linuxArm: Int32(),
+  Abi.linuxArm64: Int64(),
+  Abi.linuxIA32: Int32(),
+  Abi.linuxX64: Int64(),
+  Abi.linuxRiscv32: Int32(),
+  Abi.linuxRiscv64: Int64(),
+  Abi.macosArm64: Int64(),
+  Abi.macosX64: Int64(),
+  Abi.windowsArm64: Int64(),
+  Abi.windowsIA32: Int32(),
+  Abi.windowsX64: Int64(),
+})
+class IntPtr extends AbiSpecificInteger {
+  const IntPtr();
+}
+
+/// The C `uintptr_t` type.
+///
+/// The [UintPtr] type is a native type, and should not be constructed in
+/// Dart code.
+/// It occurs only in native type signatures and as annotation on [Struct] and
+/// [Union] fields.
+@AbiSpecificIntegerMapping({
+  Abi.androidArm: Uint32(),
+  Abi.androidArm64: Uint64(),
+  Abi.androidIA32: Uint32(),
+  Abi.androidX64: Uint64(),
+  Abi.fuchsiaArm64: Uint64(),
+  Abi.fuchsiaX64: Uint64(),
+  Abi.iosArm: Uint32(),
+  Abi.iosArm64: Uint64(),
+  Abi.iosX64: Uint64(),
+  Abi.linuxArm: Uint32(),
+  Abi.linuxArm64: Uint64(),
+  Abi.linuxIA32: Uint32(),
+  Abi.linuxX64: Uint64(),
+  Abi.linuxRiscv32: Uint32(),
+  Abi.linuxRiscv64: Uint64(),
+  Abi.macosArm64: Uint64(),
+  Abi.macosX64: Uint64(),
+  Abi.windowsArm64: Uint64(),
+  Abi.windowsIA32: Uint32(),
+  Abi.windowsX64: Uint64(),
+})
+class UintPtr extends AbiSpecificInteger {
+  const UintPtr();
+}
+
+/// The C `size_t` type.
+///
+/// The [Size] type is a native type, and should not be constructed in
+/// Dart code.
+/// It occurs only in native type signatures and as annotation on [Struct] and
+/// [Union] fields.
+@AbiSpecificIntegerMapping({
+  Abi.androidArm: Uint32(),
+  Abi.androidArm64: Uint64(),
+  Abi.androidIA32: Uint32(),
+  Abi.androidX64: Uint64(),
+  Abi.fuchsiaArm64: Uint64(),
+  Abi.fuchsiaX64: Uint64(),
+  Abi.iosArm: Uint32(),
+  Abi.iosArm64: Uint64(),
+  Abi.iosX64: Uint64(),
+  Abi.linuxArm: Uint32(),
+  Abi.linuxArm64: Uint64(),
+  Abi.linuxIA32: Uint32(),
+  Abi.linuxX64: Uint64(),
+  Abi.linuxRiscv32: Uint32(),
+  Abi.linuxRiscv64: Uint64(),
+  Abi.macosArm64: Uint64(),
+  Abi.macosX64: Uint64(),
+  Abi.windowsArm64: Uint64(),
+  Abi.windowsIA32: Uint32(),
+  Abi.windowsX64: Uint64(),
+})
+class Size extends AbiSpecificInteger {
+  const Size();
+}
+
+/// The C `wchar_t` type.
+///
+/// The signedness of `wchar_t` is undefined in C. Here, it is exposed as the
+/// defaults on the tested [Abi]s.
+///
+/// The [WChar] type is a native type, and should not be constructed in
+/// Dart code.
+/// It occurs only in native type signatures and as annotation on [Struct] and
+/// [Union] fields.
+@AbiSpecificIntegerMapping({
+  Abi.androidArm: Uint32(),
+  Abi.androidArm64: Uint32(),
+  Abi.androidIA32: Uint32(),
+  Abi.androidX64: Uint32(),
+  Abi.fuchsiaArm64: Uint32(),
+  Abi.fuchsiaX64: Int32(),
+  Abi.iosArm: Int32(),
+  Abi.iosArm64: Int32(),
+  Abi.iosX64: Int32(),
+  Abi.linuxArm: Uint32(),
+  Abi.linuxArm64: Uint32(),
+  Abi.linuxIA32: Int32(),
+  Abi.linuxX64: Int32(),
+  Abi.linuxRiscv32: Uint32(),
+  Abi.linuxRiscv64: Uint32(),
+  Abi.macosArm64: Int32(),
+  Abi.macosX64: Int32(),
+  Abi.windowsArm64: Uint16(),
+  Abi.windowsIA32: Uint16(),
+  Abi.windowsX64: Uint16(),
+})
+class WChar extends AbiSpecificInteger {
+  const WChar();
+}
diff --git a/sdk/lib/ffi/ffi.dart b/sdk/lib/ffi/ffi.dart
index b1d53a6..9a7afe2 100644
--- a/sdk/lib/ffi/ffi.dart
+++ b/sdk/lib/ffi/ffi.dart
@@ -20,6 +20,7 @@
 part 'native_type.dart';
 part 'allocation.dart';
 part 'annotations.dart';
+part 'c_type.dart';
 part 'dynamic_library.dart';
 part 'struct.dart';
 part 'union.dart';
diff --git a/sdk/lib/ffi/ffi_sources.gni b/sdk/lib/ffi/ffi_sources.gni
index b725fe0..4197369 100644
--- a/sdk/lib/ffi/ffi_sources.gni
+++ b/sdk/lib/ffi/ffi_sources.gni
@@ -10,6 +10,7 @@
   "abi_specific.dart",
   "allocation.dart",
   "annotations.dart",
+  "c_type.dart",
   "dynamic_library.dart",
   "native_type.dart",
   "struct.dart",
diff --git a/sdk/lib/ffi/native_type.dart b/sdk/lib/ffi/native_type.dart
index dbbea7c..55a9f6d 100644
--- a/sdk/lib/ffi/native_type.dart
+++ b/sdk/lib/ffi/native_type.dart
@@ -98,36 +98,6 @@
   const Uint64();
 }
 
-/// Represents a native pointer-sized integer in C.
-///
-/// [IntPtr] is not constructible in the Dart code and serves purely as marker
-/// in type signatures.
-@AbiSpecificIntegerMapping({
-  Abi.androidArm: Int32(),
-  Abi.androidArm64: Int64(),
-  Abi.androidIA32: Int32(),
-  Abi.androidX64: Int64(),
-  Abi.fuchsiaArm64: Int64(),
-  Abi.fuchsiaX64: Int64(),
-  Abi.iosArm: Int32(),
-  Abi.iosArm64: Int64(),
-  Abi.iosX64: Int64(),
-  Abi.linuxArm: Int32(),
-  Abi.linuxArm64: Int64(),
-  Abi.linuxIA32: Int32(),
-  Abi.linuxX64: Int64(),
-  Abi.linuxRiscv32: Int32(),
-  Abi.linuxRiscv64: Int64(),
-  Abi.macosArm64: Int64(),
-  Abi.macosX64: Int64(),
-  Abi.windowsArm64: Int64(),
-  Abi.windowsIA32: Int32(),
-  Abi.windowsX64: Int64(),
-})
-class IntPtr extends AbiSpecificInteger {
-  const IntPtr();
-}
-
 /// Represents a native 32 bit float in C.
 ///
 /// [Float] is not constructible in the Dart code and serves purely as marker
diff --git a/tests/ffi/abi_specific_int_test.dart b/tests/ffi/abi_specific_int_test.dart
index 266655c..cea45b1 100644
--- a/tests/ffi/abi_specific_int_test.dart
+++ b/tests/ffi/abi_specific_int_test.dart
@@ -8,8 +8,6 @@
 import 'package:expect/expect.dart';
 import 'package:ffi/ffi.dart';
 
-import 'abi_specific_ints.dart';
-
 void main() {
   testSizeOf();
   testStoreLoad();
diff --git a/tests/ffi/abi_specific_ints.dart b/tests/ffi/abi_specific_ints.dart
deleted file mode 100644
index c0cd3f0..0000000
--- a/tests/ffi/abi_specific_ints.dart
+++ /dev/null
@@ -1,145 +0,0 @@
-// Copyright (c) 2021, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:ffi';
-
-// TODO(dacoharkes): These should move to `package:ffi`.
-
-// `int` in C.
-typedef Int = Int32;
-
-// `unsigned int` in C.
-typedef UnsignedInt = Uint32;
-
-// `size_t` in C.
-typedef Size = UintPtr;
-
-// `ssize_t` in C.
-typedef SSize = IntPtr;
-
-// `off_t` in C.
-typedef Off = Long;
-
-/// Represents a native unsigned pointer-sized integer in C.
-///
-/// [UintPtr] is not constructible in the Dart code and serves purely as marker in
-/// type signatures.
-@AbiSpecificIntegerMapping({
-  Abi.androidArm: Uint32(),
-  Abi.androidArm64: Uint64(),
-  Abi.androidIA32: Uint32(),
-  Abi.androidX64: Uint64(),
-  Abi.fuchsiaArm64: Uint64(),
-  Abi.fuchsiaX64: Uint64(),
-  Abi.iosArm: Uint32(),
-  Abi.iosArm64: Uint64(),
-  Abi.iosX64: Uint64(),
-  Abi.linuxArm: Uint32(),
-  Abi.linuxArm64: Uint64(),
-  Abi.linuxIA32: Uint32(),
-  Abi.linuxX64: Uint64(),
-  Abi.linuxRiscv32: Uint32(),
-  Abi.linuxRiscv64: Uint64(),
-  Abi.macosArm64: Uint64(),
-  Abi.macosX64: Uint64(),
-  Abi.windowsArm64: Uint64(),
-  Abi.windowsIA32: Uint32(),
-  Abi.windowsX64: Uint64(),
-})
-class UintPtr extends AbiSpecificInteger {
-  const UintPtr();
-}
-
-/// `long` in C.
-///
-/// [Long] is not constructible in the Dart code and serves purely as marker in
-/// type signatures.
-@AbiSpecificIntegerMapping({
-  Abi.androidArm: Int32(),
-  Abi.androidArm64: Int64(),
-  Abi.androidIA32: Int32(),
-  Abi.androidX64: Int64(),
-  Abi.fuchsiaArm64: Int64(),
-  Abi.fuchsiaX64: Int64(),
-  Abi.iosArm: Int32(),
-  Abi.iosArm64: Int64(),
-  Abi.iosX64: Int64(),
-  Abi.linuxArm: Int32(),
-  Abi.linuxArm64: Int64(),
-  Abi.linuxIA32: Int32(),
-  Abi.linuxX64: Int64(),
-  Abi.linuxRiscv32: Int32(),
-  Abi.linuxRiscv64: Int64(),
-  Abi.macosArm64: Int64(),
-  Abi.macosX64: Int64(),
-  Abi.windowsArm64: Int32(),
-  Abi.windowsIA32: Int32(),
-  Abi.windowsX64: Int32(),
-})
-class Long extends AbiSpecificInteger {
-  const Long();
-}
-
-/// `unsigned long` in C.
-///
-/// [UnsignedLong] is not constructible in the Dart code and serves purely as marker in
-/// type signatures.
-@AbiSpecificIntegerMapping({
-  Abi.androidArm: Uint32(),
-  Abi.androidArm64: Uint64(),
-  Abi.androidIA32: Uint32(),
-  Abi.androidX64: Uint64(),
-  Abi.fuchsiaArm64: Uint64(),
-  Abi.fuchsiaX64: Uint64(),
-  Abi.iosArm: Uint32(),
-  Abi.iosArm64: Uint64(),
-  Abi.iosX64: Uint64(),
-  Abi.linuxArm: Uint32(),
-  Abi.linuxArm64: Uint64(),
-  Abi.linuxIA32: Uint32(),
-  Abi.linuxX64: Uint64(),
-  Abi.linuxRiscv32: Uint32(),
-  Abi.linuxRiscv64: Uint64(),
-  Abi.macosArm64: Uint64(),
-  Abi.macosX64: Uint64(),
-  Abi.windowsArm64: Uint32(),
-  Abi.windowsIA32: Uint32(),
-  Abi.windowsX64: Uint32(),
-})
-class UnsignedLong extends AbiSpecificInteger {
-  const UnsignedLong();
-}
-
-/// `wchar_t` in C.
-///
-/// The signedness of `wchar_t` is undefined in C. Here, it is exposed as an
-/// unsigned integer.
-///
-/// [WChar] is not constructible in the Dart code and serves purely as marker in
-/// type signatures.
-@AbiSpecificIntegerMapping({
-  Abi.androidArm: Uint32(),
-  Abi.androidArm64: Uint32(),
-  Abi.androidIA32: Uint32(),
-  Abi.androidX64: Uint32(),
-  Abi.fuchsiaArm64: Uint32(),
-  Abi.fuchsiaX64: Uint32(),
-  Abi.iosArm: Uint32(),
-  Abi.iosArm64: Uint32(),
-  Abi.iosX64: Uint32(),
-  Abi.linuxArm: Uint32(),
-  Abi.linuxArm64: Uint32(),
-  Abi.linuxIA32: Uint32(),
-  Abi.linuxX64: Uint32(),
-  Abi.linuxRiscv32: Uint32(),
-  Abi.linuxRiscv64: Uint32(),
-  Abi.macosArm64: Uint32(),
-  Abi.macosX64: Uint32(),
-  Abi.windowsArm64: Uint16(),
-  Abi.windowsIA32: Uint16(),
-  Abi.windowsX64: Uint16(),
-})
-class WChar extends AbiSpecificInteger {
-  const WChar();
-}
diff --git a/tests/ffi/c_types_test.dart b/tests/ffi/c_types_test.dart
index d423c2c..c132f3b 100644
--- a/tests/ffi/c_types_test.dart
+++ b/tests/ffi/c_types_test.dart
@@ -7,11 +7,11 @@
 // SharedObjects=ffi_test_functions
 
 import 'dart:ffi';
-
-import "package:expect/expect.dart";
 import 'dart:io' show Platform;
 
-import 'abi_specific_ints.dart';
+import 'package:expect/expect.dart';
+import 'package:ffi/ffi.dart';
+
 import 'ffi_test_helpers.dart';
 
 void main() {
@@ -20,62 +20,156 @@
   testIntAssumptions();
   testSizeTAssumptions();
   testLongAssumptions();
-  testOffTAssumptions();
   testWCharTAssumptions();
 }
 
 class CType {
   final int ffiSize;
+  final int Function(Pointer)? ffiLoad;
   final String modifier;
   final String type;
+  final String type2;
 
-  CType(this.ffiSize, this.type, [this.modifier = ""]);
+  CType(this.ffiSize, this.type,
+      {this.type2 = '', this.modifier = '', this.ffiLoad});
 
-  String get cRepresentation => "$modifier $type".trim();
+  String get cRepresentation => '$modifier $type $type2'.trim();
 
-  String get _getSizeName => "FfiSizeOf_$modifier\_$type";
+  String get _getSizeName => 'FfiSizeOf_$modifier\_$type\_$type2';
+
+  String get _getSignName => 'FfiSignOf_$modifier\_$type\_$type2';
 
   int Function() get sizeFunction => ffiTestFunctions
       .lookupFunction<Uint64 Function(), int Function()>(_getSizeName);
 
+  int Function() get signFunction => ffiTestFunctions
+      .lookupFunction<Uint64 Function(), int Function()>(_getSignName);
+
   int get size => sizeFunction();
 
+  bool get isSigned => signFunction() != 0;
+
+  bool? get ffiIsSigned {
+    final ffiLoad_ = ffiLoad;
+    if (ffiLoad_ == null) {
+      return null;
+    }
+    assert(size < 8);
+    return using((Arena arena) {
+      final p = arena<Int64>()..value = -1;
+      return ffiLoad_(p) < 0;
+    });
+  }
+
   String toString() => cRepresentation;
 }
 
-final intptr_t = CType(sizeOf<IntPtr>(), "intptr_t");
-final uintptr_t = CType(sizeOf<UintPtr>(), "uintptr_t");
-final int_ = CType(sizeOf<Int>(), "int");
-final uint = CType(sizeOf<UnsignedInt>(), "int", "unsigned");
-final long = CType(sizeOf<Long>(), "long");
-final ulong = CType(sizeOf<UnsignedLong>(), "long", "unsigned");
-final wchar_t = CType(sizeOf<WChar>(), "wchar_t");
-final size_t = CType(sizeOf<Size>(), "size_t");
-final ssize_t = CType(sizeOf<SSize>(), "ssize_t");
-final off_t = CType(sizeOf<Off>(), "off_t");
+final uchar = CType(
+  sizeOf<UnsignedChar>(),
+  'char',
+  modifier: 'unsigned',
+  ffiLoad: (Pointer p) => p.cast<UnsignedChar>().value,
+);
+final schar = CType(
+  sizeOf<SignedChar>(),
+  'char',
+  modifier: 'signed',
+  ffiLoad: (Pointer p) => p.cast<SignedChar>().value,
+);
+final short = CType(
+  sizeOf<Short>(),
+  'short',
+  ffiLoad: (Pointer p) => p.cast<Short>().value,
+);
+final ushort = CType(
+  sizeOf<UnsignedShort>(),
+  'short',
+  modifier: 'unsigned',
+  ffiLoad: (Pointer p) => p.cast<UnsignedShort>().value,
+);
+final int_ = CType(
+  sizeOf<Int>(),
+  'int',
+  ffiLoad: (Pointer p) => p.cast<Int>().value,
+);
+final uint = CType(
+  sizeOf<UnsignedInt>(),
+  'int',
+  modifier: 'unsigned',
+  ffiLoad: (Pointer p) => p.cast<UnsignedInt>().value,
+);
+final long = CType(
+  sizeOf<Long>(),
+  'long',
+);
+final ulong = CType(
+  sizeOf<UnsignedLong>(),
+  'long',
+  modifier: 'unsigned',
+);
+final longlong = CType(
+  sizeOf<LongLong>(),
+  'long',
+  type2: 'long',
+);
+final ulonglong = CType(
+  sizeOf<UnsignedLongLong>(),
+  'long',
+  type2: 'long',
+  modifier: 'unsigned',
+);
+final intptr_t = CType(
+  sizeOf<IntPtr>(),
+  'intptr_t',
+);
+final uintptr_t = CType(
+  sizeOf<UintPtr>(),
+  'uintptr_t',
+);
+final size_t = CType(
+  sizeOf<Size>(),
+  'size_t',
+);
+final wchar_t = CType(
+  sizeOf<WChar>(),
+  'wchar_t',
+  ffiLoad: (Pointer p) => p.cast<WChar>().value,
+);
 
 final cTypes = [
-  intptr_t,
-  uintptr_t,
+  uchar,
+  schar,
+  short,
+  ushort,
   int_,
   uint,
   long,
   ulong,
-  wchar_t,
+  longlong,
+  ulonglong,
+  intptr_t,
+  uintptr_t,
   size_t,
-  ssize_t,
-  off_t
+  wchar_t,
 ];
 
 void printSizes() {
   cTypes.forEach((element) {
-    print("${element.cRepresentation.padRight(20)}: ${element.size}");
+    final cName = element.cRepresentation.padRight(20);
+    final size = element.size;
+    final signed = element.isSigned ? 'signed' : 'unsigned';
+    print('$cName: $size $signed');
   });
 }
 
 void testSizes() {
   cTypes.forEach((element) {
+    print(element);
     Expect.equals(element.size, element.ffiSize);
+    final ffiIsSigned = element.ffiIsSigned;
+    if (ffiIsSigned != null) {
+      Expect.equals(element.isSigned, ffiIsSigned);
+    }
   });
 }
 
@@ -86,7 +180,6 @@
 
 void testSizeTAssumptions() {
   Expect.equals(intptr_t.size, size_t.size);
-  Expect.equals(intptr_t.size, ssize_t.size);
 }
 
 void testLongAssumptions() {
@@ -99,13 +192,9 @@
   }
 }
 
-void testOffTAssumptions() {
-  Expect.equals(long.size, off_t.size);
-}
-
 void testWCharTAssumptions() {
-  final bool isSigned = wCharMinValue() != 0;
-  print("wchar_t isSigned $isSigned");
+  final bool isSigned = wchar_t.isSigned;
+  print('wchar_t isSigned $isSigned');
   if (Platform.isWindows) {
     Expect.equals(2, wchar_t.size);
     if (isSigned) {
diff --git a/tests/ffi/function_callbacks_structs_by_value_generated_test.dart b/tests/ffi/function_callbacks_structs_by_value_generated_test.dart
index 2276d2f..2fbccd1 100644
--- a/tests/ffi/function_callbacks_structs_by_value_generated_test.dart
+++ b/tests/ffi/function_callbacks_structs_by_value_generated_test.dart
@@ -16,9 +16,6 @@
 import "package:expect/expect.dart";
 import "package:ffi/ffi.dart";
 
-// Reuse the AbiSpecificInts.
-import 'abi_specific_ints.dart';
-
 import 'callback_tests_utils.dart';
 
 import 'dylib_utils.dart';
diff --git a/tests/ffi/function_structs_by_value_generated_compounds.dart b/tests/ffi/function_structs_by_value_generated_compounds.dart
index 439e9a34..666ef20 100644
--- a/tests/ffi/function_structs_by_value_generated_compounds.dart
+++ b/tests/ffi/function_structs_by_value_generated_compounds.dart
@@ -7,9 +7,6 @@
 
 import 'dart:ffi';
 
-// Reuse the AbiSpecificInts.
-import 'abi_specific_ints.dart';
-
 class Struct1ByteBool extends Struct {
   @Bool()
   external bool a0;
diff --git a/tests/ffi/function_structs_by_value_generated_leaf_test.dart b/tests/ffi/function_structs_by_value_generated_leaf_test.dart
index 283faad..7704417 100644
--- a/tests/ffi/function_structs_by_value_generated_leaf_test.dart
+++ b/tests/ffi/function_structs_by_value_generated_leaf_test.dart
@@ -16,9 +16,6 @@
 import "package:expect/expect.dart";
 import "package:ffi/ffi.dart";
 
-// Reuse the AbiSpecificInts.
-import 'abi_specific_ints.dart';
-
 import 'dylib_utils.dart';
 
 // Reuse the compound classes.
diff --git a/tests/ffi/function_structs_by_value_generated_test.dart b/tests/ffi/function_structs_by_value_generated_test.dart
index 1f4c5d3..897472c 100644
--- a/tests/ffi/function_structs_by_value_generated_test.dart
+++ b/tests/ffi/function_structs_by_value_generated_test.dart
@@ -16,9 +16,6 @@
 import "package:expect/expect.dart";
 import "package:ffi/ffi.dart";
 
-// Reuse the AbiSpecificInts.
-import 'abi_specific_ints.dart';
-
 import 'dylib_utils.dart';
 
 // Reuse the compound classes.
diff --git a/tests/ffi/generator/structs_by_value_tests_generator.dart b/tests/ffi/generator/structs_by_value_tests_generator.dart
index 4c260b9..3a18095 100644
--- a/tests/ffi/generator/structs_by_value_tests_generator.dart
+++ b/tests/ffi/generator/structs_by_value_tests_generator.dart
@@ -922,8 +922,6 @@
 
 import 'dart:ffi';
 
-// Reuse the AbiSpecificInts.
-import 'abi_specific_ints.dart';
 """;
 }
 
@@ -967,8 +965,6 @@
 import "package:expect/expect.dart";
 import "package:ffi/ffi.dart";
 
-// Reuse the AbiSpecificInts.
-import 'abi_specific_ints.dart';
 
 import 'dylib_utils.dart';
 
@@ -1029,8 +1025,6 @@
 import "package:expect/expect.dart";
 import "package:ffi/ffi.dart";
 
-// Reuse the AbiSpecificInts.
-import 'abi_specific_ints.dart';
 
 import 'callback_tests_utils.dart';
 
diff --git a/tests/ffi_2/abi_specific_int_test.dart b/tests/ffi_2/abi_specific_int_test.dart
index 152c159..57daa3f 100644
--- a/tests/ffi_2/abi_specific_int_test.dart
+++ b/tests/ffi_2/abi_specific_int_test.dart
@@ -10,8 +10,6 @@
 import 'package:expect/expect.dart';
 import 'package:ffi/ffi.dart';
 
-import 'abi_specific_ints.dart';
-
 void main() {
   testSizeOf();
   testStoreLoad();
diff --git a/tests/ffi_2/abi_specific_ints.dart b/tests/ffi_2/abi_specific_ints.dart
deleted file mode 100644
index c1d8302..0000000
--- a/tests/ffi_2/abi_specific_ints.dart
+++ /dev/null
@@ -1,132 +0,0 @@
-// Copyright (c) 2021, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// @dart = 2.9
-
-import 'dart:ffi';
-
-// TODO(dacoharkes): These should move to `package:ffi`.
-
-/// Represents a native unsigned pointer-sized integer in C.
-///
-/// [UintPtr] is not constructible in the Dart code and serves purely as marker in
-/// type signatures.
-@AbiSpecificIntegerMapping({
-  Abi.androidArm: Uint32(),
-  Abi.androidArm64: Uint64(),
-  Abi.androidIA32: Uint32(),
-  Abi.androidX64: Uint64(),
-  Abi.fuchsiaArm64: Uint64(),
-  Abi.fuchsiaX64: Uint64(),
-  Abi.iosArm: Uint32(),
-  Abi.iosArm64: Uint64(),
-  Abi.iosX64: Uint64(),
-  Abi.linuxArm: Uint32(),
-  Abi.linuxArm64: Uint64(),
-  Abi.linuxIA32: Uint32(),
-  Abi.linuxX64: Uint64(),
-  Abi.linuxRiscv32: Uint32(),
-  Abi.linuxRiscv64: Uint64(),
-  Abi.macosArm64: Uint64(),
-  Abi.macosX64: Uint64(),
-  Abi.windowsArm64: Uint64(),
-  Abi.windowsIA32: Uint32(),
-  Abi.windowsX64: Uint64(),
-})
-class UintPtr extends AbiSpecificInteger {
-  const UintPtr();
-}
-
-/// `long` in C.
-///
-/// [Long] is not constructible in the Dart code and serves purely as marker in
-/// type signatures.
-@AbiSpecificIntegerMapping({
-  Abi.androidArm: Int32(),
-  Abi.androidArm64: Int64(),
-  Abi.androidIA32: Int32(),
-  Abi.androidX64: Int64(),
-  Abi.fuchsiaArm64: Int64(),
-  Abi.fuchsiaX64: Int64(),
-  Abi.iosArm: Int32(),
-  Abi.iosArm64: Int64(),
-  Abi.iosX64: Int64(),
-  Abi.linuxArm: Int32(),
-  Abi.linuxArm64: Int64(),
-  Abi.linuxIA32: Int32(),
-  Abi.linuxX64: Int64(),
-  Abi.linuxRiscv32: Int32(),
-  Abi.linuxRiscv64: Int64(),
-  Abi.macosArm64: Int64(),
-  Abi.macosX64: Int64(),
-  Abi.windowsArm64: Int32(),
-  Abi.windowsIA32: Int32(),
-  Abi.windowsX64: Int32(),
-})
-class Long extends AbiSpecificInteger {
-  const Long();
-}
-
-/// `unsigned long` in C.
-///
-/// [UnsignedLong] is not constructible in the Dart code and serves purely as marker in
-/// type signatures.
-@AbiSpecificIntegerMapping({
-  Abi.androidArm: Uint32(),
-  Abi.androidArm64: Uint64(),
-  Abi.androidIA32: Uint32(),
-  Abi.androidX64: Uint64(),
-  Abi.fuchsiaArm64: Uint64(),
-  Abi.fuchsiaX64: Uint64(),
-  Abi.iosArm: Uint32(),
-  Abi.iosArm64: Uint64(),
-  Abi.iosX64: Uint64(),
-  Abi.linuxArm: Uint32(),
-  Abi.linuxArm64: Uint64(),
-  Abi.linuxIA32: Uint32(),
-  Abi.linuxX64: Uint64(),
-  Abi.linuxRiscv32: Uint32(),
-  Abi.linuxRiscv64: Uint64(),
-  Abi.macosArm64: Uint64(),
-  Abi.macosX64: Uint64(),
-  Abi.windowsArm64: Uint32(),
-  Abi.windowsIA32: Uint32(),
-  Abi.windowsX64: Uint32(),
-})
-class UnsignedLong extends AbiSpecificInteger {
-  const UnsignedLong();
-}
-
-/// `wchar_t` in C.
-///
-/// The signedness of `wchar_t` is undefined in C. Here, it is exposed as an
-/// unsigned integer.
-///
-/// [WChar] is not constructible in the Dart code and serves purely as marker in
-/// type signatures.
-@AbiSpecificIntegerMapping({
-  Abi.androidArm: Uint32(),
-  Abi.androidArm64: Uint32(),
-  Abi.androidIA32: Uint32(),
-  Abi.androidX64: Uint32(),
-  Abi.fuchsiaArm64: Uint32(),
-  Abi.fuchsiaX64: Uint32(),
-  Abi.iosArm: Uint32(),
-  Abi.iosArm64: Uint32(),
-  Abi.iosX64: Uint32(),
-  Abi.linuxArm: Uint32(),
-  Abi.linuxArm64: Uint32(),
-  Abi.linuxIA32: Uint32(),
-  Abi.linuxX64: Uint32(),
-  Abi.linuxRiscv32: Uint32(),
-  Abi.linuxRiscv64: Uint32(),
-  Abi.macosArm64: Uint32(),
-  Abi.macosX64: Uint32(),
-  Abi.windowsArm64: Uint16(),
-  Abi.windowsIA32: Uint16(),
-  Abi.windowsX64: Uint16(),
-})
-class WChar extends AbiSpecificInteger {
-  const WChar();
-}
diff --git a/tests/ffi_2/c_types_test.dart b/tests/ffi_2/c_types_test.dart
index fa762bd..032853c 100644
--- a/tests/ffi_2/c_types_test.dart
+++ b/tests/ffi_2/c_types_test.dart
@@ -9,65 +9,181 @@
 // @dart = 2.9
 
 import 'dart:ffi';
-
-import "package:expect/expect.dart";
 import 'dart:io' show Platform;
 
-import 'abi_specific_ints.dart';
+import 'package:expect/expect.dart';
+import 'package:ffi/ffi.dart';
+
 import 'ffi_test_helpers.dart';
 
 void main() {
   printSizes();
   testSizes();
+  testIntAssumptions();
+  testSizeTAssumptions();
   testLongAssumptions();
   testWCharTAssumptions();
 }
 
 class CType {
   final int ffiSize;
+  final int Function(Pointer) ffiLoad;
   final String modifier;
   final String type;
+  final String type2;
 
-  CType(this.ffiSize, this.type, [this.modifier = ""]);
+  CType(this.ffiSize, this.type,
+      {this.type2 = '', this.modifier = '', this.ffiLoad});
 
-  String get cRepresentation => "$modifier $type".trim();
+  String get cRepresentation => '$modifier $type $type2'.trim();
 
-  String get _getSizeName => "FfiSizeOf_$modifier\_$type";
+  String get _getSizeName => 'FfiSizeOf_$modifier\_$type\_$type2';
+
+  String get _getSignName => 'FfiSignOf_$modifier\_$type\_$type2';
 
   int Function() get sizeFunction => ffiTestFunctions
       .lookupFunction<Uint64 Function(), int Function()>(_getSizeName);
 
+  int Function() get signFunction => ffiTestFunctions
+      .lookupFunction<Uint64 Function(), int Function()>(_getSignName);
+
   int get size => sizeFunction();
 
+  bool get isSigned => signFunction() != 0;
+
+  bool get ffiIsSigned {
+    final ffiLoad_ = ffiLoad;
+    if (ffiLoad_ == null) {
+      return null;
+    }
+    assert(size < 8);
+    return using((Arena arena) {
+      final p = arena<Int64>()..value = -1;
+      return ffiLoad_(p) < 0;
+    });
+  }
+
   String toString() => cRepresentation;
 }
 
-final intptr_t = CType(sizeOf<IntPtr>(), "intptr_t");
-final uintptr_t = CType(sizeOf<UintPtr>(), "uintptr_t");
-final long = CType(sizeOf<Long>(), "long");
-final ulong = CType(sizeOf<UnsignedLong>(), "long", "unsigned");
-final wchar_t = CType(sizeOf<WChar>(), "wchar_t");
+final uchar = CType(
+  sizeOf<UnsignedChar>(),
+  'char',
+  modifier: 'unsigned',
+  ffiLoad: (Pointer p) => p.cast<UnsignedChar>().value,
+);
+final schar = CType(
+  sizeOf<SignedChar>(),
+  'char',
+  modifier: 'signed',
+  ffiLoad: (Pointer p) => p.cast<SignedChar>().value,
+);
+final short = CType(
+  sizeOf<Short>(),
+  'short',
+  ffiLoad: (Pointer p) => p.cast<Short>().value,
+);
+final ushort = CType(
+  sizeOf<UnsignedShort>(),
+  'short',
+  modifier: 'unsigned',
+  ffiLoad: (Pointer p) => p.cast<UnsignedShort>().value,
+);
+final int_ = CType(
+  sizeOf<Int>(),
+  'int',
+  ffiLoad: (Pointer p) => p.cast<Int>().value,
+);
+final uint = CType(
+  sizeOf<UnsignedInt>(),
+  'int',
+  modifier: 'unsigned',
+  ffiLoad: (Pointer p) => p.cast<UnsignedInt>().value,
+);
+final long = CType(
+  sizeOf<Long>(),
+  'long',
+);
+final ulong = CType(
+  sizeOf<UnsignedLong>(),
+  'long',
+  modifier: 'unsigned',
+);
+final longlong = CType(
+  sizeOf<LongLong>(),
+  'long',
+  type2: 'long',
+);
+final ulonglong = CType(
+  sizeOf<UnsignedLongLong>(),
+  'long',
+  type2: 'long',
+  modifier: 'unsigned',
+);
+final intptr_t = CType(
+  sizeOf<IntPtr>(),
+  'intptr_t',
+);
+final uintptr_t = CType(
+  sizeOf<UintPtr>(),
+  'uintptr_t',
+);
+final size_t = CType(
+  sizeOf<Size>(),
+  'size_t',
+);
+final wchar_t = CType(
+  sizeOf<WChar>(),
+  'wchar_t',
+  ffiLoad: (Pointer p) => p.cast<WChar>().value,
+);
 
 final cTypes = [
-  intptr_t,
-  uintptr_t,
+  uchar,
+  schar,
+  short,
+  ushort,
+  int_,
+  uint,
   long,
   ulong,
+  longlong,
+  ulonglong,
+  intptr_t,
+  uintptr_t,
+  size_t,
   wchar_t,
 ];
 
 void printSizes() {
   cTypes.forEach((element) {
-    print("${element.cRepresentation.padRight(20)}: ${element.size}");
+    final cName = element.cRepresentation.padRight(20);
+    final size = element.size;
+    final signed = element.isSigned ? 'signed' : 'unsigned';
+    print('$cName: $size $signed');
   });
 }
 
 void testSizes() {
   cTypes.forEach((element) {
+    print(element);
     Expect.equals(element.size, element.ffiSize);
+    final ffiIsSigned = element.ffiIsSigned;
+    if (ffiIsSigned != null) {
+      Expect.equals(element.isSigned, ffiIsSigned);
+    }
   });
 }
 
+void testIntAssumptions() {
+  Expect.equals(4, int_.size);
+  Expect.equals(4, uint.size);
+}
+
+void testSizeTAssumptions() {
+  Expect.equals(intptr_t.size, size_t.size);
+}
+
 void testLongAssumptions() {
   if (Platform.isWindows) {
     Expect.equals(4, long.size);
@@ -79,8 +195,8 @@
 }
 
 void testWCharTAssumptions() {
-  final bool isSigned = wCharMinValue() != 0;
-  print("wchar_t isSigned $isSigned");
+  final bool isSigned = wchar_t.isSigned;
+  print('wchar_t isSigned $isSigned');
   if (Platform.isWindows) {
     Expect.equals(2, wchar_t.size);
     if (isSigned) {
diff --git a/tests/ffi_2/function_callbacks_structs_by_value_generated_test.dart b/tests/ffi_2/function_callbacks_structs_by_value_generated_test.dart
index f4100fb..b890cbc 100644
--- a/tests/ffi_2/function_callbacks_structs_by_value_generated_test.dart
+++ b/tests/ffi_2/function_callbacks_structs_by_value_generated_test.dart
@@ -18,9 +18,6 @@
 import "package:expect/expect.dart";
 import "package:ffi/ffi.dart";
 
-// Reuse the AbiSpecificInts.
-import 'abi_specific_ints.dart';
-
 import 'callback_tests_utils.dart';
 
 import 'dylib_utils.dart';
diff --git a/tests/ffi_2/function_structs_by_value_generated_compounds.dart b/tests/ffi_2/function_structs_by_value_generated_compounds.dart
index 6908177..cd3fdf1 100644
--- a/tests/ffi_2/function_structs_by_value_generated_compounds.dart
+++ b/tests/ffi_2/function_structs_by_value_generated_compounds.dart
@@ -9,9 +9,6 @@
 
 import 'dart:ffi';
 
-// Reuse the AbiSpecificInts.
-import 'abi_specific_ints.dart';
-
 class Struct1ByteBool extends Struct {
   @Bool()
   bool a0;
diff --git a/tests/ffi_2/function_structs_by_value_generated_leaf_test.dart b/tests/ffi_2/function_structs_by_value_generated_leaf_test.dart
index 7c64296..8c01056 100644
--- a/tests/ffi_2/function_structs_by_value_generated_leaf_test.dart
+++ b/tests/ffi_2/function_structs_by_value_generated_leaf_test.dart
@@ -18,9 +18,6 @@
 import "package:expect/expect.dart";
 import "package:ffi/ffi.dart";
 
-// Reuse the AbiSpecificInts.
-import 'abi_specific_ints.dart';
-
 import 'dylib_utils.dart';
 
 // Reuse the compound classes.
diff --git a/tests/ffi_2/function_structs_by_value_generated_test.dart b/tests/ffi_2/function_structs_by_value_generated_test.dart
index ef24ad2..6329287 100644
--- a/tests/ffi_2/function_structs_by_value_generated_test.dart
+++ b/tests/ffi_2/function_structs_by_value_generated_test.dart
@@ -18,9 +18,6 @@
 import "package:expect/expect.dart";
 import "package:ffi/ffi.dart";
 
-// Reuse the AbiSpecificInts.
-import 'abi_specific_ints.dart';
-
 import 'dylib_utils.dart';
 
 // Reuse the compound classes.
diff --git a/tests/standalone/io/http_redirect_test.dart b/tests/standalone/io/http_redirect_test.dart
index f68e32f..1a19222 100644
--- a/tests/standalone/io/http_redirect_test.dart
+++ b/tests/standalone/io/http_redirect_test.dart
@@ -7,7 +7,7 @@
 import "dart:async";
 import "dart:io";
 
-Future<HttpServer> setupServer() {
+Future<HttpServer> setupServer({Uri? targetServer}) {
   final completer = new Completer<HttpServer>();
   HttpServer.bind("127.0.0.1", 0).then((server) {
     var handlers = new Map<String, Function>();
@@ -128,6 +128,8 @@
     // Setup redirect checking headers.
     addRequestHandler("/src", (HttpRequest request, HttpResponse response) {
       Expect.equals("value", request.headers.value("X-Request-Header"));
+      Expect.isNotNull(request.headers.value("Authorization"),
+          "expected 'Authorization' header to be set");
       response.headers.set(
           HttpHeaders.locationHeader, "http://127.0.0.1:${server.port}/target");
       response.statusCode = HttpStatus.movedPermanently;
@@ -135,9 +137,24 @@
     });
     addRequestHandler("/target", (HttpRequest request, HttpResponse response) {
       Expect.equals("value", request.headers.value("X-Request-Header"));
+      Expect.isNotNull(request.headers.value("Authorization"),
+          "expected 'Authorization' header to be set");
       response.close();
     });
 
+    if (targetServer != null) {
+      addRequestHandler("/src-crossdomain",
+          (HttpRequest request, HttpResponse response) {
+        Expect.equals("value", request.headers.value("X-Request-Header"));
+        Expect.isNotNull(request.headers.value("Authorization"),
+            "expected 'Authorization' header to be set");
+        response.headers
+            .set(HttpHeaders.locationHeader, targetServer.toString());
+        response.statusCode = HttpStatus.movedPermanently;
+        response.close();
+      });
+    }
+
     // Setup redirect for 301 where POST should not redirect.
     addRequestHandler("/301src", (HttpRequest request, HttpResponse response) {
       Expect.equals("POST", request.method);
@@ -183,6 +200,36 @@
   return completer.future;
 }
 
+// A second HTTP server used to validate that redirect requests accross domains
+// do *not* include security-related headers.
+Future<HttpServer> setupTargetServer() {
+  final completer = new Completer<HttpServer>();
+  HttpServer.bind("127.0.0.1", 0).then((server) {
+    var handlers = new Map<String, Function>();
+    addRequestHandler(
+        String path, void handler(HttpRequest request, HttpResponse response)) {
+      handlers[path] = handler;
+    }
+
+    server.listen((HttpRequest request) {
+      if (request.uri.path == "/target") {
+        Expect.equals("value", request.headers.value("X-Request-Header"));
+        Expect.isNull(request.headers.value("Authorization"),
+            "expected 'Authorization' header to be removed on redirect");
+        request.response.close();
+      } else {
+        request.listen((_) {}, onDone: () {
+          request.response.statusCode = 404;
+          request.response.close();
+        });
+      }
+    });
+
+    completer.complete(server);
+  });
+  return completer.future;
+}
+
 void checkRedirects(int redirectCount, HttpClientResponse response) {
   if (redirectCount < 2) {
     Expect.isTrue(response.redirects.isEmpty);
@@ -250,6 +297,7 @@
         .then((HttpClientRequest request) {
       request.followRedirects = false;
       request.headers.add("X-Request-Header", "value");
+      request.headers.add("Authorization", "Basic ...");
       return request.close();
     }).then(handleResponse);
   });
@@ -282,6 +330,7 @@
         .getUrl(Uri.parse("http://127.0.0.1:${server.port}/src"))
         .then((HttpClientRequest request) {
       request.headers.add("X-Request-Header", "value");
+      request.headers.add("Authorization", "Basic ...");
       return request.close();
     }).then((HttpClientResponse response) {
       response.listen((_) => Expect.fail("Response data not expected"),
@@ -294,6 +343,33 @@
   });
 }
 
+void testCrossDomainAutoRedirectWithHeaders() {
+  setupTargetServer().then((targetServer) {
+    setupServer(
+            targetServer:
+                Uri.parse("http://127.0.0.1:${targetServer.port}/target"))
+        .then((server) {
+      HttpClient client = new HttpClient();
+
+      client
+          .getUrl(Uri.parse("http://127.0.0.1:${server.port}/src-crossdomain"))
+          .then((HttpClientRequest request) {
+        request.headers.add("X-Request-Header", "value");
+        request.headers.add("Authorization", "Basic ...");
+        return request.close();
+      }).then((HttpClientResponse response) {
+        response.listen((_) => Expect.fail("Response data not expected"),
+            onDone: () {
+          Expect.equals(1, response.redirects.length);
+          targetServer.close();
+          server.close();
+          client.close();
+        });
+      });
+    });
+  });
+}
+
 void testAutoRedirect301POST() {
   setupServer().then((server) {
     HttpClient client = new HttpClient();
@@ -441,6 +517,7 @@
   testManualRedirectWithHeaders();
   testAutoRedirect();
   testAutoRedirectWithHeaders();
+  testCrossDomainAutoRedirectWithHeaders();
   testAutoRedirect301POST();
   testAutoRedirect303POST();
   testAutoRedirectLimit();
diff --git a/tests/standalone_2/io/http_redirect_test.dart b/tests/standalone_2/io/http_redirect_test.dart
index e168b11..e851045 100644
--- a/tests/standalone_2/io/http_redirect_test.dart
+++ b/tests/standalone_2/io/http_redirect_test.dart
@@ -9,7 +9,7 @@
 import "dart:async";
 import "dart:io";
 
-Future<HttpServer> setupServer() {
+Future<HttpServer> setupServer({Uri targetServer}) {
   Completer completer = new Completer<HttpServer>();
   HttpServer.bind("127.0.0.1", 0).then((server) {
     var handlers = new Map<String, Function>();
@@ -130,6 +130,8 @@
     // Setup redirect checking headers.
     addRequestHandler("/src", (HttpRequest request, HttpResponse response) {
       Expect.equals("value", request.headers.value("X-Request-Header"));
+      Expect.isNotNull(request.headers.value("Authorization"),
+          "expected 'Authorization' header to be set");
       response.headers.set(
           HttpHeaders.locationHeader, "http://127.0.0.1:${server.port}/target");
       response.statusCode = HttpStatus.movedPermanently;
@@ -137,9 +139,24 @@
     });
     addRequestHandler("/target", (HttpRequest request, HttpResponse response) {
       Expect.equals("value", request.headers.value("X-Request-Header"));
+      Expect.isNotNull(request.headers.value("Authorization"),
+          "expected 'Authorization' header to be set");
       response.close();
     });
 
+    if (targetServer != null) {
+      addRequestHandler("/src-crossdomain",
+          (HttpRequest request, HttpResponse response) {
+        Expect.equals("value", request.headers.value("X-Request-Header"));
+        Expect.isNotNull(request.headers.value("Authorization"),
+            "expected 'Authorization' header to be set");
+        response.headers
+            .set(HttpHeaders.locationHeader, targetServer.toString());
+        response.statusCode = HttpStatus.movedPermanently;
+        response.close();
+      });
+    }
+
     // Setup redirect for 301 where POST should not redirect.
     addRequestHandler("/301src", (HttpRequest request, HttpResponse response) {
       Expect.equals("POST", request.method);
@@ -185,6 +202,36 @@
   return completer.future;
 }
 
+// A second HTTP server used to validate that redirect requests accross domains
+// do *not* include security-related headers.
+Future<HttpServer> setupTargetServer() {
+  Completer completer = new Completer<HttpServer>();
+  HttpServer.bind("127.0.0.1", 0).then((server) {
+    var handlers = new Map<String, Function>();
+    addRequestHandler(
+        String path, void handler(HttpRequest request, HttpResponse response)) {
+      handlers[path] = handler;
+    }
+
+    server.listen((HttpRequest request) {
+      if (request.uri.path == "/target") {
+        Expect.equals("value", request.headers.value("X-Request-Header"));
+        Expect.isNull(request.headers.value("Authorization"),
+            "expected 'Authorization' header to be removed on redirect");
+        request.response.close();
+      } else {
+        request.listen((_) {}, onDone: () {
+          request.response.statusCode = 404;
+          request.response.close();
+        });
+      }
+    });
+
+    completer.complete(server);
+  });
+  return completer.future;
+}
+
 void checkRedirects(int redirectCount, HttpClientResponse response) {
   if (redirectCount < 2) {
     Expect.isTrue(response.redirects.isEmpty);
@@ -252,6 +299,7 @@
         .then((HttpClientRequest request) {
       request.followRedirects = false;
       request.headers.add("X-Request-Header", "value");
+      request.headers.add("Authorization", "Basic ...");
       return request.close();
     }).then(handleResponse);
   });
@@ -284,6 +332,7 @@
         .getUrl(Uri.parse("http://127.0.0.1:${server.port}/src"))
         .then((HttpClientRequest request) {
       request.headers.add("X-Request-Header", "value");
+      request.headers.add("Authorization", "Basic ...");
       return request.close();
     }).then((HttpClientResponse response) {
       response.listen((_) => Expect.fail("Response data not expected"),
@@ -296,6 +345,33 @@
   });
 }
 
+void testCrossDomainAutoRedirectWithHeaders() {
+  setupTargetServer().then((targetServer) {
+    setupServer(
+            targetServer:
+                Uri.parse("http://127.0.0.1:${targetServer.port}/target"))
+        .then((server) {
+      HttpClient client = new HttpClient();
+
+      client
+          .getUrl(Uri.parse("http://127.0.0.1:${server.port}/src-crossdomain"))
+          .then((HttpClientRequest request) {
+        request.headers.add("X-Request-Header", "value");
+        request.headers.add("Authorization", "Basic ...");
+        return request.close();
+      }).then((HttpClientResponse response) {
+        response.listen((_) => Expect.fail("Response data not expected"),
+            onDone: () {
+          Expect.equals(1, response.redirects.length);
+          targetServer.close();
+          server.close();
+          client.close();
+        });
+      });
+    });
+  });
+}
+
 void testAutoRedirect301POST() {
   setupServer().then((server) {
     HttpClient client = new HttpClient();
@@ -443,6 +519,7 @@
   testManualRedirectWithHeaders();
   testAutoRedirect();
   testAutoRedirectWithHeaders();
+  testCrossDomainAutoRedirectWithHeaders();
   testAutoRedirect301POST();
   testAutoRedirect303POST();
   testAutoRedirectLimit();
diff --git a/tools/VERSION b/tools/VERSION
index fd91618..3987f2f 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
 MAJOR 2
 MINOR 17
 PATCH 0
-PRERELEASE 66
+PRERELEASE 67
 PRERELEASE_PATCH 0
\ No newline at end of file
diff --git a/tools/bots/test_matrix.json b/tools/bots/test_matrix.json
index d638c36..1d376fe 100644
--- a/tools/bots/test_matrix.json
+++ b/tools/bots/test_matrix.json
@@ -3574,10 +3574,12 @@
         },
         {
           "name": "validate SDK API docs",
-          "script": "out/ReleaseX64/dart-sdk/bin/dartdoc",
+          "script": "out/ReleaseX64/dart-sdk/bin/dart",
           "arguments": [
+            "doc",
             "--sdk-docs",
-            "--no-generate-docs"
+            "--dry-run",
+            "--verbose"
           ]
         },
         {
@@ -4006,7 +4008,8 @@
             "--platform=out/ReleaseX64/vm_platform_strong.dill",
             "--no-aot",
             "--no-sound-null-safety",
-            "-o", "runtime/tests/concurrency/generated_stress_test.dart.jit.dill",
+            "-o",
+            "runtime/tests/concurrency/generated_stress_test.dart.jit.dill",
             "runtime/tests/concurrency/generated_stress_test.dart"
           ]
         },
@@ -4017,7 +4020,8 @@
             "pkg/vm/bin/gen_kernel.dart",
             "--platform=out/ReleaseX64/vm_platform_strong.dill",
             "--no-aot",
-            "-o", "runtime/tests/concurrency/generated_stress_test_nnbd.dart.jit.dill",
+            "-o",
+            "runtime/tests/concurrency/generated_stress_test_nnbd.dart.jit.dill",
             "runtime/tests/concurrency/generated_stress_test_nnbd.dart"
           ]
         },
@@ -4029,7 +4033,8 @@
             "--platform=out/ReleaseX64/vm_platform_strong.dill",
             "--aot",
             "--no-sound-null-safety",
-            "-o", "runtime/tests/concurrency/generated_stress_test.dart.aot.dill",
+            "-o",
+            "runtime/tests/concurrency/generated_stress_test.dart.aot.dill",
             "runtime/tests/concurrency/generated_stress_test.dart"
           ]
         },
@@ -4040,7 +4045,8 @@
             "pkg/vm/bin/gen_kernel.dart",
             "--platform=out/ReleaseX64/vm_platform_strong.dill",
             "--aot",
-            "-o", "runtime/tests/concurrency/generated_stress_test_nnbd.dart.aot.dill",
+            "-o",
+            "runtime/tests/concurrency/generated_stress_test_nnbd.dart.aot.dill",
             "runtime/tests/concurrency/generated_stress_test_nnbd.dart"
           ]
         },
@@ -4166,4 +4172,4 @@
     "macos": "buildtools/mac-x64/clang/bin/llvm-symbolizer",
     "windows": "buildtools/win-x64/clang/bin/llvm-symbolizer.exe"
   }
-}
+}
\ No newline at end of file
diff --git a/utils/dartdev/BUILD.gn b/utils/dartdev/BUILD.gn
index 3ce3bc3..e3818aa 100644
--- a/utils/dartdev/BUILD.gn
+++ b/utils/dartdev/BUILD.gn
@@ -25,6 +25,7 @@
   main_dart = "../../pkg/dartdev/bin/dartdev.dart"
   training_args = []
   deps = [ "../dds:dds" ]
+  vm_args = [ "--sound-null-safety" ]
   output = "$root_gen_dir/dartdev.dill"
 }
 
@@ -39,6 +40,7 @@
   main_dart = "../../pkg/dartdev/bin/dartdev.dart"
   training_args = [ "--help" ]
   deps = [ "../dds:dds" ]
+  vm_args = [ "--sound-null-safety" ]
   output = "$root_gen_dir/dartdev.dart.snapshot"
 }
 
diff --git a/utils/dartdoc/.gitignore b/utils/dartdoc/.gitignore
deleted file mode 100644
index ce5803f..0000000
--- a/utils/dartdoc/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/dartdoc.Makefile
-/dartdoc.target.mk
diff --git a/utils/dartdoc/BUILD.gn b/utils/dartdoc/BUILD.gn
deleted file mode 100644
index 0ba4fe2..0000000
--- a/utils/dartdoc/BUILD.gn
+++ /dev/null
@@ -1,10 +0,0 @@
-# Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
-# for details. All rights reserved. Use of this source code is governed by a
-# BSD-style license that can be found in the LICENSE file.
-
-import("../application_snapshot.gni")
-
-application_snapshot("dartdoc") {
-  main_dart = "../../third_party/pkg/dartdoc/bin/dartdoc.dart"
-  training_args = [ "--help" ]
-}