Version 3.12.0-67.0.dev

Merge 7c60da725ee97b1440bd34b2a47047532ec80571 into dev
diff --git a/DEPS b/DEPS
index 083714d..a663010 100644
--- a/DEPS
+++ b/DEPS
@@ -131,7 +131,7 @@
   #   and land the review.
   #
   # For more details, see https://github.com/dart-lang/sdk/issues/30164.
-  "dart_style_rev": "bdae98cead73a436920f890626aa81cf3f2f8904", # rolled manually
+  "dart_style_rev": "f624489a5013ec58de469d4fd8793c283f62b5d8", # rolled manually
 
   ### /third_party/pkg dependencies
   # 'tools/rev_sdk_deps.dart' will rev pkg dependencies to their latest; put an
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_class_to_enum.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_class_to_enum.dart
index f62c31f..58fdc2e 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/convert_class_to_enum.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_class_to_enum.dart
@@ -26,6 +26,19 @@
 
 typedef _Constructors = Map<ConstructorElement, _Constructor>;
 
+/// This correction producer converts a class to an enum, if possible, by making
+/// the following changes:
+///
+/// * changes the `class` keyword to `enum`,
+/// * removes the `const` keyword from the primary constructor, if there is one,
+/// * converts static fields into enum constant values,
+/// * removes an `int index` field if there is one,
+/// * removes any field formal parameters for the index field from all
+///   constructors,
+/// * removes all arguments for said index field formal parameters,
+/// * removes the singular constructor (primary, or in-body), if there is only
+///   one, and it no longer accepts any arguments (after removing a possible
+///   index parameter), and it has no doc comment nor annotations.
 class ConvertClassToEnum extends ResolvedCorrectionProducer {
   ConvertClassToEnum({required super.context});
 
@@ -160,6 +173,9 @@
   /// The indexes of members that need to be deleted.
   final List<int> membersToDelete = [];
 
+  /// The primary constructor, if it needs to be deleted.
+  PrimaryConstructorDeclaration? primaryConstructorToDelete;
+
   /// The indexes of primary constructor parameters that need to be deleted.
   final List<int> parametersToDelete = [];
 
@@ -287,6 +303,14 @@
     // Update the constructors.
     _transformConstructors(builder);
 
+    if (primaryConstructorToDelete case var primaryConstructor?) {
+      if (primaryConstructor.constructorName case var constuctorName?) {
+        builder.addDeletion(range.startEnd(constuctorName, primaryConstructor));
+      } else {
+        builder.addDeletion(range.node(primaryConstructor.formalParameters));
+      }
+    }
+
     // Special case replacing all of the members.
     if (membersToDelete.length == members.length) {
       builder.addSimpleReplacement(
@@ -390,7 +414,7 @@
           parameters.length - (parameterData == null ? 0 : 1);
       if (updatedParameterCount != 0) return null;
 
-      // TODO(srawlins): Mark `primaryConstructor` as "to be deleted."
+      primaryConstructorToDelete = primaryConstructor;
       return primaryConstructor;
     }
   }
diff --git a/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml b/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
index 1340e5c..dff3fc5 100644
--- a/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
+++ b/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
@@ -3065,10 +3065,6 @@
     Remove the `sync` keyword. Add a `*`.
 missing_statement:
   status: noFix
-missing_terminator_for_parameter_group:
-  status: needsFix
-  notes: |-
-    Add the missing terminator.
 missing_typedef_parameters:
   status: hasFix
 missing_variable_in_for_each:
@@ -3116,8 +3112,6 @@
   notes: |-
     Remove extra fields.
     Maybe wrap into a record.
-multiple_variables_in_for_each:
-  status: noFix
 multiple_variance_modifiers:
   status: noFix
 multiple_with_clauses:
@@ -3158,8 +3152,6 @@
     Remove the directive. Move the directive to the library.
 non_string_literal_as_uri:
   status: noFix
-non_user_definable_operator:
-  status: noFix
 normal_before_optional_parameters:
   status: needsFix
   notes: |-
@@ -3268,10 +3260,6 @@
   status: needsFix
   notes: |-
     Move the typedef to the top level.
-unexpected_terminator_for_parameter_group:
-  status: needsFix
-  notes: |-
-    Remove the terminator.
 unexpected_token:
   status: noFix
 unexpected_tokens:
@@ -3308,10 +3296,6 @@
   status: needsFix
 wrong_separator_for_positional_parameter:
   status: hasFix
-wrong_terminator_for_parameter_group:
-  status: needsFix
-  notes: |-
-    Replace the terminator with the correct terminator.
 asset_does_not_exist:
   status: noFix
   since: ~2.15
@@ -3390,8 +3374,6 @@
   status: noFix
 missing_quote:
   status: noFix
-unable_get_content:
-  status: noFix
 unexpected_dollar_in_string:
   status: noFix
 unexpected_separator_in_number:
diff --git a/pkg/analysis_server/test/services/refactoring/legacy/extract_widget_test.dart b/pkg/analysis_server/test/services/refactoring/legacy/extract_widget_test.dart
index 9edd42b..162ebb3 100644
--- a/pkg/analysis_server/test/services/refactoring/legacy/extract_widget_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/legacy/extract_widget_test.dart
@@ -371,7 +371,7 @@
 }
 
 class MyWidget extends StatelessWidget {
-  C c = C();
+  final C c = C();
 
   @override
   Widget build(BuildContext context) {
@@ -394,7 +394,7 @@
 }
 
 class MyWidget extends StatelessWidget {
-  C c = C();
+  final C c = C();
 
   @override
   Widget build(BuildContext context) {
@@ -476,7 +476,7 @@
 import 'package:flutter/material.dart';
 
 class MyWidget extends StatelessWidget {
-  String foo = '';
+  final String foo = '';
 
   @override
   Widget build(BuildContext context) {
@@ -504,7 +504,7 @@
 import 'package:flutter/material.dart';
 
 class MyWidget extends StatelessWidget {
-  String foo = '';
+  final String foo = '';
 
   @override
   Widget build(BuildContext context) {
@@ -720,7 +720,7 @@
 }
 
 class MyWidget extends StatelessWidget {
-  C c = C();
+  final C c = C();
 
   @override
   Widget build(BuildContext context) {
@@ -738,7 +738,7 @@
 }
 
 class MyWidget extends StatelessWidget {
-  C c = C();
+  final C c = C();
 
   @override
   Widget build(BuildContext context) {
@@ -806,6 +806,7 @@
     await indexTestUnit(r'''
 import 'package:flutter/material.dart';
 
+// ignore: must_be_immutable
 class MyWidget extends StatelessWidget {
   String field;
 
@@ -832,10 +833,12 @@
     await indexTestUnit(r'''
 import 'package:flutter/material.dart';
 
+// ignore: must_be_immutable
 abstract class MySuperWidget extends StatelessWidget {
   String field = '';
 }
 
+// ignore: must_be_immutable
 class MyWidget extends MySuperWidget {
   @override
   Widget build(BuildContext context) {
@@ -863,7 +866,7 @@
 }
 
 class MyWidget extends StatelessWidget {
-  C c = C();
+  final C c = C();
 
   @override
   Widget build(BuildContext context) {
@@ -886,7 +889,7 @@
 }
 
 class MyWidget extends StatelessWidget {
-  C c = C();
+  final C c = C();
 
   @override
   Widget build(BuildContext context) {
diff --git a/pkg/analysis_server/test/src/services/correction/assist/add_diagnostic_property_reference_test.dart b/pkg/analysis_server/test/src/services/correction/assist/add_diagnostic_property_reference_test.dart
index 29293e5..8c39868 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/add_diagnostic_property_reference_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/add_diagnostic_property_reference_test.dart
@@ -32,7 +32,7 @@
 import 'package:flutter/widgets.dart';
 
 class W extends Widget {
-  bool ^property = true;
+  final bool ^property = true;
   @override
   void debugFillProperties(DiagnosticPropertiesBuilder properties) {
     super.debugFillProperties(properties);
@@ -44,7 +44,7 @@
 import 'package:flutter/widgets.dart';
 
 class W extends Widget {
-  bool property = true;
+  final bool property = true;
   @override
   void debugFillProperties(DiagnosticPropertiesBuilder properties) {
     super.debugFillProperties(properties);
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_class_to_enum_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_class_to_enum_test.dart
index 06204e7..8f5672a 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_class_to_enum_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_class_to_enum_test.dart
@@ -272,12 +272,8 @@
 ''');
   }
 
-  @FailingTest(reason: 'To implement next.')
   Future<void>
   test_index_namedIndex_only_privateClass_primaryConstructor() async {
-    // TODO(srawlins): Test with primary constructor with non-declaring index
-    // parameter.
-    // TODO(srawlins): Test with private primary constructor on a public class.
     await resolveTestCode('''
 class const _^E(final int index) {
   static const _E c0 = _E(0);
@@ -292,6 +288,24 @@
 ''');
   }
 
+  Future<void>
+  test_index_namedIndex_only_privateClass_primaryConstructor_nonDeclaring() async {
+    await resolveTestCode('''
+class const _^E(this.index) {
+  static const _E c0 = _E(0);
+  static const _E c1 = _E(1);
+
+  final int index;
+}
+''');
+    await assertHasAssist('''
+enum _E {
+  c0,
+  c1
+}
+''');
+  }
+
   Future<void> test_index_namedIndex_only_publicClass() async {
     await resolveTestCode('''
 class ^E {
@@ -313,6 +327,22 @@
 ''');
   }
 
+  Future<void>
+  test_index_namedIndex_only_publicClass_primaryConstructor() async {
+    await resolveTestCode('''
+class const ^E._(final int index) {
+  static const E c0 = E._(0);
+  static const E c1 = E._(1);
+}
+''');
+    await assertHasAssist('''
+enum E._() {
+  c0._(),
+  c1._()
+}
+''');
+  }
+
   Future<void> test_index_notNamedIndex_privateClass() async {
     await resolveTestCode('''
 class _^E {
@@ -649,6 +679,59 @@
 ''');
   }
 
+  Future<void> test_minimal_privateClass_primaryConstructor() async {
+    await resolveTestCode('''
+class const _^E() {
+  static const _E c = _E();
+}
+''');
+    await assertHasAssist('''
+enum _E {
+  c
+}
+''');
+  }
+
+  Future<void>
+  test_minimal_privateClass_primaryConstructorHasAnnotation() async {
+    await resolveTestCode('''
+class const _^E() {
+  static const _E c = _E();
+
+  @deprecated
+  this;
+}
+''');
+    await assertHasAssist('''
+enum _E() {
+  c;
+
+  @deprecated
+  this;
+}
+''');
+  }
+
+  Future<void>
+  test_minimal_privateClass_primaryConstructorHasDocComment() async {
+    await resolveTestCode('''
+class const _^E() {
+  static const _E c = _E();
+
+  /// Doc comment.
+  this;
+}
+''');
+    await assertHasAssist('''
+enum _E() {
+  c;
+
+  /// Doc comment.
+  this;
+}
+''');
+  }
+
   Future<void> test_minimal_publicClass() async {
     await resolveTestCode('''
 class ^E {
diff --git a/pkg/analysis_server/test/src/services/correction/assist/flutter_convert_to_stateful_widget_test.dart b/pkg/analysis_server/test/src/services/correction/assist/flutter_convert_to_stateful_widget_test.dart
index 6424c58..eedd639 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/flutter_convert_to_stateful_widget_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/flutter_convert_to_stateful_widget_test.dart
@@ -175,6 +175,7 @@
     await resolveTestCode(r'''
 import 'package:flutter/material.dart';
 
+// ignore: must_be_immutable
 class ^MyWidget extends StatelessWidget {
   static String staticField1 = '';
   final String instanceField1;
@@ -210,6 +211,7 @@
     await assertHasAssist(r'''
 import 'package:flutter/material.dart';
 
+// ignore: must_be_immutable
 class MyWidget extends StatefulWidget {
   static String staticField1 = '';
   final String instanceField1;
@@ -316,7 +318,7 @@
 class ^MyWidget extends StatelessWidget {
   static String staticField = '';
   final String instanceField1;
-  String instanceField2 = '';
+  final String instanceField2 = '';
 
   MyWidget(this.instanceField1);
 
@@ -372,7 +374,7 @@
 }
 
 class _MyWidgetState extends State<MyWidget> {
-  String instanceField2 = '';
+  final String instanceField2 = '';
 
   @override
   Widget build(BuildContext context) {
diff --git a/pkg/analysis_server/test/src/services/correction/assist/flutter_convert_to_stateless_widget_test.dart b/pkg/analysis_server/test/src/services/correction/assist/flutter_convert_to_stateless_widget_test.dart
index dba8131..52b880d 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/flutter_convert_to_stateless_widget_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/flutter_convert_to_stateless_widget_test.dart
@@ -157,6 +157,7 @@
     await resolveTestCode(r'''
 import 'package:flutter/material.dart';
 
+// ignore: must_be_immutable
 class ^MyWidget extends StatefulWidget {
   static String staticField1 = '';
   final String instanceField1;
@@ -203,6 +204,7 @@
     await assertHasAssist(r'''
 import 'package:flutter/material.dart';
 
+// ignore: must_be_immutable
 class MyWidget extends StatelessWidget {
   static String staticField1 = '';
   final String instanceField1;
diff --git a/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_generic_test.dart b/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_generic_test.dart
index 5fd6617..f8e31b1 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_generic_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_generic_test.dart
@@ -203,7 +203,7 @@
 import 'package:flutter/widgets.dart';
 
 abstract class Foo extends Widget {
-  Widget bar = Text('');
+  final Widget bar = Text('');
 }
 
 Widget f(Foo foo) {
@@ -214,7 +214,7 @@
 import 'package:flutter/widgets.dart';
 
 abstract class Foo extends Widget {
-  Widget bar = Text('');
+  final Widget bar = Text('');
 }
 
 Widget f(Foo foo) {
@@ -228,7 +228,7 @@
 import 'package:flutter/widgets.dart';
 
 abstract class Foo extends Widget {
-  Widget bar = Text('');
+  final Widget bar = Text('');
 }
 
 Widget f(Foo foo) {
@@ -239,7 +239,7 @@
 import 'package:flutter/widgets.dart';
 
 abstract class Foo extends Widget {
-  Widget bar = Text('');
+  final Widget bar = Text('');
 }
 
 Widget f(Foo foo) {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_diagnostic_property_reference_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_diagnostic_property_reference_test.dart
index 5531d94..3fe341e 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_diagnostic_property_reference_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_diagnostic_property_reference_test.dart
@@ -179,8 +179,8 @@
 
 class C extends Widget with Diagnosticable {
   bool get absorbing => _absorbing;
-  bool _absorbing = false;
-  bool ignoringSemantics = false;
+  final bool _absorbing = false;
+  final bool ignoringSemantics = false;
   @override
   void debugFillProperties(DiagnosticPropertiesBuilder properties) {
     super.debugFillProperties(properties);
@@ -194,8 +194,8 @@
 
 class C extends Widget with Diagnosticable {
   bool get absorbing => _absorbing;
-  bool _absorbing = false;
-  bool ignoringSemantics = false;
+  final bool _absorbing = false;
+  final bool ignoringSemantics = false;
   @override
   void debugFillProperties(DiagnosticPropertiesBuilder properties) {
     super.debugFillProperties(properties);
@@ -212,7 +212,7 @@
 import 'package:flutter/widgets.dart';
 
 class C extends Widget with Diagnosticable {
-  bool ignoringSemantics = false;
+  final bool ignoringSemantics = false;
   @override
   void debugFillProperties(DiagnosticPropertiesBuilder properties) {
   }
@@ -223,7 +223,7 @@
 import 'package:flutter/widgets.dart';
 
 class C extends Widget with Diagnosticable {
-  bool ignoringSemantics = false;
+  final bool ignoringSemantics = false;
   @override
   void debugFillProperties(DiagnosticPropertiesBuilder properties) {
     properties.add(DiagnosticsProperty<bool>('ignoringSemantics', ignoringSemantics));
@@ -238,7 +238,7 @@
 import 'package:flutter/widgets.dart';
 
 class C extends Widget with Diagnosticable {
-  bool ignoringSemantics = false;
+  final bool ignoringSemantics = false;
   @override
   void debugFillProperties(DiagnosticPropertiesBuilder props) {
   }
@@ -249,7 +249,7 @@
 import 'package:flutter/widgets.dart';
 
 class C extends Widget with Diagnosticable {
-  bool ignoringSemantics = false;
+  final bool ignoringSemantics = false;
   @override
   void debugFillProperties(DiagnosticPropertiesBuilder props) {
     props.add(DiagnosticsProperty<bool>('ignoringSemantics', ignoringSemantics));
@@ -265,7 +265,7 @@
 
 class C extends Widget with Diagnosticable {
   bool get absorbing => _absorbing;
-  bool _absorbing = false;
+  final bool _absorbing = false;
   @override
   void debugFillProperties(DiagnosticPropertiesBuilder properties) {
     super.debugFillProperties(properties);
@@ -278,7 +278,7 @@
 
 class C extends Widget with Diagnosticable {
   bool get absorbing => _absorbing;
-  bool _absorbing = false;
+  final bool _absorbing = false;
   @override
   void debugFillProperties(DiagnosticPropertiesBuilder properties) {
     super.debugFillProperties(properties);
@@ -295,7 +295,7 @@
 import 'package:flutter/widgets.dart';
 
 class C extends Widget with Diagnosticable {
-  Color field = Color(0);
+  final Color field = Color(0);
   @override
   void debugFillProperties(DiagnosticPropertiesBuilder properties) {
     super.debugFillProperties(properties);
@@ -308,7 +308,7 @@
 import 'package:flutter/widgets.dart';
 
 class C extends Widget with Diagnosticable {
-  Color field = Color(0);
+  final Color field = Color(0);
   @override
   void debugFillProperties(DiagnosticPropertiesBuilder properties) {
     super.debugFillProperties(properties);
@@ -324,7 +324,7 @@
 import 'package:flutter/widgets.dart';
 
 class C extends Widget with Diagnosticable {
-  double field = 4.2;
+  final double field = 4.2;
   @override
   void debugFillProperties(DiagnosticPropertiesBuilder properties) {
     super.debugFillProperties(properties);
@@ -336,7 +336,7 @@
 import 'package:flutter/widgets.dart';
 
 class C extends Widget with Diagnosticable {
-  double field = 4.2;
+  final double field = 4.2;
   @override
   void debugFillProperties(DiagnosticPropertiesBuilder properties) {
     super.debugFillProperties(properties);
@@ -352,7 +352,7 @@
 import 'package:flutter/widgets.dart';
 
 class C extends Widget with Diagnosticable {
-  dynamic field;
+  final dynamic field = 7;
   @override
   void debugFillProperties(DiagnosticPropertiesBuilder properties) {
     super.debugFillProperties(properties);
@@ -364,7 +364,7 @@
 import 'package:flutter/widgets.dart';
 
 class C extends Widget with Diagnosticable {
-  dynamic field;
+  final dynamic field = 7;
   @override
   void debugFillProperties(DiagnosticPropertiesBuilder properties) {
     super.debugFillProperties(properties);
@@ -380,7 +380,7 @@
 import 'package:flutter/widgets.dart';
 
 class C extends Widget with Diagnosticable {
-  Foo field = Foo.bar;
+  final Foo field = Foo.bar;
   @override
   void debugFillProperties(DiagnosticPropertiesBuilder properties) {
     super.debugFillProperties(properties);
@@ -393,7 +393,7 @@
 import 'package:flutter/widgets.dart';
 
 class C extends Widget with Diagnosticable {
-  Foo field = Foo.bar;
+  final Foo field = Foo.bar;
   @override
   void debugFillProperties(DiagnosticPropertiesBuilder properties) {
     super.debugFillProperties(properties);
@@ -411,7 +411,7 @@
 import 'package:flutter/widgets.dart';
 
 class C extends Widget with Diagnosticable {
-  ValueChanged<double> onChanged = (d) {};
+  final ValueChanged<double> onChanged = (d) {};
   @override
   void debugFillProperties(DiagnosticPropertiesBuilder properties) {
     super.debugFillProperties(properties);
@@ -425,7 +425,7 @@
 import 'package:flutter/widgets.dart';
 
 class C extends Widget with Diagnosticable {
-  ValueChanged<double> onChanged = (d) {};
+  final ValueChanged<double> onChanged = (d) {};
   @override
   void debugFillProperties(DiagnosticPropertiesBuilder properties) {
     super.debugFillProperties(properties);
@@ -442,7 +442,7 @@
 import 'package:flutter/widgets.dart';
 
 class C extends Widget with Diagnosticable {
-  int field = 0;
+  final int field = 0;
   @override
   void debugFillProperties(DiagnosticPropertiesBuilder properties) {
     super.debugFillProperties(properties);
@@ -454,7 +454,7 @@
 import 'package:flutter/widgets.dart';
 
 class C extends Widget with Diagnosticable {
-  int field = 0;
+  final int field = 0;
   @override
   void debugFillProperties(DiagnosticPropertiesBuilder properties) {
     super.debugFillProperties(properties);
@@ -470,7 +470,7 @@
 import 'package:flutter/widgets.dart';
 
 class C extends Widget with Diagnosticable {
-  Iterable<String> field = [];
+  final Iterable<String> field = [];
 }
 ''');
     await assertHasFix('''
@@ -478,7 +478,7 @@
 import 'package:flutter/widgets.dart';
 
 class C extends Widget with Diagnosticable {
-  Iterable<String> field = [];
+  final Iterable<String> field = [];
 
   @override
   void debugFillProperties(DiagnosticPropertiesBuilder properties) {
@@ -495,7 +495,7 @@
 import 'package:flutter/widgets.dart';
 
 class C extends Widget with Diagnosticable {
-  List<List<String>> field = [];
+  final List<List<String>> field = [];
   @override
   void debugFillProperties(DiagnosticPropertiesBuilder properties) {
     super.debugFillProperties(properties);
@@ -507,7 +507,7 @@
 import 'package:flutter/widgets.dart';
 
 class C extends Widget with Diagnosticable {
-  List<List<String>> field = [];
+  final List<List<String>> field = [];
   @override
   void debugFillProperties(DiagnosticPropertiesBuilder properties) {
     super.debugFillProperties(properties);
@@ -525,7 +525,7 @@
 import 'package:vector_math/vector_math_64.dart';
 
 class C extends Widget with Diagnosticable {
-  Matrix4 field = Matrix4();
+  final Matrix4 field = Matrix4();
   @override
   void debugFillProperties(DiagnosticPropertiesBuilder properties) {
     super.debugFillProperties(properties);
@@ -538,7 +538,7 @@
 import 'package:vector_math/vector_math_64.dart';
 
 class C extends Widget with Diagnosticable {
-  Matrix4 field = Matrix4();
+  final Matrix4 field = Matrix4();
   @override
   void debugFillProperties(DiagnosticPropertiesBuilder properties) {
     super.debugFillProperties(properties);
@@ -554,7 +554,7 @@
 import 'package:flutter/widgets.dart';
 
 class C extends Widget with Diagnosticable {
-  Object field = '';
+  final Object field = '';
   @override
   void debugFillProperties(DiagnosticPropertiesBuilder properties) {
     super.debugFillProperties(properties);
@@ -566,7 +566,7 @@
 import 'package:flutter/widgets.dart';
 
 class C extends Widget with Diagnosticable {
-  Object field = '';
+  final Object field = '';
   @override
   void debugFillProperties(DiagnosticPropertiesBuilder properties) {
     super.debugFillProperties(properties);
@@ -582,7 +582,7 @@
 import 'package:flutter/widgets.dart';
 
 class C extends Widget with Diagnosticable {
-  String field = '';
+  final String field = '';
   @override
   void debugFillProperties(DiagnosticPropertiesBuilder properties) {
     super.debugFillProperties(properties);
@@ -594,7 +594,7 @@
 import 'package:flutter/widgets.dart';
 
 class C extends Widget with Diagnosticable {
-  String field = '';
+  final String field = '';
   @override
   void debugFillProperties(DiagnosticPropertiesBuilder properties) {
     super.debugFillProperties(properties);
@@ -610,7 +610,7 @@
 import 'package:flutter/widgets.dart';
 
 class C extends Widget with Diagnosticable {
-  String field = '';
+  final String field = '';
 }
 ''');
     await assertHasFix('''
@@ -618,7 +618,7 @@
 import 'package:flutter/widgets.dart';
 
 class C extends Widget with Diagnosticable {
-  String field = '';
+  final String field = '';
 
   @override
   void debugFillProperties(DiagnosticPropertiesBuilder properties) {
@@ -635,7 +635,7 @@
 import 'package:flutter/widgets.dart';
 
 class C extends Widget with Diagnosticable {
-  ClassNotInScope<bool> onChanged;
+  final ClassNotInScope<bool> onChanged = 7;
 
   @override
   void debugFillProperties(DiagnosticPropertiesBuilder properties) {
@@ -648,7 +648,7 @@
 import 'package:flutter/widgets.dart';
 
 class C extends Widget with Diagnosticable {
-  ClassNotInScope<bool> onChanged;
+  final ClassNotInScope<bool> onChanged = 7;
 
   @override
   void debugFillProperties(DiagnosticPropertiesBuilder properties) {
@@ -694,6 +694,7 @@
 import 'package:flutter/foundation.dart';
 import 'package:flutter/widgets.dart';
 
+// ignore: must_be_immutable
 class C extends Widget with Diagnosticable {
   var field;
   @override
@@ -706,6 +707,7 @@
 import 'package:flutter/foundation.dart';
 import 'package:flutter/widgets.dart';
 
+// ignore: must_be_immutable
 class C extends Widget with Diagnosticable {
   var field;
   @override
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_key_to_constructors_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_key_to_constructors_test.dart
index 980b150..d7aca94 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_key_to_constructors_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_key_to_constructors_test.dart
@@ -425,6 +425,7 @@
     await resolveTestCode('''
 import 'package:flutter/material.dart';
 
+// ignore: must_be_immutable
 class MyWidget extends StatelessWidget {
   var t = const Text('');
 }
@@ -432,6 +433,7 @@
     await assertHasFix('''
 import 'package:flutter/material.dart';
 
+// ignore: must_be_immutable
 class MyWidget extends StatelessWidget {
   var t = const Text('');
 
@@ -444,6 +446,7 @@
     await resolveTestCode('''
 import 'package:flutter/material.dart';
 
+// ignore: must_be_immutable
 class MyWidget extends StatelessWidget {
   var c = Container();
 }
@@ -451,6 +454,7 @@
     await assertHasFix('''
 import 'package:flutter/material.dart';
 
+// ignore: must_be_immutable
 class MyWidget extends StatelessWidget {
   var c = Container();
 
@@ -871,6 +875,7 @@
     await resolveTestCode('''
 import 'package:flutter/material.dart';
 
+// ignore: must_be_immutable
 class MyWidget extends StatelessWidget {
   var t = const Text('');
 }
@@ -878,6 +883,7 @@
     await assertHasFix('''
 import 'package:flutter/material.dart';
 
+// ignore: must_be_immutable
 class MyWidget extends StatelessWidget {
   var t = const Text('');
 
@@ -890,6 +896,7 @@
     await resolveTestCode('''
 import 'package:flutter/material.dart';
 
+// ignore: must_be_immutable
 class MyWidget extends StatelessWidget {
   var c = Container();
 }
@@ -897,6 +904,7 @@
     await assertHasFix('''
 import 'package:flutter/material.dart';
 
+// ignore: must_be_immutable
 class MyWidget extends StatelessWidget {
   var c = Container();
 
diff --git a/pkg/analysis_server/test/src/utilities/flutter_test.dart b/pkg/analysis_server/test/src/utilities/flutter_test.dart
index 9068c08..8e6754f 100644
--- a/pkg/analysis_server/test/src/utilities/flutter_test.dart
+++ b/pkg/analysis_server/test/src/utilities/flutter_test.dart
@@ -120,7 +120,7 @@
 import 'package:flutter/widgets.dart';
 
 abstract class Foo extends Widget {
-  Widget bar;
+  final Widget bar;
 
   Foo(this.bar);
 }
@@ -139,7 +139,7 @@
 import 'package:flutter/widgets.dart';
 
 abstract class Foo extends Widget {
-  Widget bar;
+  final Widget bar;
 
   Foo(this.bar);
 }
diff --git a/pkg/analyzer/lib/src/dart/constant/constant_verifier.dart b/pkg/analyzer/lib/src/dart/constant/constant_verifier.dart
index e56b8c0..bf65e50 100644
--- a/pkg/analyzer/lib/src/dart/constant/constant_verifier.dart
+++ b/pkg/analyzer/lib/src/dart/constant/constant_verifier.dart
@@ -29,6 +29,7 @@
 import 'package:analyzer/src/dart/element/type.dart';
 import 'package:analyzer/src/dart/element/type_provider.dart';
 import 'package:analyzer/src/dart/element/type_system.dart';
+import 'package:analyzer/src/dart/error/lint_codes.dart';
 import 'package:analyzer/src/diagnostic/diagnostic.dart' as diag;
 import 'package:analyzer/src/diagnostic/diagnostic_factory.dart';
 import 'package:analyzer/src/error/codes.dart';
@@ -1030,24 +1031,24 @@
                   nonExhaustiveness.witnesses.every(
                     (witness) => witness.asWitness.contains('._'),
                   ))) {
-            diagnostic = _diagnosticReporter.atToken(
-              switchKeyword,
-              isSwitchExpression
-                  ? diag.nonExhaustiveSwitchExpressionPrivate
-                  : diag.nonExhaustiveSwitchStatementPrivate,
-              arguments: [scrutineeType],
+            diagnostic = _diagnosticReporter.report(
+              (isSwitchExpression
+                      ? diag.nonExhaustiveSwitchExpressionPrivate
+                      : diag.nonExhaustiveSwitchStatementPrivate)
+                  .withArguments(type: scrutineeType)
+                  .at(switchKeyword),
             );
           } else {
-            diagnostic = _diagnosticReporter.atToken(
-              switchKeyword,
-              isSwitchExpression
-                  ? diag.nonExhaustiveSwitchExpression
-                  : diag.nonExhaustiveSwitchStatement,
-              arguments: [
-                scrutineeType,
-                errorBuffer.toString(),
-                correctionTextBuffer.toString(),
-              ],
+            diagnostic = _diagnosticReporter.report(
+              (isSwitchExpression
+                      ? diag.nonExhaustiveSwitchExpression
+                      : diag.nonExhaustiveSwitchStatement)
+                  .withArguments(
+                    type: scrutineeType,
+                    unmatchedPattern: errorBuffer.toString(),
+                    suggestedPattern: correctionTextBuffer.toString(),
+                  )
+                  .at(switchKeyword),
             );
           }
           if (correctionData.isNotEmpty) {
@@ -1277,7 +1278,7 @@
     if (notPotentiallyConstants.isEmpty) return true;
 
     for (var notConst in notPotentiallyConstants) {
-      DiagnosticCode diagnosticCode;
+      LocatableDiagnostic diagnosticCode;
       if (listElementType != null) {
         diagnosticCode = diag.nonConstantListElement;
       } else if (mapConfig != null) {
@@ -1301,7 +1302,7 @@
       } else {
         throw UnimplementedError();
       }
-      verifier._diagnosticReporter.atNode(notConst, diagnosticCode);
+      verifier._diagnosticReporter.report(diagnosticCode.at(notConst));
     }
 
     return false;
diff --git a/pkg/analyzer/lib/src/dart/resolver/binary_expression_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/binary_expression_resolver.dart
index 12dbef9..0cecb8e 100644
--- a/pkg/analyzer/lib/src/dart/resolver/binary_expression_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/binary_expression_resolver.dart
@@ -153,10 +153,8 @@
           ? diag.unnecessaryNullComparisonAlwaysNullFalse
           : diag.unnecessaryNullComparisonAlwaysNullTrue;
       var offset = start.offset;
-      _diagnosticReporter.atOffset(
-        offset: offset,
-        length: end.end - offset,
-        diagnosticCode: diagnosticCode,
+      _diagnosticReporter.report(
+        diagnosticCode.atOffset(offset: offset, length: end.end - offset),
       );
     }
 
diff --git a/pkg/analyzer/lib/src/dart/resolver/named_type_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/named_type_resolver.dart
index e4d7ac1..32094de 100644
--- a/pkg/analyzer/lib/src/dart/resolver/named_type_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/named_type_resolver.dart
@@ -7,7 +7,6 @@
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/dart/element/scope.dart';
 import 'package:analyzer/dart/element/type.dart';
-import 'package:analyzer/error/error.dart';
 import 'package:analyzer/source/source_range.dart';
 import 'package:analyzer/src/dart/ast/ast.dart';
 import 'package:analyzer/src/dart/ast/extensions.dart';
@@ -15,6 +14,7 @@
 import 'package:analyzer/src/dart/element/type.dart';
 import 'package:analyzer/src/dart/element/type_constraint_gatherer.dart';
 import 'package:analyzer/src/dart/element/type_system.dart';
+import 'package:analyzer/src/dart/error/lint_codes.dart';
 import 'package:analyzer/src/dart/resolver/flow_analysis_visitor.dart';
 import 'package:analyzer/src/dart/type_instantiation_target.dart';
 import 'package:analyzer/src/diagnostic/diagnostic.dart' as diag;
@@ -507,7 +507,7 @@
       }
 
       // Report if this type is used as a class in hierarchy.
-      DiagnosticCode? diagnosticCode;
+      LocatableDiagnostic? diagnosticCode;
       if (parent is ExtendsClause) {
         diagnosticCode = diag.extendsTypeAliasExpandsToTypeParameter;
       } else if (parent is ImplementsClause) {
@@ -519,10 +519,11 @@
       }
       if (diagnosticCode != null) {
         var errorRange = _ErrorHelper._getErrorRange(node);
-        diagnosticReporter.atOffset(
-          offset: errorRange.offset,
-          length: errorRange.length,
-          diagnosticCode: diagnosticCode,
+        diagnosticReporter.report(
+          diagnosticCode.atOffset(
+            offset: errorRange.offset,
+            length: errorRange.length,
+          ),
         );
         hasErrorReported = true;
         return InvalidTypeImpl.instance;
diff --git a/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart b/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart
index 2cb04fe..8026bdb 100644
--- a/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart
@@ -11,7 +11,6 @@
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/dart/element/scope.dart';
 import 'package:analyzer/dart/element/type_provider.dart';
-import 'package:analyzer/error/error.dart';
 import 'package:analyzer/error/listener.dart';
 import 'package:analyzer/src/dart/ast/ast.dart';
 import 'package:analyzer/src/dart/ast/extensions.dart';
@@ -20,6 +19,7 @@
 import 'package:analyzer/src/dart/element/type.dart';
 import 'package:analyzer/src/dart/element/type_constraint_gatherer.dart';
 import 'package:analyzer/src/dart/element/type_provider.dart';
+import 'package:analyzer/src/dart/error/lint_codes.dart';
 import 'package:analyzer/src/dart/resolver/ast_rewrite.dart';
 import 'package:analyzer/src/dart/resolver/flow_analysis_visitor.dart';
 import 'package:analyzer/src/dart/resolver/named_type_resolver.dart';
@@ -1758,7 +1758,7 @@
       return;
     }
 
-    DiagnosticCode? diagnosticCode;
+    LocatableDiagnostic? diagnosticCode;
     switch (clause) {
       case null:
         if (declaration is ClassTypeAlias) {
@@ -1787,10 +1787,8 @@
     var firstToken = namedType.importPrefix?.name ?? namedType.name;
     var offset = firstToken.offset;
     var length = namedType.name.end - offset;
-    _diagnosticReporter.atOffset(
-      offset: offset,
-      length: length,
-      diagnosticCode: diagnosticCode,
+    _diagnosticReporter.report(
+      diagnosticCode.atOffset(offset: offset, length: length),
     );
   }
 
diff --git a/pkg/analyzer/lib/src/dart/resolver/yield_statement_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/yield_statement_resolver.dart
index fd871ff..93b43f1 100644
--- a/pkg/analyzer/lib/src/dart/resolver/yield_statement_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/yield_statement_resolver.dart
@@ -206,11 +206,11 @@
     );
     _resolver.popRewrite();
 
-    _diagnosticReporter.atNode(
-      node,
-      node.star != null
-          ? diag.yieldEachInNonGenerator
-          : diag.yieldInNonGenerator,
+    _diagnosticReporter.report(
+      (node.star != null
+              ? diag.yieldEachInNonGenerator
+              : diag.yieldInNonGenerator)
+          .at(node),
     );
 
     _checkForUseOfVoidResult(node.expression);
diff --git a/pkg/analyzer/lib/src/diagnostic/diagnostic.g.dart b/pkg/analyzer/lib/src/diagnostic/diagnostic.g.dart
index ec6273f..d860ef1 100644
--- a/pkg/analyzer/lib/src/diagnostic/diagnostic.g.dart
+++ b/pkg/analyzer/lib/src/diagnostic/diagnostic.g.dart
@@ -10313,21 +10313,6 @@
       expectedTypes: [],
     );
 
-/// Parameters:
-/// Object p0: the terminator that is missing
-const DiagnosticWithArguments<
-  LocatableDiagnostic Function({required Object p0})
->
-missingTerminatorForParameterGroup = DiagnosticWithArguments(
-  name: 'missing_terminator_for_parameter_group',
-  problemMessage: "There is no '{0}' to close the parameter group.",
-  correctionMessage: "Try inserting a '{0}' at the end of the group.",
-  type: DiagnosticType.SYNTACTIC_ERROR,
-  uniqueName: 'missing_terminator_for_parameter_group',
-  withArguments: _withArgumentsMissingTerminatorForParameterGroup,
-  expectedTypes: [ExpectedType.object],
-);
-
 /// No parameters.
 const DiagnosticWithoutArguments missingTypedefParameters =
     DiagnosticWithoutArgumentsImpl(
@@ -10952,24 +10937,6 @@
       expectedTypes: [],
     );
 
-/// Parameters:
-/// Object p0: the number of variables being declared
-const DiagnosticWithArguments<
-  LocatableDiagnostic Function({required Object p0})
->
-multipleVariablesInForEach = DiagnosticWithArguments(
-  name: 'multiple_variables_in_for_each',
-  problemMessage:
-      "A single loop variable must be declared in a for-each loop before the "
-      "'in', but {0} were found.",
-  correctionMessage:
-      "Try moving all but one of the declarations inside the loop body.",
-  type: DiagnosticType.SYNTACTIC_ERROR,
-  uniqueName: 'multiple_variables_in_for_each',
-  withArguments: _withArgumentsMultipleVariablesInForEach,
-  expectedTypes: [ExpectedType.object],
-);
-
 /// No parameters.
 const DiagnosticWithoutArguments multipleVarianceModifiers =
     DiagnosticWithoutArgumentsImpl(
@@ -12342,20 +12309,6 @@
   expectedTypes: [ExpectedType.string],
 );
 
-/// Parameters:
-/// Object p0: the operator that the user is trying to define
-const DiagnosticWithArguments<
-  LocatableDiagnostic Function({required Object p0})
->
-nonUserDefinableOperator = DiagnosticWithArguments(
-  name: 'non_user_definable_operator',
-  problemMessage: "The operator '{0}' isn't user definable.",
-  type: DiagnosticType.SYNTACTIC_ERROR,
-  uniqueName: 'non_user_definable_operator',
-  withArguments: _withArgumentsNonUserDefinableOperator,
-  expectedTypes: [ExpectedType.object],
-);
-
 /// No parameters.
 const DiagnosticWithoutArguments nonVoidReturnForOperator =
     DiagnosticWithoutArgumentsImpl(
@@ -15423,20 +15376,6 @@
   expectedTypes: [ExpectedType.string],
 );
 
-/// Parameters:
-/// Object p0: the path of the file that cannot be read
-const DiagnosticWithArguments<
-  LocatableDiagnostic Function({required Object p0})
->
-unableGetContent = DiagnosticWithArguments(
-  name: 'unable_get_content',
-  problemMessage: "Unable to get content of '{0}'.",
-  type: DiagnosticType.SYNTACTIC_ERROR,
-  uniqueName: 'unable_get_content',
-  withArguments: _withArgumentsUnableGetContent,
-  expectedTypes: [ExpectedType.object],
-);
-
 /// No parameters.
 const DiagnosticWithoutArguments
 uncheckedInvocationOfNullableValue = DiagnosticWithoutArgumentsImpl(
@@ -16260,21 +16199,6 @@
 );
 
 /// Parameters:
-/// Object p0: the starting character that was missing
-const DiagnosticWithArguments<
-  LocatableDiagnostic Function({required Object p0})
->
-unexpectedTerminatorForParameterGroup = DiagnosticWithArguments(
-  name: 'unexpected_terminator_for_parameter_group',
-  problemMessage: "There is no '{0}' to open a parameter group.",
-  correctionMessage: "Try inserting the '{0}' at the appropriate location.",
-  type: DiagnosticType.SYNTACTIC_ERROR,
-  uniqueName: 'unexpected_terminator_for_parameter_group',
-  withArguments: _withArgumentsUnexpectedTerminatorForParameterGroup,
-  expectedTypes: [ExpectedType.object],
-);
-
-/// Parameters:
 /// String text: the unexpected text that was found
 const DiagnosticWithArguments<
   LocatableDiagnostic Function({required String text})
@@ -17673,22 +17597,6 @@
   expectedTypes: [],
 );
 
-/// Parameters:
-/// Object p0: the terminator that was expected
-/// Object p1: the terminator that was found
-const DiagnosticWithArguments<
-  LocatableDiagnostic Function({required Object p0, required Object p1})
->
-wrongTerminatorForParameterGroup = DiagnosticWithArguments(
-  name: 'wrong_terminator_for_parameter_group',
-  problemMessage: "Expected '{0}' to close parameter group.",
-  correctionMessage: "Try replacing '{0}' with '{1}'.",
-  type: DiagnosticType.SYNTACTIC_ERROR,
-  uniqueName: 'wrong_terminator_for_parameter_group',
-  withArguments: _withArgumentsWrongTerminatorForParameterGroup,
-  expectedTypes: [ExpectedType.object, ExpectedType.object],
-);
-
 /// Let `C` be a generic class that declares a formal type parameter `X`, and
 /// assume that `T` is a direct superinterface of `C`. It is a compile-time
 /// error if `X` occurs contravariantly or invariantly in `T`.
@@ -19904,12 +19812,6 @@
   ]);
 }
 
-LocatableDiagnostic _withArgumentsMissingTerminatorForParameterGroup({
-  required Object p0,
-}) {
-  return LocatableDiagnosticImpl(diag.missingTerminatorForParameterGroup, [p0]);
-}
-
 LocatableDiagnostic _withArgumentsMissingVariablePattern({
   required String name,
 }) {
@@ -20045,12 +19947,6 @@
   return LocatableDiagnosticImpl(diag.multiplePlugins, [firstPluginName]);
 }
 
-LocatableDiagnostic _withArgumentsMultipleVariablesInForEach({
-  required Object p0,
-}) {
-  return LocatableDiagnosticImpl(diag.multipleVariablesInForEach, [p0]);
-}
-
 LocatableDiagnostic _withArgumentsMustBeANativeFunctionType({
   required Object type,
   required String functionName,
@@ -20329,12 +20225,6 @@
   return LocatableDiagnosticImpl(diag.nonTypeInCatchClause, [name]);
 }
 
-LocatableDiagnostic _withArgumentsNonUserDefinableOperator({
-  required Object p0,
-}) {
-  return LocatableDiagnosticImpl(diag.nonUserDefinableOperator, [p0]);
-}
-
 LocatableDiagnostic
 _withArgumentsNotAssignedPotentiallyNonNullableLocalVariable({
   required String name,
@@ -21014,10 +20904,6 @@
   return LocatableDiagnosticImpl(diag.typeTestWithUndefinedName, [name]);
 }
 
-LocatableDiagnostic _withArgumentsUnableGetContent({required Object p0}) {
-  return LocatableDiagnosticImpl(diag.unableGetContent, [p0]);
-}
-
 LocatableDiagnostic _withArgumentsUncheckedMethodInvocationOfNullableValue({
   required String name,
 }) {
@@ -21278,14 +21164,6 @@
   return LocatableDiagnosticImpl(diag.undone, [message]);
 }
 
-LocatableDiagnostic _withArgumentsUnexpectedTerminatorForParameterGroup({
-  required Object p0,
-}) {
-  return LocatableDiagnosticImpl(diag.unexpectedTerminatorForParameterGroup, [
-    p0,
-  ]);
-}
-
 LocatableDiagnostic _withArgumentsUnexpectedToken({required String text}) {
   return LocatableDiagnosticImpl(diag.unexpectedToken, [text]);
 }
@@ -21616,16 +21494,6 @@
   ]);
 }
 
-LocatableDiagnostic _withArgumentsWrongTerminatorForParameterGroup({
-  required Object p0,
-  required Object p1,
-}) {
-  return LocatableDiagnosticImpl(diag.wrongTerminatorForParameterGroup, [
-    p0,
-    p1,
-  ]);
-}
-
 LocatableDiagnostic _withArgumentsWrongTypeParameterVarianceInSuperinterface({
   required String typeParameterName,
   required DartType superInterfaceType,
diff --git a/pkg/analyzer/lib/src/diagnostic/diagnostic_code_values.g.dart b/pkg/analyzer/lib/src/diagnostic/diagnostic_code_values.g.dart
index 4c8fd1c..f85a7e6 100644
--- a/pkg/analyzer/lib/src/diagnostic/diagnostic_code_values.g.dart
+++ b/pkg/analyzer/lib/src/diagnostic/diagnostic_code_values.g.dart
@@ -669,7 +669,6 @@
   diag.missingSizeAnnotationCarray,
   diag.missingStarAfterSync,
   diag.missingStatement,
-  diag.missingTerminatorForParameterGroup,
   diag.missingTypedefParameters,
   diag.missingVariableInForEach,
   diag.missingVariablePattern,
@@ -711,7 +710,6 @@
   diag.multipleRedirectingConstructorInvocations,
   diag.multipleRepresentationFields,
   diag.multipleSuperInitializers,
-  diag.multipleVariablesInForEach,
   diag.multipleVarianceModifiers,
   diag.multipleWithClauses,
   diag.mustBeANativeFunctionType,
@@ -795,7 +793,6 @@
   diag.nonSyncFactory,
   diag.nonTypeAsTypeArgument,
   diag.nonTypeInCatchClause,
-  diag.nonUserDefinableOperator,
   diag.nonVoidReturnForOperator,
   diag.nonVoidReturnForSetter,
   diag.normalBeforeOptionalParameters,
@@ -980,7 +977,6 @@
   diag.typeTestWithNonType,
   diag.typeTestWithUndefinedName,
   diag.typedefInClass,
-  diag.unableGetContent,
   diag.uncheckedInvocationOfNullableValue,
   diag.uncheckedMethodInvocationOfNullableValue,
   diag.uncheckedOperatorInvocationOfNullableValue,
@@ -1024,7 +1020,6 @@
   diag.undone,
   diag.unexpectedDollarInString,
   diag.unexpectedSeparatorInNumber,
-  diag.unexpectedTerminatorForParameterGroup,
   diag.unexpectedToken,
   diag.unexpectedTokens,
   diag.unignorableIgnore,
@@ -1108,7 +1103,6 @@
   diag.wrongNumberOfTypeArgumentsExtension,
   diag.wrongNumberOfTypeArgumentsFunction,
   diag.wrongSeparatorForPositionalParameter,
-  diag.wrongTerminatorForParameterGroup,
   diag.wrongTypeParameterVarianceInSuperinterface,
   diag.wrongTypeParameterVariancePosition,
   diag.yieldEachInNonGenerator,
diff --git a/pkg/analyzer/lib/src/error/best_practices_verifier.dart b/pkg/analyzer/lib/src/error/best_practices_verifier.dart
index 84cfa9a..bd0089a 100644
--- a/pkg/analyzer/lib/src/error/best_practices_verifier.dart
+++ b/pkg/analyzer/lib/src/error/best_practices_verifier.dart
@@ -10,7 +10,6 @@
 import 'package:analyzer/dart/constant/value.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/dart/element/type.dart';
-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/element/element.dart';
@@ -978,11 +977,11 @@
     var rightType = rightNode.typeOrThrow;
 
     void report() {
-      _diagnosticReporter.atNode(
-        node,
-        node.notOperator == null
-            ? diag.unnecessaryTypeCheckTrue
-            : diag.unnecessaryTypeCheckFalse,
+      _diagnosticReporter.report(
+        (node.notOperator == null
+                ? diag.unnecessaryTypeCheckTrue
+                : diag.unnecessaryTypeCheckFalse)
+            .at(node),
       );
     }
 
@@ -1007,11 +1006,11 @@
       if (leftNode is NullLiteral) {
         report();
       } else {
-        _diagnosticReporter.atNode(
-          node,
-          node.notOperator == null
-              ? diag.typeCheckIsNull
-              : diag.typeCheckIsNotNull,
+        _diagnosticReporter.report(
+          (node.notOperator == null
+                  ? diag.typeCheckIsNull
+                  : diag.typeCheckIsNotNull)
+              .at(node),
         );
       }
       return true;
@@ -1065,7 +1064,7 @@
           var diagnosticCode = node.isSet
               ? diag.equalElementsInSet
               : diag.equalKeysInMap;
-          _diagnosticReporter.atNode(expression, diagnosticCode);
+          _diagnosticReporter.report(diagnosticCode.at(expression));
         }
       }
     }
@@ -1193,11 +1192,11 @@
   }
 
   void _checkForInvariantNullComparison(BinaryExpression node) {
-    DiagnosticCode diagnosticCode;
+    LocatableDiagnostic locatableDiagnostic;
     if (node.operator.type == TokenType.BANG_EQ) {
-      diagnosticCode = diag.unnecessaryNullComparisonNeverNullTrue;
+      locatableDiagnostic = diag.unnecessaryNullComparisonNeverNullTrue;
     } else if (node.operator.type == TokenType.EQ_EQ) {
-      diagnosticCode = diag.unnecessaryNullComparisonNeverNullFalse;
+      locatableDiagnostic = diag.unnecessaryNullComparisonNeverNullFalse;
     } else {
       return;
     }
@@ -1206,10 +1205,11 @@
       var rightType = node.rightOperand.typeOrThrow;
       if (_typeSystem.isStrictlyNonNullable(rightType)) {
         var offset = node.leftOperand.offset;
-        _diagnosticReporter.atOffset(
-          offset: offset,
-          length: node.operator.end - offset,
-          diagnosticCode: diagnosticCode,
+        _diagnosticReporter.report(
+          locatableDiagnostic.atOffset(
+            offset: offset,
+            length: node.operator.end - offset,
+          ),
         );
       }
     }
@@ -1218,10 +1218,11 @@
       var leftType = node.leftOperand.typeOrThrow;
       if (_typeSystem.isStrictlyNonNullable(leftType)) {
         var offset = node.operator.offset;
-        _diagnosticReporter.atOffset(
-          offset: offset,
-          length: node.rightOperand.end - offset,
-          diagnosticCode: diagnosticCode,
+        _diagnosticReporter.report(
+          locatableDiagnostic.atOffset(
+            offset: offset,
+            length: node.rightOperand.end - offset,
+          ),
         );
       }
     }
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index ff4f91d..5d5f093 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -1652,11 +1652,11 @@
     var superParameter = element.superConstructorParameter;
 
     if (superParameter == null) {
-      diagnosticReporter.atToken(
-        node.name,
-        node.isNamed
-            ? diag.superFormalParameterWithoutAssociatedNamed
-            : diag.superFormalParameterWithoutAssociatedPositional,
+      diagnosticReporter.report(
+        (node.isNamed
+                ? diag.superFormalParameterWithoutAssociatedNamed
+                : diag.superFormalParameterWithoutAssociatedPositional)
+            .at(node.name),
       );
       return;
     }
diff --git a/pkg/analyzer/messages.yaml b/pkg/analyzer/messages.yaml
index 1380f15..ebde35e 100644
--- a/pkg/analyzer/messages.yaml
+++ b/pkg/analyzer/messages.yaml
@@ -23017,6 +23017,7 @@
     type: syntacticError
     parameters:
       Object p0: the terminator that is missing
+    removedIn: "2.12"
     problemMessage: "There is no '#p0' to close the parameter group."
     correctionMessage: "Try inserting a '#p0' at the end of the group."
     hasPublishedDocs: false
@@ -23066,6 +23067,7 @@
     type: syntacticError
     parameters:
       Object p0: the number of variables being declared
+    removedIn: "2.12"
     problemMessage: "A single loop variable must be declared in a for-each loop before the 'in', but #p0 were found."
     correctionMessage: Try moving all but one of the declarations inside the loop body.
     hasPublishedDocs: false
@@ -23127,6 +23129,7 @@
     type: syntacticError
     parameters:
       Object p0: the operator that the user is trying to define
+    removedIn: "2.12"
     problemMessage: "The operator '#p0' isn't user definable."
     hasPublishedDocs: false
   normalBeforeOptionalParameters:
@@ -23261,6 +23264,7 @@
     type: syntacticError
     parameters:
       Object p0: the starting character that was missing
+    removedIn: "2.12"
     problemMessage: "There is no '#p0' to open a parameter group."
     correctionMessage: "Try inserting the '#p0' at the appropriate location."
     hasPublishedDocs: false
@@ -23341,6 +23345,7 @@
     parameters:
       Object p0: the terminator that was expected
       Object p1: the terminator that was found
+    removedIn: "2.12"
     problemMessage: "Expected '#p0' to close parameter group."
     correctionMessage: "Try replacing '#p0' with '#p1'."
     hasPublishedDocs: false
@@ -24295,6 +24300,7 @@
     type: syntacticError
     parameters:
       Object p0: the path of the file that cannot be read
+    removedIn: "2.6"
     problemMessage: Unable to get content of '#p0'.
     hasPublishedDocs: false
   unexpectedDollarInString:
diff --git a/pkg/analyzer/test/src/diagnostics/invalid_await_not_required_annotation_test.dart b/pkg/analyzer/test/src/diagnostics/invalid_await_not_required_annotation_test.dart
index 6cd02a4..87933a3 100644
--- a/pkg/analyzer/test/src/diagnostics/invalid_await_not_required_annotation_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/invalid_await_not_required_annotation_test.dart
@@ -119,6 +119,13 @@
 ''');
   }
 
+  test_valid_field_futureReturnType_originPrimaryConstructor() async {
+    await assertNoErrorsInCode('''
+import 'package:meta/meta.dart';
+class C(@awaitNotRequired final Future<int> x);
+''');
+  }
+
   test_valid_function_futureOrReturnType() async {
     await assertNoErrorsInCode('''
 import 'dart:async';
diff --git a/pkg/analyzer_testing/lib/mock_packages/package_content/flutter/lib/src/widgets/framework.dart b/pkg/analyzer_testing/lib/mock_packages/package_content/flutter/lib/src/widgets/framework.dart
index 2ccf602..f02257f 100644
--- a/pkg/analyzer_testing/lib/mock_packages/package_content/flutter/lib/src/widgets/framework.dart
+++ b/pkg/analyzer_testing/lib/mock_packages/package_content/flutter/lib/src/widgets/framework.dart
@@ -3,6 +3,7 @@
 // found in the LICENSE file.
 
 import 'package:flutter/foundation.dart';
+import 'package:meta/meta.dart';
 
 export 'package:flutter/foundation.dart' show required;
 export 'package:flutter/foundation.dart' show Key, LocalKey, ValueKey;
@@ -54,6 +55,7 @@
   Widget build(BuildContext context) => null;
 }
 
+@immutable
 class Widget extends DiagnosticableTree {
   final Key? key;
 
diff --git a/pkg/dart2wasm/lib/static_dispatch_table.dart b/pkg/dart2wasm/lib/static_dispatch_table.dart
index 59f53a1..f9c65ca 100644
--- a/pkg/dart2wasm/lib/static_dispatch_table.dart
+++ b/pkg/dart2wasm/lib/static_dispatch_table.dart
@@ -2,60 +2,28 @@
 // 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:wasm_builder/wasm_builder.dart' as w;
 
 import 'translator.dart';
 
-class StaticDispatchTables {
-  final Translator translator;
-
-  final Map<w.FunctionType, StaticDispatchTableForSignature> _tables =
-      LinkedHashMap(
-          hashCode: (t) =>
-              Object.hash(Object.hashAll(t.inputs), Object.hashAll(t.outputs)),
-          equals: (t1, t2) => t1.isStructurallyEqualTo(t2));
-
-  StaticDispatchTables(this.translator);
-
-  StaticDispatchTableForSignature getTableForType(w.FunctionType type) {
-    return _tables[type] ??=
-        StaticDispatchTableForSignature(translator, type, _tables.length);
-  }
-
-  void outputTables() {
-    for (final table in _tables.values) {
-      table.output();
-    }
-  }
-}
-
-/// Builds a static dispatch table for a specific function type signature.
-///
-/// All calls to this table will have the same signature and so `call_indirect`
-/// instructions that reference this table can omit the type check.
-class StaticDispatchTableForSignature {
-  final w.FunctionType _functionType;
+/// Builds a table of functions that can be used across modules.
+class CrossModuleFunctionTable {
+  static const w.HeapType _tableHeapType = w.HeapType.func;
 
   final Translator translator;
 
   /// Contents of wasm table.
   final Map<w.BaseFunction, int> _table = {};
 
-  late final w.TableBuilder _definedWasmTable;
+  late final w.TableBuilder _definedWasmTable = translator.mainModule.tables
+      .define(w.RefType(_tableHeapType, nullable: true), _table.length);
   final WasmTableImporter _importedWasmTables;
 
-  StaticDispatchTableForSignature(
-      this.translator, this._functionType, int nameCounter)
+  CrossModuleFunctionTable(this.translator)
       : _importedWasmTables =
-            WasmTableImporter(translator, 'static$nameCounter-') {
-    _definedWasmTable = translator.mainModule.tables
-        .define(w.RefType(_functionType, nullable: true), _table.length);
-  }
+            WasmTableImporter(translator, 'cross-module-funcs-');
 
-  /// Gets the wasm table used to reference this static dispatch table in
-  /// [module].
+  /// Gets the wasm table used to reference this table in [module].
   ///
   /// This can either be the table definition itself or an import of it. Imports
   /// the table into [module] if it is not imported yet.
@@ -65,7 +33,7 @@
 
   /// Returns the index for [function] in the table allocating one if necessary.
   int indexForFunction(w.BaseFunction function) {
-    assert(function.type.isStructurallyEqualTo(function.type));
+    assert(function.type.isStructuralSubtypeOf(_tableHeapType));
     return _table[function] ??= _table.length;
   }
 
diff --git a/pkg/dart2wasm/lib/translator.dart b/pkg/dart2wasm/lib/translator.dart
index db68759..1c9d393 100644
--- a/pkg/dart2wasm/lib/translator.dart
+++ b/pkg/dart2wasm/lib/translator.dart
@@ -193,7 +193,7 @@
   final LibraryIndex index;
   late final ClosureLayouter closureLayouter;
   late final ClassInfoCollector classInfoCollector;
-  late final StaticDispatchTables staticTablesPerType;
+  late final CrossModuleFunctionTable crossModuleFunctionTable;
   late final DispatchTable dispatchTable;
   DispatchTable? dynamicMainModuleDispatchTable;
   late final Globals globals;
@@ -520,7 +520,7 @@
     subtypes = hierarchy.computeSubtypesInformation();
     closureLayouter = ClosureLayouter(this);
     classInfoCollector = ClassInfoCollector(this);
-    staticTablesPerType = StaticDispatchTables(this);
+    crossModuleFunctionTable = CrossModuleFunctionTable(this);
     dispatchTable = DispatchTable(isDynamicSubmoduleTable: isDynamicSubmodule)
       ..translator = this;
     if (isDynamicSubmodule) {
@@ -615,7 +615,7 @@
 
     constructorClosures.clear();
     dispatchTable.output();
-    staticTablesPerType.outputTables();
+    crossModuleFunctionTable.output();
 
     for (ConstantInfo info in constants.constantInfo.values) {
       info.printInitializer((function) {
@@ -804,11 +804,9 @@
           _importedFunctions.get(function, b.moduleBuilder);
       b.call(importedFunction);
     } else {
-      final staticTable = staticTablesPerType.getTableForType(function.type);
-      b.i32_const(staticTable.indexForFunction(function));
-      b.table_get(staticTable.getWasmTable(b.moduleBuilder));
-      b.ref_as_non_null();
-      b.call_ref(function.type);
+      b.i32_const(crossModuleFunctionTable.indexForFunction(function));
+      b.call_indirect(function.type,
+          crossModuleFunctionTable.getWasmTable(b.moduleBuilder));
     }
     return b.emitUnreachableIfNoResult(function.type.outputs);
   }
diff --git a/pkg/dart2wasm/test/ir_tests/deferred.constant.dart b/pkg/dart2wasm/test/ir_tests/deferred.constant.dart
index c2f73bd..76ee501 100644
--- a/pkg/dart2wasm/test/ir_tests/deferred.constant.dart
+++ b/pkg/dart2wasm/test/ir_tests/deferred.constant.dart
@@ -4,7 +4,7 @@
 
 // functionFilter=mod.*Use
 // functionFilter=H[0-1]
-// tableFilter=static[0-9]+
+// tableFilter=cross-module-funcs
 // globalFilter=H[0-1]
 // typeFilter=H[0-1]
 // compilerOption=--enable-deferred-loading
diff --git a/pkg/dart2wasm/test/ir_tests/deferred.constant.multi_module_use.dart b/pkg/dart2wasm/test/ir_tests/deferred.constant.multi_module_use.dart
index b21780f..b021725 100644
--- a/pkg/dart2wasm/test/ir_tests/deferred.constant.multi_module_use.dart
+++ b/pkg/dart2wasm/test/ir_tests/deferred.constant.multi_module_use.dart
@@ -6,7 +6,7 @@
 // functionFilter=mod.*Use
 // functionFilter=MyConstClass
 // functionFilter=shared-const
-// tableFilter=static[0-9]+
+// tableFilter=cross-module-funcs
 // globalFilter=MyConstClass
 // globalFilter=shared-const
 // type=MyConstClass
diff --git a/pkg/dart2wasm/test/ir_tests/deferred.constant.multi_module_use.wat b/pkg/dart2wasm/test/ir_tests/deferred.constant.multi_module_use.wat
index c45f67b..948c9d7 100644
--- a/pkg/dart2wasm/test/ir_tests/deferred.constant.multi_module_use.wat
+++ b/pkg/dart2wasm/test/ir_tests/deferred.constant.multi_module_use.wat
@@ -12,13 +12,7 @@
   (type $Object (sub $#Top (struct
     (field $field0 i32)
     (field $field1 (mut i32)))))
-  (type $type0 (func 
-    (param $var0 i32)
-    (result (ref $MyConstClass))))
-  (type $type2 (func 
-    (result (ref $MyConstClass))))
-  (table $static0-0 (export "static0-0") 2 (ref null $type0))
-  (table $static1-0 (export "static1-0") 1 (ref null $type2))
+  (table $cross-module-funcs-0 (export "cross-module-funcs-0") 3 funcref)
   (global $"C386 \"bad\"" (ref $JSStringImpl) <...>)
   (func $"mainImpl <noInline>" (param $var0 i32)
     (local $var1 (ref $MyConstClass))
@@ -26,12 +20,12 @@
     call $checkLibraryIsLoadedFromLoadId
     local.get $var0
     i32.const 0
-    call_indirect $static0-0 (param i32) (result (ref $MyConstClass))
+    call_indirect $cross-module-funcs-0 (param i32) (result (ref $MyConstClass))
     i64.const 1
     call $checkLibraryIsLoadedFromLoadId
     local.get $var0
     i32.const 1
-    call_indirect $static0-0 (param i32) (result (ref $MyConstClass))
+    call_indirect $cross-module-funcs-0 (param i32) (result (ref $MyConstClass))
     ref.eq
     i32.eqz
     if
diff --git a/pkg/dart2wasm/test/ir_tests/deferred.constant.multi_module_use_module1.wat b/pkg/dart2wasm/test/ir_tests/deferred.constant.multi_module_use_module1.wat
index 2842f69..5b68586 100644
--- a/pkg/dart2wasm/test/ir_tests/deferred.constant.multi_module_use_module1.wat
+++ b/pkg/dart2wasm/test/ir_tests/deferred.constant.multi_module_use_module1.wat
@@ -12,10 +12,8 @@
   (type $Object (sub $#Top (struct
     (field $field0 i32)
     (field $field1 (mut i32)))))
-  (type $type0 (func 
-    (result (ref $MyConstClass))))
   (global $.h0-nonshared-const (import "" "h0-nonshared-const") (ref extern))
-  (table $module0.static1-0 (import "module0" "static1-0") 1 (ref null $type0))
+  (table $module0.cross-module-funcs-0 (import "module0" "cross-module-funcs-0") 3 funcref)
   (global $"C508 MyConstClass" (ref $MyConstClass)
     (i32.const 121)
     (i32.const 0)
@@ -24,13 +22,15 @@
     (global.get $.h0-nonshared-const)
     (struct.new $JSStringImpl)
     (struct.new $MyConstClass))
+  (elem $module0.cross-module-funcs-0
+    (set 0 (ref.func $"modH0Use <noInline>")))
   (func $"modH0Use <noInline>" (param $var0 i32) (result (ref $MyConstClass))
     local.get $var0
     if (result (ref $MyConstClass))
       global.get $"C508 MyConstClass"
     else
-      i32.const 0
-      call_indirect $module0.static1-0 (result (ref $MyConstClass))
+      i32.const 2
+      call_indirect (result (ref $MyConstClass))
     end
   )
 )
\ No newline at end of file
diff --git a/pkg/dart2wasm/test/ir_tests/deferred.constant.multi_module_use_module3.wat b/pkg/dart2wasm/test/ir_tests/deferred.constant.multi_module_use_module3.wat
index 83b783b..2afa41d 100644
--- a/pkg/dart2wasm/test/ir_tests/deferred.constant.multi_module_use_module3.wat
+++ b/pkg/dart2wasm/test/ir_tests/deferred.constant.multi_module_use_module3.wat
@@ -12,10 +12,8 @@
   (type $Object (sub $#Top (struct
     (field $field0 i32)
     (field $field1 (mut i32)))))
-  (type $type0 (func 
-    (result (ref $MyConstClass))))
   (global $.h1-nonshared-const (import "" "h1-nonshared-const") (ref extern))
-  (table $module0.static1-0 (import "module0" "static1-0") 1 (ref null $type0))
+  (table $module0.cross-module-funcs-0 (import "module0" "cross-module-funcs-0") 3 funcref)
   (global $"C504 MyConstClass" (ref $MyConstClass)
     (i32.const 121)
     (i32.const 0)
@@ -24,13 +22,15 @@
     (global.get $.h1-nonshared-const)
     (struct.new $JSStringImpl)
     (struct.new $MyConstClass))
+  (elem $module0.cross-module-funcs-0
+    (set 1 (ref.func $"modH1Use <noInline>")))
   (func $"modH1Use <noInline>" (param $var0 i32) (result (ref $MyConstClass))
     local.get $var0
     if (result (ref $MyConstClass))
       global.get $"C504 MyConstClass"
     else
-      i32.const 0
-      call_indirect $module0.static1-0 (result (ref $MyConstClass))
+      i32.const 2
+      call_indirect (result (ref $MyConstClass))
     end
   )
 )
\ No newline at end of file
diff --git a/pkg/dart2wasm/test/ir_tests/deferred.constant.type_use.dart b/pkg/dart2wasm/test/ir_tests/deferred.constant.type_use.dart
index 27e51b6..b0b45df 100644
--- a/pkg/dart2wasm/test/ir_tests/deferred.constant.type_use.dart
+++ b/pkg/dart2wasm/test/ir_tests/deferred.constant.type_use.dart
@@ -3,7 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 // functionFilter=useFoo
-// tableFilter=static[0-9]+
+// tableFilter=cross-module-funcs
 // globalFilter=Foo
 // typeFilter=Foo
 // compilerOption=--enable-deferred-loading
diff --git a/pkg/dart2wasm/test/ir_tests/deferred.constant.type_use.wat b/pkg/dart2wasm/test/ir_tests/deferred.constant.type_use.wat
index 838e8d6..0ca01cb 100644
--- a/pkg/dart2wasm/test/ir_tests/deferred.constant.type_use.wat
+++ b/pkg/dart2wasm/test/ir_tests/deferred.constant.type_use.wat
@@ -3,8 +3,7 @@
   (type $DeferredLoadIdNotLoadedError <...>)
   (type $_DefaultSet&_HashFieldBase&SetMixin <...>)
   (type $_InterfaceType <...>)
-  (type $type0 <...>)
-  (table $static0-0 (export "static0-0") 1 (ref null $type0))
+  (table $cross-module-funcs-0 (export "cross-module-funcs-0") 1 funcref)
   (global $"C422 _InterfaceType" (ref $_InterfaceType) <...>)
   (func $_loaded implicit getter (result (ref $_DefaultSet&_HashFieldBase&SetMixin)) <...>)
   (func $"useFoo <noInline>"
@@ -22,7 +21,7 @@
       unreachable
     end
     i32.const 0
-    call_indirect $static0-0 (result (ref null $#Top))
+    call_indirect $cross-module-funcs-0 (result (ref null $#Top))
     drop
   )
   (func $"useFooAsType <noInline>"
diff --git a/pkg/dart2wasm/test/ir_tests/deferred.constant.wat b/pkg/dart2wasm/test/ir_tests/deferred.constant.wat
index c97637e..d4e51fe 100644
--- a/pkg/dart2wasm/test/ir_tests/deferred.constant.wat
+++ b/pkg/dart2wasm/test/ir_tests/deferred.constant.wat
@@ -6,39 +6,32 @@
     (field $field1 (mut i32))
     (field $fun (ref $#Closure-0-1)))))
   (type $Object <...>)
-  (type $type0 <...>)
-  (type $type2 <...>)
-  (type $type4 <...>)
-  (type $type6 <...>)
-  (table $static0-0 (export "static0-0") 1 (ref null $type0))
-  (table $static1-0 (export "static1-0") 1 (ref null $type2))
-  (table $static2-0 (export "static2-0") 1 (ref null $type4))
-  (table $static3-0 (export "static3-0") 1 (ref null $type6))
+  (table $cross-module-funcs-0 (export "cross-module-funcs-0") 4 funcref)
   (func $"modMainUseH0 <noInline>"
     i64.const 0
     call $checkLibraryIsLoadedFromLoadId
     block $label0 (result (ref $H0))
-      i32.const 0
-      call_indirect $static2-0 (result (ref null $H0))
+      i32.const 2
+      call_indirect $cross-module-funcs-0 (result (ref null $H0))
       br_on_non_null $label0
-      i32.const 0
-      call_indirect $static3-0 (result (ref $H0))
+      i32.const 3
+      call_indirect $cross-module-funcs-0 (result (ref $H0))
     end $label0
     call $print
     drop
     i64.const 0
     call $checkLibraryIsLoadedFromLoadId
     block $label1 (result (ref $H0))
-      i32.const 0
-      call_indirect $static2-0 (result (ref null $H0))
+      i32.const 2
+      call_indirect $cross-module-funcs-0 (result (ref null $H0))
       br_on_non_null $label1
-      i32.const 0
-      call_indirect $static3-0 (result (ref $H0))
+      i32.const 3
+      call_indirect $cross-module-funcs-0 (result (ref $H0))
     end $label1
     drop
     i64.const 1
-    i32.const 0
-    call_indirect $static1-0 (param i64) (result (ref null $#Top))
+    i32.const 1
+    call_indirect $cross-module-funcs-0 (param i64) (result (ref null $#Top))
     drop
   )
   (func $checkLibraryIsLoadedFromLoadId (param $var0 i64) <...>)
diff --git a/pkg/dart2wasm/test/ir_tests/deferred.fine_grained.dart b/pkg/dart2wasm/test/ir_tests/deferred.fine_grained.dart
index e185462..368594d 100644
--- a/pkg/dart2wasm/test/ir_tests/deferred.fine_grained.dart
+++ b/pkg/dart2wasm/test/ir_tests/deferred.fine_grained.dart
@@ -4,7 +4,7 @@
 
 // functionFilter=foo.*Code
 // functionFilter=Foo.*doit
-// tableFilter=static[0-9]+
+// tableFilter=cross-module-funcs
 // globalFilter=fooGlobal
 // globalFilter=FooConst
 // typeFilter=NoMatch
diff --git a/pkg/dart2wasm/test/ir_tests/deferred.fine_grained.devirtualized.dart b/pkg/dart2wasm/test/ir_tests/deferred.fine_grained.devirtualized.dart
index 625a49f..e9c6b81 100644
--- a/pkg/dart2wasm/test/ir_tests/deferred.fine_grained.devirtualized.dart
+++ b/pkg/dart2wasm/test/ir_tests/deferred.fine_grained.devirtualized.dart
@@ -4,7 +4,7 @@
 
 // functionFilter=foo
 // functionFilter=doit
-// tableFilter=static[0-9]+
+// tableFilter=cross-module-funcs
 // globalFilter=fooGlobal
 // globalFilter=Foo
 // typeFilter=NoMatch
diff --git a/pkg/dart2wasm/test/ir_tests/deferred.fine_grained.devirtualized.wat b/pkg/dart2wasm/test/ir_tests/deferred.fine_grained.devirtualized.wat
index 167d148..71901ef 100644
--- a/pkg/dart2wasm/test/ir_tests/deferred.fine_grained.devirtualized.wat
+++ b/pkg/dart2wasm/test/ir_tests/deferred.fine_grained.devirtualized.wat
@@ -2,11 +2,10 @@
   (type $#Top <...>)
   (type $JSStringImpl <...>)
   (type $Object <...>)
-  (type $type0 <...>)
   (global $".Foo0.doitDispatch(" (import "" "Foo0.doitDispatch(") (ref extern))
   (global $".Foo1.doitDispatch(" (import "" "Foo1.doitDispatch(") (ref extern))
   (global $".FooBase(" (import "" "FooBase(") (ref extern))
-  (table $static0-0 (export "static0-0") 1 (ref null $type0))
+  (table $cross-module-funcs-0 (export "cross-module-funcs-0") 1 funcref)
   (global $"C388 \"FooBase(\"" (ref $JSStringImpl)
     (i32.const 4)
     (i32.const 0)
@@ -41,7 +40,7 @@
     global.set $foo1Obj
     call $checkLibraryIsLoadedFromLoadId
     i32.const 0
-    call_indirect $static0-0 (result (ref null $#Top))
+    call_indirect $cross-module-funcs-0 (result (ref null $#Top))
     drop
   )
   (func $runtimeTrue implicit getter (result i32) <...>)
diff --git a/pkg/dart2wasm/test/ir_tests/deferred.fine_grained.wat b/pkg/dart2wasm/test/ir_tests/deferred.fine_grained.wat
index b3d9a90..3325e4f 100644
--- a/pkg/dart2wasm/test/ir_tests/deferred.fine_grained.wat
+++ b/pkg/dart2wasm/test/ir_tests/deferred.fine_grained.wat
@@ -3,16 +3,9 @@
   (type $BoxedInt <...>)
   (type $JSStringImpl <...>)
   (type $Object <...>)
-  (type $type0 <...>)
-  (type $type2 <...>)
-  (type $type4 <...>)
-  (type $type6 <...>)
   (global $".FooConst0(" (import "" "FooConst0(") (ref extern))
   (global $".FooConstBase(" (import "" "FooConstBase(") (ref extern))
-  (table $static0-0 (export "static0-0") 5 (ref null $type0))
-  (table $static1-0 (export "static1-0") 4 (ref null $type2))
-  (table $static2-0 (export "static2-0") 4 (ref null $type4))
-  (table $static3-0 (export "static3-0") 4 (ref null $type6))
+  (table $cross-module-funcs-0 (export "cross-module-funcs-0") 17 funcref)
   (global $"C12 0" (ref $BoxedInt) <...>)
   (global $"C395 \"FooConstBase(\"" (ref $JSStringImpl)
     (i32.const 4)
diff --git a/pkg/dart2wasm/test/ir_tests/deferred.fine_grained_module1.wat b/pkg/dart2wasm/test/ir_tests/deferred.fine_grained_module1.wat
index e47bad3..770f7c8 100644
--- a/pkg/dart2wasm/test/ir_tests/deferred.fine_grained_module1.wat
+++ b/pkg/dart2wasm/test/ir_tests/deferred.fine_grained_module1.wat
@@ -5,11 +5,9 @@
   (type $JSStringImpl <...>)
   (type $Object <...>)
   (type $WasmListBase <...>)
+  (type $_Future <...>)
   (type $_InterfaceType <...>)
   (type $_Type <...>)
-  (type $type0 <...>)
-  (type $type2 <...>)
-  (type $type4 <...>)
   (func $"_throwIndexError <noInline>" (import "module0" "func13") (param i64 i64 (ref null $JSStringImpl)) (result (ref none)))
   (func $"foo0Code <noInline>" (import "module0" "func12") (param (ref null $#Top)) (result (ref null $#Top)))
   (func $"fooGlobal0 implicit getter" (import "module0" "func11") (result (ref $#Top)))
@@ -22,10 +20,8 @@
   (global $"C394 5" (import "module0" "global5") (ref $BoxedInt))
   (global $"C396 FooConst0" (import "module0" "global7") (ref $Object))
   (global $"C8 \")\"" (import "module0" "global4") (ref $JSStringImpl))
+  (table $module0.cross-module-funcs-0 (import "module0" "cross-module-funcs-0") 17 funcref)
   (table $module0.dispatch0 (import "module0" "dispatch0") 824 funcref)
-  (table $module0.static1-0 (import "module0" "static1-0") 4 (ref null $type2))
-  (table $module0.static2-0 (import "module0" "static2-0") 4 (ref null $type0))
-  (table $module0.static3-0 (import "module0" "static3-0") 4 (ref null $type4))
   (global $"C515 FooConst5" (ref $Object)
     (i32.const 126)
     (i32.const 0)
@@ -41,6 +37,8 @@
     (ref.null none))
   (global $fooGlobal5 (mut (ref null $#Top))
     (ref.null none))
+  (elem $module0.cross-module-funcs-0
+    (set 8 (ref.func $foo5)))
   (elem $module0.dispatch0 <...>)
   (func $"foo5Code <noInline>" (param $var0 (ref $#Top))
     (local $var1 (ref $WasmListBase))
@@ -60,39 +58,39 @@
     call $"fooGlobal0 implicit getter"
     call $"foo0Code <noInline>"
     drop
-    i32.const 0
-    call_indirect $module0.static2-0 (result (ref $#Top))
-    i32.const 0
-    call_indirect $module0.static1-0 (param (ref null $#Top)) (result (ref null $#Top))
-    drop
+    i32.const 9
+    call_indirect $module0.cross-module-funcs-0 (result (ref $#Top))
     i32.const 1
-    call_indirect $module0.static2-0 (result (ref $#Top))
-    i32.const 1
-    call_indirect $module0.static1-0 (param (ref null $#Top)) (result (ref null $#Top))
+    call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top)) (result (ref null $#Top))
     drop
-    i32.const 2
-    call_indirect $module0.static2-0 (result (ref $#Top))
-    i32.const 2
-    call_indirect $module0.static1-0 (param (ref null $#Top)) (result (ref null $#Top))
+    i32.const 10
+    call_indirect $module0.cross-module-funcs-0 (result (ref $#Top))
+    i32.const 3
+    call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top)) (result (ref null $#Top))
     drop
-    i32.const 3
-    call_indirect $module0.static2-0 (result (ref $#Top))
-    i32.const 3
-    call_indirect $module0.static1-0 (param (ref null $#Top)) (result (ref null $#Top))
+    i32.const 11
+    call_indirect $module0.cross-module-funcs-0 (result (ref $#Top))
+    i32.const 5
+    call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top)) (result (ref null $#Top))
+    drop
+    i32.const 12
+    call_indirect $module0.cross-module-funcs-0 (result (ref $#Top))
+    i32.const 7
+    call_indirect $module0.cross-module-funcs-0 (param (ref null $#Top)) (result (ref null $#Top))
     drop
     block $label0 (result (ref $WasmListBase))
       global.get $allFooConstants
       br_on_non_null $label0
       global.get $"C518 _InterfaceType"
       global.get $"C396 FooConst0"
-      i32.const 0
-      call_indirect $module0.static3-0 (result (ref $Object))
-      i32.const 1
-      call_indirect $module0.static3-0 (result (ref $Object))
-      i32.const 2
-      call_indirect $module0.static3-0 (result (ref $Object))
-      i32.const 3
-      call_indirect $module0.static3-0 (result (ref $Object))
+      i32.const 13
+      call_indirect $module0.cross-module-funcs-0 (result (ref $Object))
+      i32.const 14
+      call_indirect $module0.cross-module-funcs-0 (result (ref $Object))
+      i32.const 15
+      call_indirect $module0.cross-module-funcs-0 (result (ref $Object))
+      i32.const 16
+      call_indirect $module0.cross-module-funcs-0 (result (ref $Object))
       global.get $"C515 FooConst5"
       array.new_fixed $Array<Object?> 6
       call $GrowableList._withData
@@ -139,4 +137,5 @@
     drop
     ref.null none
   )
+  (func $foo5 (result (ref $_Future)) <...>)
 )
\ No newline at end of file
diff --git a/pkg/linter/test/rules/unawaited_futures_test.dart b/pkg/linter/test/rules/unawaited_futures_test.dart
index 3c684f3..78c9ad4 100644
--- a/pkg/linter/test/rules/unawaited_futures_test.dart
+++ b/pkg/linter/test/rules/unawaited_futures_test.dart
@@ -288,6 +288,16 @@
 ''');
   }
 
+  test_instanceProperty_unawaited_awaitNotRequired_originPrimaryConstructor() async {
+    await assertNoDiagnostics(r'''
+import 'package:meta/meta.dart';
+void f(C c) async {
+  c.p;
+}
+abstract class C(@awaitNotRequired final Future<int> p);
+''');
+  }
+
   test_instanceProperty_unawaited_awaitNotRequiredInherited() async {
     await assertNoDiagnostics(r'''
 import 'package:meta/meta.dart';
diff --git a/pkg/wasm_builder/lib/src/ir/element.dart b/pkg/wasm_builder/lib/src/ir/element.dart
index 4e172dd..0a9041a 100644
--- a/pkg/wasm_builder/lib/src/ir/element.dart
+++ b/pkg/wasm_builder/lib/src/ir/element.dart
@@ -53,13 +53,15 @@
     Tables tables,
     Globals globals,
   ) {
-    const int tableIndex = 0;
     final byte = d.readByte();
     assert(byte == 0x00 || byte == 0x02);
 
+    final useTable0Encoding = byte == 0x00;
+    final tableIndex = useTable0Encoding ? 0 : d.readUnsigned();
+
     final offset = d.deserializeTableOffset(types, functions, globals);
 
-    if (byte == 0x02) {
+    if (!useTable0Encoding) {
       final elemKind = d.readByte();
       if (elemKind != _ElemKind.refFunc) {
         throw UnimplementedError('Unsupported element kind.');
diff --git a/tools/VERSION b/tools/VERSION
index a5d3af1..594c226 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
 MAJOR 3
 MINOR 12
 PATCH 0
-PRERELEASE 66
+PRERELEASE 67
 PRERELEASE_PATCH 0