Version 2.14.0-5.0.dev

Merge commit '37f723520fe5726434e8a1cb75011c27c733f1af' into 'dev'
diff --git a/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart b/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
index f05045e..bfa4d8d 100644
--- a/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
@@ -1261,6 +1261,28 @@
         r"""A constant constructor can't call a non-constant super constructor.""");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<Message Function(String stringOKEmpty)>
+    templateConstEvalBadState =
+    const Template<Message Function(String stringOKEmpty)>(
+        messageTemplate: r"""Bad state: '#stringOKEmpty'""",
+        withArguments: _withArgumentsConstEvalBadState);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(String stringOKEmpty)> codeConstEvalBadState =
+    const Code<Message Function(String stringOKEmpty)>(
+  "ConstEvalBadState",
+);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsConstEvalBadState(String stringOKEmpty) {
+  // ignore: unnecessary_null_comparison
+  if (stringOKEmpty == null || stringOKEmpty.isEmpty) stringOKEmpty = '(empty)';
+  return new Message(codeConstEvalBadState,
+      message: """Bad state: '${stringOKEmpty}'""",
+      arguments: {'stringOKEmpty': stringOKEmpty});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 const Code<Null> codeConstEvalCircularity = messageConstEvalCircularity;
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
diff --git a/pkg/analysis_server/lib/lsp_protocol/protocol_custom_generated.dart b/pkg/analysis_server/lib/lsp_protocol/protocol_custom_generated.dart
index 53800de..4695a19 100644
--- a/pkg/analysis_server/lib/lsp_protocol/protocol_custom_generated.dart
+++ b/pkg/analysis_server/lib/lsp_protocol/protocol_custom_generated.dart
@@ -2,8 +2,6 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-// @dart = 2.9
-
 // This file has been automatically generated. Please do not edit it manually.
 // To regenerate the file, use the script
 // "pkg/analysis_server/tool/lsp_spec/generate_all.dart".
@@ -19,7 +17,6 @@
 import 'package:analysis_server/src/lsp/json_parsing.dart';
 import 'package:analysis_server/src/protocol/protocol_internal.dart';
 import 'package:analyzer/src/generated/utilities_general.dart';
-import 'package:meta/meta.dart';
 
 const jsonEncoder = JsonEncoder.withIndent('    ');
 
@@ -27,11 +24,7 @@
   static const jsonHandler = LspJsonHandler(
       AnalyzerStatusParams.canParse, AnalyzerStatusParams.fromJson);
 
-  AnalyzerStatusParams({@required this.isAnalyzing}) {
-    if (isAnalyzing == null) {
-      throw 'isAnalyzing is required but was not provided';
-    }
-  }
+  AnalyzerStatusParams({required this.isAnalyzing});
   static AnalyzerStatusParams fromJson(Map<String, dynamic> json) {
     final isAnalyzing = json['isAnalyzing'];
     return AnalyzerStatusParams(isAnalyzing: isAnalyzing);
@@ -41,8 +34,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['isAnalyzing'] =
-        isAnalyzing ?? (throw 'isAnalyzing is required but was not set');
+    __result['isAnalyzing'] = isAnalyzing;
     return __result;
   }
 
@@ -96,16 +88,9 @@
   static const jsonHandler =
       LspJsonHandler(ClosingLabel.canParse, ClosingLabel.fromJson);
 
-  ClosingLabel({@required this.range, @required this.label}) {
-    if (range == null) {
-      throw 'range is required but was not provided';
-    }
-    if (label == null) {
-      throw 'label is required but was not provided';
-    }
-  }
+  ClosingLabel({required this.range, required this.label});
   static ClosingLabel fromJson(Map<String, dynamic> json) {
-    final range = json['range'] != null ? Range.fromJson(json['range']) : null;
+    final range = Range.fromJson(json['range']);
     final label = json['label'];
     return ClosingLabel(range: range, label: label);
   }
@@ -115,9 +100,8 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['range'] =
-        range?.toJson() ?? (throw 'range is required but was not set');
-    __result['label'] = label ?? (throw 'label is required but was not set');
+    __result['range'] = range.toJson();
+    __result['label'] = label;
     return __result;
   }
 
@@ -189,14 +173,7 @@
       CompletionItemResolutionInfo.canParse,
       CompletionItemResolutionInfo.fromJson);
 
-  CompletionItemResolutionInfo({@required this.file, @required this.offset}) {
-    if (file == null) {
-      throw 'file is required but was not provided';
-    }
-    if (offset == null) {
-      throw 'offset is required but was not provided';
-    }
-  }
+  CompletionItemResolutionInfo({required this.file, required this.offset});
   static CompletionItemResolutionInfo fromJson(Map<String, dynamic> json) {
     if (DartCompletionItemResolutionInfo.canParse(json, nullLspJsonReporter)) {
       return DartCompletionItemResolutionInfo.fromJson(json);
@@ -211,8 +188,8 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['file'] = file ?? (throw 'file is required but was not set');
-    __result['offset'] = offset ?? (throw 'offset is required but was not set');
+    __result['file'] = file;
+    __result['offset'] = offset;
     return __result;
   }
 
@@ -287,35 +264,13 @@
       DartCompletionItemResolutionInfo.fromJson);
 
   DartCompletionItemResolutionInfo(
-      {@required this.libId,
-      @required this.displayUri,
-      @required this.rOffset,
-      @required this.iLength,
-      @required this.rLength,
-      @required this.file,
-      @required this.offset}) {
-    if (libId == null) {
-      throw 'libId is required but was not provided';
-    }
-    if (displayUri == null) {
-      throw 'displayUri is required but was not provided';
-    }
-    if (rOffset == null) {
-      throw 'rOffset is required but was not provided';
-    }
-    if (iLength == null) {
-      throw 'iLength is required but was not provided';
-    }
-    if (rLength == null) {
-      throw 'rLength is required but was not provided';
-    }
-    if (file == null) {
-      throw 'file is required but was not provided';
-    }
-    if (offset == null) {
-      throw 'offset is required but was not provided';
-    }
-  }
+      {required this.libId,
+      required this.displayUri,
+      required this.rOffset,
+      required this.iLength,
+      required this.rLength,
+      required this.file,
+      required this.offset});
   static DartCompletionItemResolutionInfo fromJson(Map<String, dynamic> json) {
     final libId = json['libId'];
     final displayUri = json['displayUri'];
@@ -344,17 +299,13 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['libId'] = libId ?? (throw 'libId is required but was not set');
-    __result['displayUri'] =
-        displayUri ?? (throw 'displayUri is required but was not set');
-    __result['rOffset'] =
-        rOffset ?? (throw 'rOffset is required but was not set');
-    __result['iLength'] =
-        iLength ?? (throw 'iLength is required but was not set');
-    __result['rLength'] =
-        rLength ?? (throw 'rLength is required but was not set');
-    __result['file'] = file ?? (throw 'file is required but was not set');
-    __result['offset'] = offset ?? (throw 'offset is required but was not set');
+    __result['libId'] = libId;
+    __result['displayUri'] = displayUri;
+    __result['rOffset'] = rOffset;
+    __result['iLength'] = iLength;
+    __result['rLength'] = rLength;
+    __result['file'] = file;
+    __result['offset'] = offset;
     return __result;
   }
 
@@ -523,11 +474,7 @@
   static const jsonHandler = LspJsonHandler(
       DartDiagnosticServer.canParse, DartDiagnosticServer.fromJson);
 
-  DartDiagnosticServer({@required this.port}) {
-    if (port == null) {
-      throw 'port is required but was not provided';
-    }
-  }
+  DartDiagnosticServer({required this.port});
   static DartDiagnosticServer fromJson(Map<String, dynamic> json) {
     final port = json['port'];
     return DartDiagnosticServer(port: port);
@@ -537,7 +484,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['port'] = port ?? (throw 'port is required but was not set');
+    __result['port'] = port;
     return __result;
   }
 
@@ -592,18 +539,11 @@
 
   Element(
       {this.range,
-      @required this.name,
-      @required this.kind,
+      required this.name,
+      required this.kind,
       this.parameters,
       this.typeParameters,
-      this.returnType}) {
-    if (name == null) {
-      throw 'name is required but was not provided';
-    }
-    if (kind == null) {
-      throw 'kind is required but was not provided';
-    }
-  }
+      this.returnType});
   static Element fromJson(Map<String, dynamic> json) {
     final range = json['range'] != null ? Range.fromJson(json['range']) : null;
     final name = json['name'];
@@ -622,18 +562,18 @@
 
   final String kind;
   final String name;
-  final String parameters;
-  final Range range;
-  final String returnType;
-  final String typeParameters;
+  final String? parameters;
+  final Range? range;
+  final String? returnType;
+  final String? typeParameters;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
     if (range != null) {
-      __result['range'] = range.toJson();
+      __result['range'] = range?.toJson();
     }
-    __result['name'] = name ?? (throw 'name is required but was not set');
-    __result['kind'] = kind ?? (throw 'kind is required but was not set');
+    __result['name'] = name;
+    __result['kind'] = kind;
     if (parameters != null) {
       __result['parameters'] = parameters;
     }
@@ -761,25 +701,15 @@
       LspJsonHandler(FlutterOutline.canParse, FlutterOutline.fromJson);
 
   FlutterOutline(
-      {@required this.kind,
+      {required this.kind,
       this.label,
       this.className,
       this.variableName,
       this.attributes,
       this.dartElement,
-      @required this.range,
-      @required this.codeRange,
-      this.children}) {
-    if (kind == null) {
-      throw 'kind is required but was not provided';
-    }
-    if (range == null) {
-      throw 'range is required but was not provided';
-    }
-    if (codeRange == null) {
-      throw 'codeRange is required but was not provided';
-    }
-  }
+      required this.range,
+      required this.codeRange,
+      this.children});
   static FlutterOutline fromJson(Map<String, dynamic> json) {
     final kind = json['kind'];
     final label = json['label'];
@@ -793,9 +723,8 @@
     final dartElement = json['dartElement'] != null
         ? Element.fromJson(json['dartElement'])
         : null;
-    final range = json['range'] != null ? Range.fromJson(json['range']) : null;
-    final codeRange =
-        json['codeRange'] != null ? Range.fromJson(json['codeRange']) : null;
+    final range = Range.fromJson(json['range']);
+    final codeRange = Range.fromJson(json['codeRange']);
     final children = json['children']
         ?.map((item) => item != null ? FlutterOutline.fromJson(item) : null)
         ?.cast<FlutterOutline>()
@@ -812,19 +741,19 @@
         children: children);
   }
 
-  final List<FlutterOutlineAttribute> attributes;
-  final List<FlutterOutline> children;
-  final String className;
+  final List<FlutterOutlineAttribute>? attributes;
+  final List<FlutterOutline>? children;
+  final String? className;
   final Range codeRange;
-  final Element dartElement;
+  final Element? dartElement;
   final String kind;
-  final String label;
+  final String? label;
   final Range range;
-  final String variableName;
+  final String? variableName;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['kind'] = kind ?? (throw 'kind is required but was not set');
+    __result['kind'] = kind;
     if (label != null) {
       __result['label'] = label;
     }
@@ -835,17 +764,16 @@
       __result['variableName'] = variableName;
     }
     if (attributes != null) {
-      __result['attributes'] = attributes.map((item) => item.toJson()).toList();
+      __result['attributes'] =
+          attributes?.map((item) => item.toJson()).toList();
     }
     if (dartElement != null) {
-      __result['dartElement'] = dartElement.toJson();
+      __result['dartElement'] = dartElement?.toJson();
     }
-    __result['range'] =
-        range?.toJson() ?? (throw 'range is required but was not set');
-    __result['codeRange'] =
-        codeRange?.toJson() ?? (throw 'codeRange is required but was not set');
+    __result['range'] = range.toJson();
+    __result['codeRange'] = codeRange.toJson();
     if (children != null) {
-      __result['children'] = children.map((item) => item.toJson()).toList();
+      __result['children'] = children?.map((item) => item.toJson()).toList();
     }
     return __result;
   }
@@ -1017,14 +945,7 @@
       FlutterOutlineAttribute.canParse, FlutterOutlineAttribute.fromJson);
 
   FlutterOutlineAttribute(
-      {@required this.name, @required this.label, this.valueRange}) {
-    if (name == null) {
-      throw 'name is required but was not provided';
-    }
-    if (label == null) {
-      throw 'label is required but was not provided';
-    }
-  }
+      {required this.name, required this.label, this.valueRange});
   static FlutterOutlineAttribute fromJson(Map<String, dynamic> json) {
     final name = json['name'];
     final label = json['label'];
@@ -1036,14 +957,14 @@
 
   final String label;
   final String name;
-  final Range valueRange;
+  final Range? valueRange;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['name'] = name ?? (throw 'name is required but was not set');
-    __result['label'] = label ?? (throw 'label is required but was not set');
+    __result['name'] = name;
+    __result['label'] = label;
     if (valueRange != null) {
-      __result['valueRange'] = valueRange.toJson();
+      __result['valueRange'] = valueRange?.toJson();
     }
     return __result;
   }
@@ -1130,26 +1051,14 @@
   static const jsonHandler = LspJsonHandler(Outline.canParse, Outline.fromJson);
 
   Outline(
-      {@required this.element,
-      @required this.range,
-      @required this.codeRange,
-      this.children}) {
-    if (element == null) {
-      throw 'element is required but was not provided';
-    }
-    if (range == null) {
-      throw 'range is required but was not provided';
-    }
-    if (codeRange == null) {
-      throw 'codeRange is required but was not provided';
-    }
-  }
+      {required this.element,
+      required this.range,
+      required this.codeRange,
+      this.children});
   static Outline fromJson(Map<String, dynamic> json) {
-    final element =
-        json['element'] != null ? Element.fromJson(json['element']) : null;
-    final range = json['range'] != null ? Range.fromJson(json['range']) : null;
-    final codeRange =
-        json['codeRange'] != null ? Range.fromJson(json['codeRange']) : null;
+    final element = Element.fromJson(json['element']);
+    final range = Range.fromJson(json['range']);
+    final codeRange = Range.fromJson(json['codeRange']);
     final children = json['children']
         ?.map((item) => item != null ? Outline.fromJson(item) : null)
         ?.cast<Outline>()
@@ -1161,21 +1070,18 @@
         children: children);
   }
 
-  final List<Outline> children;
+  final List<Outline>? children;
   final Range codeRange;
   final Element element;
   final Range range;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['element'] =
-        element?.toJson() ?? (throw 'element is required but was not set');
-    __result['range'] =
-        range?.toJson() ?? (throw 'range is required but was not set');
-    __result['codeRange'] =
-        codeRange?.toJson() ?? (throw 'codeRange is required but was not set');
+    __result['element'] = element.toJson();
+    __result['range'] = range.toJson();
+    __result['codeRange'] = codeRange.toJson();
     if (children != null) {
-      __result['children'] = children.map((item) => item.toJson()).toList();
+      __result['children'] = children?.map((item) => item.toJson()).toList();
     }
     return __result;
   }
@@ -1283,18 +1189,11 @@
   static const jsonHandler = LspJsonHandler(
       PublishClosingLabelsParams.canParse, PublishClosingLabelsParams.fromJson);
 
-  PublishClosingLabelsParams({@required this.uri, @required this.labels}) {
-    if (uri == null) {
-      throw 'uri is required but was not provided';
-    }
-    if (labels == null) {
-      throw 'labels is required but was not provided';
-    }
-  }
+  PublishClosingLabelsParams({required this.uri, required this.labels});
   static PublishClosingLabelsParams fromJson(Map<String, dynamic> json) {
     final uri = json['uri'];
     final labels = json['labels']
-        ?.map((item) => item != null ? ClosingLabel.fromJson(item) : null)
+        ?.map((item) => ClosingLabel.fromJson(item))
         ?.cast<ClosingLabel>()
         ?.toList();
     return PublishClosingLabelsParams(uri: uri, labels: labels);
@@ -1305,9 +1204,8 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['uri'] = uri ?? (throw 'uri is required but was not set');
-    __result['labels'] = labels?.map((item) => item.toJson())?.toList() ??
-        (throw 'labels is required but was not set');
+    __result['uri'] = uri;
+    __result['labels'] = labels.map((item) => item.toJson()).toList();
     return __result;
   }
 
@@ -1385,19 +1283,10 @@
       PublishFlutterOutlineParams.canParse,
       PublishFlutterOutlineParams.fromJson);
 
-  PublishFlutterOutlineParams({@required this.uri, @required this.outline}) {
-    if (uri == null) {
-      throw 'uri is required but was not provided';
-    }
-    if (outline == null) {
-      throw 'outline is required but was not provided';
-    }
-  }
+  PublishFlutterOutlineParams({required this.uri, required this.outline});
   static PublishFlutterOutlineParams fromJson(Map<String, dynamic> json) {
     final uri = json['uri'];
-    final outline = json['outline'] != null
-        ? FlutterOutline.fromJson(json['outline'])
-        : null;
+    final outline = FlutterOutline.fromJson(json['outline']);
     return PublishFlutterOutlineParams(uri: uri, outline: outline);
   }
 
@@ -1406,9 +1295,8 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['uri'] = uri ?? (throw 'uri is required but was not set');
-    __result['outline'] =
-        outline?.toJson() ?? (throw 'outline is required but was not set');
+    __result['uri'] = uri;
+    __result['outline'] = outline.toJson();
     return __result;
   }
 
@@ -1480,18 +1368,10 @@
   static const jsonHandler = LspJsonHandler(
       PublishOutlineParams.canParse, PublishOutlineParams.fromJson);
 
-  PublishOutlineParams({@required this.uri, @required this.outline}) {
-    if (uri == null) {
-      throw 'uri is required but was not provided';
-    }
-    if (outline == null) {
-      throw 'outline is required but was not provided';
-    }
-  }
+  PublishOutlineParams({required this.uri, required this.outline});
   static PublishOutlineParams fromJson(Map<String, dynamic> json) {
     final uri = json['uri'];
-    final outline =
-        json['outline'] != null ? Outline.fromJson(json['outline']) : null;
+    final outline = Outline.fromJson(json['outline']);
     return PublishOutlineParams(uri: uri, outline: outline);
   }
 
@@ -1500,9 +1380,8 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['uri'] = uri ?? (throw 'uri is required but was not set');
-    __result['outline'] =
-        outline?.toJson() ?? (throw 'outline is required but was not set');
+    __result['uri'] = uri;
+    __result['outline'] = outline.toJson();
     return __result;
   }
 
@@ -1575,24 +1454,13 @@
       LspJsonHandler(SnippetTextEdit.canParse, SnippetTextEdit.fromJson);
 
   SnippetTextEdit(
-      {@required this.insertTextFormat,
-      @required this.range,
-      @required this.newText}) {
-    if (insertTextFormat == null) {
-      throw 'insertTextFormat is required but was not provided';
-    }
-    if (range == null) {
-      throw 'range is required but was not provided';
-    }
-    if (newText == null) {
-      throw 'newText is required but was not provided';
-    }
-  }
+      {required this.insertTextFormat,
+      required this.range,
+      required this.newText});
   static SnippetTextEdit fromJson(Map<String, dynamic> json) {
-    final insertTextFormat = json['insertTextFormat'] != null
-        ? InsertTextFormat.fromJson(json['insertTextFormat'])
-        : null;
-    final range = json['range'] != null ? Range.fromJson(json['range']) : null;
+    final insertTextFormat =
+        InsertTextFormat.fromJson(json['insertTextFormat']);
+    final range = Range.fromJson(json['range']);
     final newText = json['newText'];
     return SnippetTextEdit(
         insertTextFormat: insertTextFormat, range: range, newText: newText);
@@ -1609,12 +1477,9 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['insertTextFormat'] = insertTextFormat?.toJson() ??
-        (throw 'insertTextFormat is required but was not set');
-    __result['range'] =
-        range?.toJson() ?? (throw 'range is required but was not set');
-    __result['newText'] =
-        newText ?? (throw 'newText is required but was not set');
+    __result['insertTextFormat'] = insertTextFormat.toJson();
+    __result['range'] = range.toJson();
+    __result['newText'] = newText;
     return __result;
   }
 
diff --git a/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart b/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart
index ec98cde..c183159 100644
--- a/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart
+++ b/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart
@@ -2,8 +2,6 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-// @dart = 2.9
-
 // This file has been automatically generated. Please do not edit it manually.
 // To regenerate the file, use the script
 // "pkg/analysis_server/tool/lsp_spec/generate_all.dart".
@@ -19,7 +17,6 @@
 import 'package:analysis_server/src/lsp/json_parsing.dart';
 import 'package:analysis_server/src/protocol/protocol_internal.dart';
 import 'package:analyzer/src/generated/utilities_general.dart';
-import 'package:meta/meta.dart';
 
 const jsonEncoder = JsonEncoder.withIndent('    ');
 
@@ -30,22 +27,10 @@
       LspJsonHandler(AnnotatedTextEdit.canParse, AnnotatedTextEdit.fromJson);
 
   AnnotatedTextEdit(
-      {@required this.annotationId,
-      @required this.range,
-      @required this.newText}) {
-    if (annotationId == null) {
-      throw 'annotationId is required but was not provided';
-    }
-    if (range == null) {
-      throw 'range is required but was not provided';
-    }
-    if (newText == null) {
-      throw 'newText is required but was not provided';
-    }
-  }
+      {required this.annotationId, required this.range, required this.newText});
   static AnnotatedTextEdit fromJson(Map<String, dynamic> json) {
     final annotationId = json['annotationId'];
-    final range = json['range'] != null ? Range.fromJson(json['range']) : null;
+    final range = Range.fromJson(json['range']);
     final newText = json['newText'];
     return AnnotatedTextEdit(
         annotationId: annotationId, range: range, newText: newText);
@@ -63,12 +48,9 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['annotationId'] =
-        annotationId ?? (throw 'annotationId is required but was not set');
-    __result['range'] =
-        range?.toJson() ?? (throw 'range is required but was not set');
-    __result['newText'] =
-        newText ?? (throw 'newText is required but was not set');
+    __result['annotationId'] = annotationId;
+    __result['range'] = range.toJson();
+    __result['newText'] = newText;
     return __result;
   }
 
@@ -160,15 +142,10 @@
   static const jsonHandler = LspJsonHandler(
       ApplyWorkspaceEditParams.canParse, ApplyWorkspaceEditParams.fromJson);
 
-  ApplyWorkspaceEditParams({this.label, @required this.edit}) {
-    if (edit == null) {
-      throw 'edit is required but was not provided';
-    }
-  }
+  ApplyWorkspaceEditParams({this.label, required this.edit});
   static ApplyWorkspaceEditParams fromJson(Map<String, dynamic> json) {
     final label = json['label'];
-    final edit =
-        json['edit'] != null ? WorkspaceEdit.fromJson(json['edit']) : null;
+    final edit = WorkspaceEdit.fromJson(json['edit']);
     return ApplyWorkspaceEditParams(label: label, edit: edit);
   }
 
@@ -177,15 +154,14 @@
 
   /// An optional label of the workspace edit. This label is presented in the
   /// user interface for example on an undo stack to undo the workspace edit.
-  final String label;
+  final String? label;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
     if (label != null) {
       __result['label'] = label;
     }
-    __result['edit'] =
-        edit?.toJson() ?? (throw 'edit is required but was not set');
+    __result['edit'] = edit.toJson();
     return __result;
   }
 
@@ -250,11 +226,7 @@
       ApplyWorkspaceEditResponse.canParse, ApplyWorkspaceEditResponse.fromJson);
 
   ApplyWorkspaceEditResponse(
-      {@required this.applied, this.failureReason, this.failedChange}) {
-    if (applied == null) {
-      throw 'applied is required but was not provided';
-    }
-  }
+      {required this.applied, this.failureReason, this.failedChange});
   static ApplyWorkspaceEditResponse fromJson(Map<String, dynamic> json) {
     final applied = json['applied'];
     final failureReason = json['failureReason'];
@@ -272,17 +244,16 @@
   /// contain the index of the change that failed. This property is only
   /// available if the client signals a `failureHandlingStrategy` in its client
   /// capabilities.
-  final num failedChange;
+  final num? failedChange;
 
   /// An optional textual description for why the edit was not applied. This may
   /// be used by the server for diagnostic logging or to provide a suitable
   /// error for a request that triggered the edit.
-  final String failureReason;
+  final String? failureReason;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['applied'] =
-        applied ?? (throw 'applied is required but was not set');
+    __result['applied'] = applied;
     if (failureReason != null) {
       __result['failureReason'] = failureReason;
     }
@@ -377,7 +348,7 @@
   /// `true` the client supports the new `(TextDocumentRegistrationOptions &
   /// StaticRegistrationOptions)` return value for the corresponding server
   /// capability as well.
-  final bool dynamicRegistration;
+  final bool? dynamicRegistration;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -430,19 +401,11 @@
   static const jsonHandler = LspJsonHandler(
       CallHierarchyIncomingCall.canParse, CallHierarchyIncomingCall.fromJson);
 
-  CallHierarchyIncomingCall({@required this.from, @required this.fromRanges}) {
-    if (from == null) {
-      throw 'from is required but was not provided';
-    }
-    if (fromRanges == null) {
-      throw 'fromRanges is required but was not provided';
-    }
-  }
+  CallHierarchyIncomingCall({required this.from, required this.fromRanges});
   static CallHierarchyIncomingCall fromJson(Map<String, dynamic> json) {
-    final from =
-        json['from'] != null ? CallHierarchyItem.fromJson(json['from']) : null;
+    final from = CallHierarchyItem.fromJson(json['from']);
     final fromRanges = json['fromRanges']
-        ?.map((item) => item != null ? Range.fromJson(item) : null)
+        ?.map((item) => Range.fromJson(item))
         ?.cast<Range>()
         ?.toList();
     return CallHierarchyIncomingCall(from: from, fromRanges: fromRanges);
@@ -457,11 +420,8 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['from'] =
-        from?.toJson() ?? (throw 'from is required but was not set');
-    __result['fromRanges'] =
-        fromRanges?.map((item) => item.toJson())?.toList() ??
-            (throw 'fromRanges is required but was not set');
+    __result['from'] = from.toJson();
+    __result['fromRanges'] = fromRanges.map((item) => item.toJson()).toList();
     return __result;
   }
 
@@ -541,27 +501,22 @@
       CallHierarchyIncomingCallsParams.fromJson);
 
   CallHierarchyIncomingCallsParams(
-      {@required this.item, this.workDoneToken, this.partialResultToken}) {
-    if (item == null) {
-      throw 'item is required but was not provided';
-    }
-  }
+      {required this.item, this.workDoneToken, this.partialResultToken});
   static CallHierarchyIncomingCallsParams fromJson(Map<String, dynamic> json) {
-    final item =
-        json['item'] != null ? CallHierarchyItem.fromJson(json['item']) : null;
-    final workDoneToken = json['workDoneToken'] is num
-        ? Either2<num, String>.t1(json['workDoneToken'])
-        : (json['workDoneToken'] is String
-            ? Either2<num, String>.t2(json['workDoneToken'])
-            : (json['workDoneToken'] == null
-                ? null
+    final item = CallHierarchyItem.fromJson(json['item']);
+    final workDoneToken = json['workDoneToken'] == null
+        ? null
+        : (json['workDoneToken'] is num
+            ? Either2<num, String>.t1(json['workDoneToken'])
+            : (json['workDoneToken'] is String
+                ? Either2<num, String>.t2(json['workDoneToken'])
                 : (throw '''${json['workDoneToken']} was not one of (num, String)''')));
-    final partialResultToken = json['partialResultToken'] is num
-        ? Either2<num, String>.t1(json['partialResultToken'])
-        : (json['partialResultToken'] is String
-            ? Either2<num, String>.t2(json['partialResultToken'])
-            : (json['partialResultToken'] == null
-                ? null
+    final partialResultToken = json['partialResultToken'] == null
+        ? null
+        : (json['partialResultToken'] is num
+            ? Either2<num, String>.t1(json['partialResultToken'])
+            : (json['partialResultToken'] is String
+                ? Either2<num, String>.t2(json['partialResultToken'])
                 : (throw '''${json['partialResultToken']} was not one of (num, String)''')));
     return CallHierarchyIncomingCallsParams(
         item: item,
@@ -573,15 +528,14 @@
 
   /// An optional token that a server can use to report partial results (e.g.
   /// streaming) to the client.
-  final Either2<num, String> partialResultToken;
+  final Either2<num, String>? partialResultToken;
 
   /// An optional token that a server can use to report work done progress.
-  final Either2<num, String> workDoneToken;
+  final Either2<num, String>? workDoneToken;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['item'] =
-        item?.toJson() ?? (throw 'item is required but was not set');
+    __result['item'] = item.toJson();
     if (workDoneToken != null) {
       __result['workDoneToken'] = workDoneToken;
     }
@@ -669,44 +623,25 @@
       LspJsonHandler(CallHierarchyItem.canParse, CallHierarchyItem.fromJson);
 
   CallHierarchyItem(
-      {@required this.name,
-      @required this.kind,
+      {required this.name,
+      required this.kind,
       this.tags,
       this.detail,
-      @required this.uri,
-      @required this.range,
-      @required this.selectionRange,
-      this.data}) {
-    if (name == null) {
-      throw 'name is required but was not provided';
-    }
-    if (kind == null) {
-      throw 'kind is required but was not provided';
-    }
-    if (uri == null) {
-      throw 'uri is required but was not provided';
-    }
-    if (range == null) {
-      throw 'range is required but was not provided';
-    }
-    if (selectionRange == null) {
-      throw 'selectionRange is required but was not provided';
-    }
-  }
+      required this.uri,
+      required this.range,
+      required this.selectionRange,
+      this.data});
   static CallHierarchyItem fromJson(Map<String, dynamic> json) {
     final name = json['name'];
-    final kind =
-        json['kind'] != null ? SymbolKind.fromJson(json['kind']) : null;
+    final kind = SymbolKind.fromJson(json['kind']);
     final tags = json['tags']
         ?.map((item) => item != null ? SymbolTag.fromJson(item) : null)
         ?.cast<SymbolTag>()
         ?.toList();
     final detail = json['detail'];
     final uri = json['uri'];
-    final range = json['range'] != null ? Range.fromJson(json['range']) : null;
-    final selectionRange = json['selectionRange'] != null
-        ? Range.fromJson(json['selectionRange'])
-        : null;
+    final range = Range.fromJson(json['range']);
+    final selectionRange = Range.fromJson(json['selectionRange']);
     final data = json['data'];
     return CallHierarchyItem(
         name: name,
@@ -724,7 +659,7 @@
   final dynamic data;
 
   /// More detail for this item, e.g. the signature of a function.
-  final String detail;
+  final String? detail;
 
   /// The kind of this item.
   final SymbolKind kind;
@@ -742,27 +677,24 @@
   final Range selectionRange;
 
   /// Tags for this item.
-  final List<SymbolTag> tags;
+  final List<SymbolTag>? tags;
 
   /// The resource identifier of this item.
   final String uri;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['name'] = name ?? (throw 'name is required but was not set');
-    __result['kind'] =
-        kind?.toJson() ?? (throw 'kind is required but was not set');
+    __result['name'] = name;
+    __result['kind'] = kind.toJson();
     if (tags != null) {
-      __result['tags'] = tags.map((item) => item.toJson()).toList();
+      __result['tags'] = tags?.map((item) => item.toJson()).toList();
     }
     if (detail != null) {
       __result['detail'] = detail;
     }
-    __result['uri'] = uri ?? (throw 'uri is required but was not set');
-    __result['range'] =
-        range?.toJson() ?? (throw 'range is required but was not set');
-    __result['selectionRange'] = selectionRange?.toJson() ??
-        (throw 'selectionRange is required but was not set');
+    __result['uri'] = uri;
+    __result['range'] = range.toJson();
+    __result['selectionRange'] = selectionRange.toJson();
     if (data != null) {
       __result['data'] = data;
     }
@@ -877,15 +809,6 @@
       } finally {
         reporter.pop();
       }
-      reporter.push('data');
-      try {
-        if (obj['data'] != null && !(true)) {
-          reporter.reportError('must be of type dynamic');
-          return false;
-        }
-      } finally {
-        reporter.pop();
-      }
       return true;
     } else {
       reporter.reportError('must be of type CallHierarchyItem');
@@ -940,7 +863,7 @@
     return CallHierarchyOptions(workDoneProgress: workDoneProgress);
   }
 
-  final bool workDoneProgress;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -993,19 +916,11 @@
   static const jsonHandler = LspJsonHandler(
       CallHierarchyOutgoingCall.canParse, CallHierarchyOutgoingCall.fromJson);
 
-  CallHierarchyOutgoingCall({@required this.to, @required this.fromRanges}) {
-    if (to == null) {
-      throw 'to is required but was not provided';
-    }
-    if (fromRanges == null) {
-      throw 'fromRanges is required but was not provided';
-    }
-  }
+  CallHierarchyOutgoingCall({required this.to, required this.fromRanges});
   static CallHierarchyOutgoingCall fromJson(Map<String, dynamic> json) {
-    final to =
-        json['to'] != null ? CallHierarchyItem.fromJson(json['to']) : null;
+    final to = CallHierarchyItem.fromJson(json['to']);
     final fromRanges = json['fromRanges']
-        ?.map((item) => item != null ? Range.fromJson(item) : null)
+        ?.map((item) => Range.fromJson(item))
         ?.cast<Range>()
         ?.toList();
     return CallHierarchyOutgoingCall(to: to, fromRanges: fromRanges);
@@ -1020,10 +935,8 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['to'] = to?.toJson() ?? (throw 'to is required but was not set');
-    __result['fromRanges'] =
-        fromRanges?.map((item) => item.toJson())?.toList() ??
-            (throw 'fromRanges is required but was not set');
+    __result['to'] = to.toJson();
+    __result['fromRanges'] = fromRanges.map((item) => item.toJson()).toList();
     return __result;
   }
 
@@ -1103,27 +1016,22 @@
       CallHierarchyOutgoingCallsParams.fromJson);
 
   CallHierarchyOutgoingCallsParams(
-      {@required this.item, this.workDoneToken, this.partialResultToken}) {
-    if (item == null) {
-      throw 'item is required but was not provided';
-    }
-  }
+      {required this.item, this.workDoneToken, this.partialResultToken});
   static CallHierarchyOutgoingCallsParams fromJson(Map<String, dynamic> json) {
-    final item =
-        json['item'] != null ? CallHierarchyItem.fromJson(json['item']) : null;
-    final workDoneToken = json['workDoneToken'] is num
-        ? Either2<num, String>.t1(json['workDoneToken'])
-        : (json['workDoneToken'] is String
-            ? Either2<num, String>.t2(json['workDoneToken'])
-            : (json['workDoneToken'] == null
-                ? null
+    final item = CallHierarchyItem.fromJson(json['item']);
+    final workDoneToken = json['workDoneToken'] == null
+        ? null
+        : (json['workDoneToken'] is num
+            ? Either2<num, String>.t1(json['workDoneToken'])
+            : (json['workDoneToken'] is String
+                ? Either2<num, String>.t2(json['workDoneToken'])
                 : (throw '''${json['workDoneToken']} was not one of (num, String)''')));
-    final partialResultToken = json['partialResultToken'] is num
-        ? Either2<num, String>.t1(json['partialResultToken'])
-        : (json['partialResultToken'] is String
-            ? Either2<num, String>.t2(json['partialResultToken'])
-            : (json['partialResultToken'] == null
-                ? null
+    final partialResultToken = json['partialResultToken'] == null
+        ? null
+        : (json['partialResultToken'] is num
+            ? Either2<num, String>.t1(json['partialResultToken'])
+            : (json['partialResultToken'] is String
+                ? Either2<num, String>.t2(json['partialResultToken'])
                 : (throw '''${json['partialResultToken']} was not one of (num, String)''')));
     return CallHierarchyOutgoingCallsParams(
         item: item,
@@ -1135,15 +1043,14 @@
 
   /// An optional token that a server can use to report partial results (e.g.
   /// streaming) to the client.
-  final Either2<num, String> partialResultToken;
+  final Either2<num, String>? partialResultToken;
 
   /// An optional token that a server can use to report work done progress.
-  final Either2<num, String> workDoneToken;
+  final Either2<num, String>? workDoneToken;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['item'] =
-        item?.toJson() ?? (throw 'item is required but was not set');
+    __result['item'] = item.toJson();
     if (workDoneToken != null) {
       __result['workDoneToken'] = workDoneToken;
     }
@@ -1232,28 +1139,16 @@
       CallHierarchyPrepareParams.canParse, CallHierarchyPrepareParams.fromJson);
 
   CallHierarchyPrepareParams(
-      {@required this.textDocument,
-      @required this.position,
-      this.workDoneToken}) {
-    if (textDocument == null) {
-      throw 'textDocument is required but was not provided';
-    }
-    if (position == null) {
-      throw 'position is required but was not provided';
-    }
-  }
+      {required this.textDocument, required this.position, this.workDoneToken});
   static CallHierarchyPrepareParams fromJson(Map<String, dynamic> json) {
-    final textDocument = json['textDocument'] != null
-        ? TextDocumentIdentifier.fromJson(json['textDocument'])
-        : null;
-    final position =
-        json['position'] != null ? Position.fromJson(json['position']) : null;
-    final workDoneToken = json['workDoneToken'] is num
-        ? Either2<num, String>.t1(json['workDoneToken'])
-        : (json['workDoneToken'] is String
-            ? Either2<num, String>.t2(json['workDoneToken'])
-            : (json['workDoneToken'] == null
-                ? null
+    final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
+    final position = Position.fromJson(json['position']);
+    final workDoneToken = json['workDoneToken'] == null
+        ? null
+        : (json['workDoneToken'] is num
+            ? Either2<num, String>.t1(json['workDoneToken'])
+            : (json['workDoneToken'] is String
+                ? Either2<num, String>.t2(json['workDoneToken'])
                 : (throw '''${json['workDoneToken']} was not one of (num, String)''')));
     return CallHierarchyPrepareParams(
         textDocument: textDocument,
@@ -1268,14 +1163,12 @@
   final TextDocumentIdentifier textDocument;
 
   /// An optional token that a server can use to report work done progress.
-  final Either2<num, String> workDoneToken;
+  final Either2<num, String>? workDoneToken;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['textDocument'] = textDocument?.toJson() ??
-        (throw 'textDocument is required but was not set');
-    __result['position'] =
-        position?.toJson() ?? (throw 'position is required but was not set');
+    __result['textDocument'] = textDocument.toJson();
+    __result['position'] = position.toJson();
     if (workDoneToken != null) {
       __result['workDoneToken'] = workDoneToken;
     }
@@ -1388,12 +1281,12 @@
 
   /// A document selector to identify the scope of the registration. If set to
   /// null the document selector provided on the client side will be used.
-  final List<DocumentFilter> documentSelector;
+  final List<DocumentFilter>? documentSelector;
 
   /// The id used to register the request. The id can be used to deregister the
   /// request again. See also Registration#id.
-  final String id;
-  final bool workDoneProgress;
+  final String? id;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -1481,11 +1374,7 @@
   static const jsonHandler =
       LspJsonHandler(CancelParams.canParse, CancelParams.fromJson);
 
-  CancelParams({@required this.id}) {
-    if (id == null) {
-      throw 'id is required but was not provided';
-    }
-  }
+  CancelParams({required this.id});
   static CancelParams fromJson(Map<String, dynamic> json) {
     final id = json['id'] is num
         ? Either2<num, String>.t1(json['id'])
@@ -1500,7 +1389,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['id'] = id ?? (throw 'id is required but was not set');
+    __result['id'] = id;
     return __result;
   }
 
@@ -1556,11 +1445,7 @@
       LspJsonHandler(ChangeAnnotation.canParse, ChangeAnnotation.fromJson);
 
   ChangeAnnotation(
-      {@required this.label, this.needsConfirmation, this.description}) {
-    if (label == null) {
-      throw 'label is required but was not provided';
-    }
-  }
+      {required this.label, this.needsConfirmation, this.description});
   static ChangeAnnotation fromJson(Map<String, dynamic> json) {
     final label = json['label'];
     final needsConfirmation = json['needsConfirmation'];
@@ -1573,7 +1458,7 @@
 
   /// A human-readable string which is rendered less prominent in the user
   /// interface.
-  final String description;
+  final String? description;
 
   /// A human-readable string describing the actual change. The string is
   /// rendered prominent in the user interface.
@@ -1581,11 +1466,11 @@
 
   /// A flag which indicates that user confirmation is needed before applying
   /// the change.
-  final bool needsConfirmation;
+  final bool? needsConfirmation;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['label'] = label ?? (throw 'label is required but was not set');
+    __result['label'] = label;
     if (needsConfirmation != null) {
       __result['needsConfirmation'] = needsConfirmation;
     }
@@ -1701,30 +1586,30 @@
 
   /// General client capabilities.
   ///  @since 3.16.0
-  final ClientCapabilitiesGeneral general;
+  final ClientCapabilitiesGeneral? general;
 
   /// Text document specific client capabilities.
-  final TextDocumentClientCapabilities textDocument;
+  final TextDocumentClientCapabilities? textDocument;
 
   /// Window specific client capabilities.
-  final ClientCapabilitiesWindow window;
+  final ClientCapabilitiesWindow? window;
 
   /// Workspace specific client capabilities.
-  final ClientCapabilitiesWorkspace workspace;
+  final ClientCapabilitiesWorkspace? workspace;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
     if (workspace != null) {
-      __result['workspace'] = workspace.toJson();
+      __result['workspace'] = workspace?.toJson();
     }
     if (textDocument != null) {
-      __result['textDocument'] = textDocument.toJson();
+      __result['textDocument'] = textDocument?.toJson();
     }
     if (window != null) {
-      __result['window'] = window.toJson();
+      __result['window'] = window?.toJson();
     }
     if (general != null) {
-      __result['general'] = general.toJson();
+      __result['general'] = general?.toJson();
     }
     if (experimental != null) {
       __result['experimental'] = experimental;
@@ -1777,15 +1662,6 @@
       } finally {
         reporter.pop();
       }
-      reporter.push('experimental');
-      try {
-        if (obj['experimental'] != null && !(true)) {
-          reporter.reportError('must be of type dynamic');
-          return false;
-        }
-      } finally {
-        reporter.pop();
-      }
       return true;
     } else {
       reporter.reportError('must be of type ClientCapabilities');
@@ -1854,26 +1730,26 @@
   }
 
   /// The client has support for sending didCreateFiles notifications.
-  final bool didCreate;
+  final bool? didCreate;
 
   /// The client has support for sending didDeleteFiles notifications.
-  final bool didDelete;
+  final bool? didDelete;
 
   /// The client has support for sending didRenameFiles notifications.
-  final bool didRename;
+  final bool? didRename;
 
   /// Whether the client supports dynamic registration for file
   /// requests/notifications.
-  final bool dynamicRegistration;
+  final bool? dynamicRegistration;
 
   /// The client has support for sending willCreateFiles requests.
-  final bool willCreate;
+  final bool? willCreate;
 
   /// The client has support for sending willDeleteFiles requests.
-  final bool willDelete;
+  final bool? willDelete;
 
   /// The client has support for sending willRenameFiles requests.
-  final bool willRename;
+  final bool? willRename;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -2026,19 +1902,19 @@
 
   /// Client capabilities specific to the client's markdown parser.
   ///  @since 3.16.0
-  final MarkdownClientCapabilities markdown;
+  final MarkdownClientCapabilities? markdown;
 
   /// Client capabilities specific to regular expressions.
   ///  @since 3.16.0
-  final RegularExpressionsClientCapabilities regularExpressions;
+  final RegularExpressionsClientCapabilities? regularExpressions;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
     if (regularExpressions != null) {
-      __result['regularExpressions'] = regularExpressions.toJson();
+      __result['regularExpressions'] = regularExpressions?.toJson();
     }
     if (markdown != null) {
-      __result['markdown'] = markdown.toJson();
+      __result['markdown'] = markdown?.toJson();
     }
     return __result;
   }
@@ -2119,17 +1995,17 @@
 
   /// Client capabilities for the show document request.
   ///  @since 3.16.0
-  final ShowDocumentClientCapabilities showDocument;
+  final ShowDocumentClientCapabilities? showDocument;
 
   /// Capabilities specific to the showMessage request
   ///  @since 3.16.0
-  final ShowMessageRequestClientCapabilities showMessage;
+  final ShowMessageRequestClientCapabilities? showMessage;
 
   /// Whether client supports handling progress notifications. If set servers
   /// are allowed to report in `workDoneProgress` property in the request
   /// specific server capabilities.
   ///  @since 3.15.0
-  final bool workDoneProgress;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -2137,10 +2013,10 @@
       __result['workDoneProgress'] = workDoneProgress;
     }
     if (showMessage != null) {
-      __result['showMessage'] = showMessage.toJson();
+      __result['showMessage'] = showMessage?.toJson();
     }
     if (showDocument != null) {
-      __result['showDocument'] = showDocument.toJson();
+      __result['showDocument'] = showDocument?.toJson();
     }
     return __result;
   }
@@ -2277,45 +2153,45 @@
 
   /// The client supports applying batch edits to the workspace by supporting
   /// the request 'workspace/applyEdit'
-  final bool applyEdit;
+  final bool? applyEdit;
 
   /// Capabilities specific to the code lens requests scoped to the workspace.
   ///  @since 3.16.0
-  final CodeLensWorkspaceClientCapabilities codeLens;
+  final CodeLensWorkspaceClientCapabilities? codeLens;
 
   /// The client supports `workspace/configuration` requests.
   ///  @since 3.6.0
-  final bool configuration;
+  final bool? configuration;
 
   /// Capabilities specific to the `workspace/didChangeConfiguration`
   /// notification.
-  final DidChangeConfigurationClientCapabilities didChangeConfiguration;
+  final DidChangeConfigurationClientCapabilities? didChangeConfiguration;
 
   /// Capabilities specific to the `workspace/didChangeWatchedFiles`
   /// notification.
-  final DidChangeWatchedFilesClientCapabilities didChangeWatchedFiles;
+  final DidChangeWatchedFilesClientCapabilities? didChangeWatchedFiles;
 
   /// Capabilities specific to the `workspace/executeCommand` request.
-  final ExecuteCommandClientCapabilities executeCommand;
+  final ExecuteCommandClientCapabilities? executeCommand;
 
   /// The client has support for file requests/notifications.
   ///  @since 3.16.0
-  final ClientCapabilitiesFileOperations fileOperations;
+  final ClientCapabilitiesFileOperations? fileOperations;
 
   /// Capabilities specific to the semantic token requests scoped to the
   /// workspace.
   ///  @since 3.16.0
-  final SemanticTokensWorkspaceClientCapabilities semanticTokens;
+  final SemanticTokensWorkspaceClientCapabilities? semanticTokens;
 
   /// Capabilities specific to the `workspace/symbol` request.
-  final WorkspaceSymbolClientCapabilities symbol;
+  final WorkspaceSymbolClientCapabilities? symbol;
 
   /// Capabilities specific to `WorkspaceEdit`s
-  final WorkspaceEditClientCapabilities workspaceEdit;
+  final WorkspaceEditClientCapabilities? workspaceEdit;
 
   /// The client has support for workspace folders.
   ///  @since 3.6.0
-  final bool workspaceFolders;
+  final bool? workspaceFolders;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -2323,19 +2199,19 @@
       __result['applyEdit'] = applyEdit;
     }
     if (workspaceEdit != null) {
-      __result['workspaceEdit'] = workspaceEdit.toJson();
+      __result['workspaceEdit'] = workspaceEdit?.toJson();
     }
     if (didChangeConfiguration != null) {
-      __result['didChangeConfiguration'] = didChangeConfiguration.toJson();
+      __result['didChangeConfiguration'] = didChangeConfiguration?.toJson();
     }
     if (didChangeWatchedFiles != null) {
-      __result['didChangeWatchedFiles'] = didChangeWatchedFiles.toJson();
+      __result['didChangeWatchedFiles'] = didChangeWatchedFiles?.toJson();
     }
     if (symbol != null) {
-      __result['symbol'] = symbol.toJson();
+      __result['symbol'] = symbol?.toJson();
     }
     if (executeCommand != null) {
-      __result['executeCommand'] = executeCommand.toJson();
+      __result['executeCommand'] = executeCommand?.toJson();
     }
     if (workspaceFolders != null) {
       __result['workspaceFolders'] = workspaceFolders;
@@ -2344,13 +2220,13 @@
       __result['configuration'] = configuration;
     }
     if (semanticTokens != null) {
-      __result['semanticTokens'] = semanticTokens.toJson();
+      __result['semanticTokens'] = semanticTokens?.toJson();
     }
     if (codeLens != null) {
-      __result['codeLens'] = codeLens.toJson();
+      __result['codeLens'] = codeLens?.toJson();
     }
     if (fileOperations != null) {
-      __result['fileOperations'] = fileOperations.toJson();
+      __result['fileOperations'] = fileOperations?.toJson();
     }
     return __result;
   }
@@ -2539,18 +2415,14 @@
       LspJsonHandler(CodeAction.canParse, CodeAction.fromJson);
 
   CodeAction(
-      {@required this.title,
+      {required this.title,
       this.kind,
       this.diagnostics,
       this.isPreferred,
       this.disabled,
       this.edit,
       this.command,
-      this.data}) {
-    if (title == null) {
-      throw 'title is required but was not provided';
-    }
-  }
+      this.data});
   static CodeAction fromJson(Map<String, dynamic> json) {
     final title = json['title'];
     final kind =
@@ -2581,7 +2453,7 @@
 
   /// A command this code action executes. If a code action provides an edit and
   /// a command, first the edit is executed and then the command.
-  final Command command;
+  final Command? command;
 
   /// A data entry field that is preserved on a code action between a
   /// `textDocument/codeAction` and a `codeAction/resolve` request.
@@ -2589,7 +2461,7 @@
   final dynamic data;
 
   /// The diagnostics that this code action resolves.
-  final List<Diagnostic> diagnostics;
+  final List<Diagnostic>? diagnostics;
 
   /// Marks that the code action cannot currently be applied.
   ///
@@ -2607,10 +2479,10 @@
   ///   a disabled code actions are returned, the client should show the user
   ///   an error message with `reason` in the editor.
   ///  @since 3.16.0
-  final CodeActionDisabled disabled;
+  final CodeActionDisabled? disabled;
 
   /// The workspace edit this code action performs.
-  final WorkspaceEdit edit;
+  final WorkspaceEdit? edit;
 
   /// Marks this as a preferred action. Preferred actions are used by the `auto
   /// fix` command and can be targeted by keybindings.
@@ -2619,37 +2491,37 @@
   /// underlying error. A refactoring should be marked preferred if it is the
   /// most reasonable choice of actions to take.
   ///  @since 3.15.0
-  final bool isPreferred;
+  final bool? isPreferred;
 
   /// The kind of the code action.
   ///
   /// Used to filter code actions.
-  final CodeActionKind kind;
+  final CodeActionKind? kind;
 
   /// A short, human-readable, title for this code action.
   final String title;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['title'] = title ?? (throw 'title is required but was not set');
+    __result['title'] = title;
     if (kind != null) {
-      __result['kind'] = kind.toJson();
+      __result['kind'] = kind?.toJson();
     }
     if (diagnostics != null) {
       __result['diagnostics'] =
-          diagnostics.map((item) => item.toJson()).toList();
+          diagnostics?.map((item) => item.toJson()).toList();
     }
     if (isPreferred != null) {
       __result['isPreferred'] = isPreferred;
     }
     if (disabled != null) {
-      __result['disabled'] = disabled.toJson();
+      __result['disabled'] = disabled?.toJson();
     }
     if (edit != null) {
-      __result['edit'] = edit.toJson();
+      __result['edit'] = edit?.toJson();
     }
     if (command != null) {
-      __result['command'] = command.toJson();
+      __result['command'] = command?.toJson();
     }
     if (data != null) {
       __result['data'] = data;
@@ -2737,15 +2609,6 @@
       } finally {
         reporter.pop();
       }
-      reporter.push('data');
-      try {
-        if (obj['data'] != null && !(true)) {
-          reporter.reportError('must be of type dynamic');
-          return false;
-        }
-      } finally {
-        reporter.pop();
-      }
       return true;
     } else {
       reporter.reportError('must be of type CodeAction');
@@ -2828,36 +2691,36 @@
   /// The client supports code action literals as a valid response of the
   /// `textDocument/codeAction` request.
   ///  @since 3.8.0
-  final CodeActionClientCapabilitiesCodeActionLiteralSupport
+  final CodeActionClientCapabilitiesCodeActionLiteralSupport?
       codeActionLiteralSupport;
 
   /// Whether code action supports the `data` property which is preserved
   /// between a `textDocument/codeAction` and a `codeAction/resolve` request.
   ///  @since 3.16.0
-  final bool dataSupport;
+  final bool? dataSupport;
 
   /// Whether code action supports the `disabled` property.
   ///  @since 3.16.0
-  final bool disabledSupport;
+  final bool? disabledSupport;
 
   /// Whether code action supports dynamic registration.
-  final bool dynamicRegistration;
+  final bool? dynamicRegistration;
 
   /// Whether th client honors the change annotations in text edits and resource
   /// operations returned via the `CodeAction#edit` property by for example
   /// presenting the workspace edit in the user interface and asking for
   /// confirmation.
   ///  @since 3.16.0
-  final bool honorsChangeAnnotations;
+  final bool? honorsChangeAnnotations;
 
   /// Whether code action supports the `isPreferred` property.
   ///  @since 3.15.0
-  final bool isPreferredSupport;
+  final bool? isPreferredSupport;
 
   /// Whether the client supports resolving additional code action properties
   /// via a separate `codeAction/resolve` request.
   ///  @since 3.16.0
-  final CodeActionClientCapabilitiesResolveSupport resolveSupport;
+  final CodeActionClientCapabilitiesResolveSupport? resolveSupport;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -2865,7 +2728,7 @@
       __result['dynamicRegistration'] = dynamicRegistration;
     }
     if (codeActionLiteralSupport != null) {
-      __result['codeActionLiteralSupport'] = codeActionLiteralSupport.toJson();
+      __result['codeActionLiteralSupport'] = codeActionLiteralSupport?.toJson();
     }
     if (isPreferredSupport != null) {
       __result['isPreferredSupport'] = isPreferredSupport;
@@ -2877,7 +2740,7 @@
       __result['dataSupport'] = dataSupport;
     }
     if (resolveSupport != null) {
-      __result['resolveSupport'] = resolveSupport.toJson();
+      __result['resolveSupport'] = resolveSupport?.toJson();
     }
     if (honorsChangeAnnotations != null) {
       __result['honorsChangeAnnotations'] = honorsChangeAnnotations;
@@ -3005,15 +2868,11 @@
       CodeActionClientCapabilitiesCodeActionKind.canParse,
       CodeActionClientCapabilitiesCodeActionKind.fromJson);
 
-  CodeActionClientCapabilitiesCodeActionKind({@required this.valueSet}) {
-    if (valueSet == null) {
-      throw 'valueSet is required but was not provided';
-    }
-  }
+  CodeActionClientCapabilitiesCodeActionKind({required this.valueSet});
   static CodeActionClientCapabilitiesCodeActionKind fromJson(
       Map<String, dynamic> json) {
     final valueSet = json['valueSet']
-        ?.map((item) => item != null ? CodeActionKind.fromJson(item) : null)
+        ?.map((item) => CodeActionKind.fromJson(item))
         ?.cast<CodeActionKind>()
         ?.toList();
     return CodeActionClientCapabilitiesCodeActionKind(valueSet: valueSet);
@@ -3026,8 +2885,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['valueSet'] = valueSet?.map((item) => item.toJson())?.toList() ??
-        (throw 'valueSet is required but was not set');
+    __result['valueSet'] = valueSet.map((item) => item.toJson()).toList();
     return __result;
   }
 
@@ -3089,17 +2947,11 @@
       CodeActionClientCapabilitiesCodeActionLiteralSupport.fromJson);
 
   CodeActionClientCapabilitiesCodeActionLiteralSupport(
-      {@required this.codeActionKind}) {
-    if (codeActionKind == null) {
-      throw 'codeActionKind is required but was not provided';
-    }
-  }
+      {required this.codeActionKind});
   static CodeActionClientCapabilitiesCodeActionLiteralSupport fromJson(
       Map<String, dynamic> json) {
-    final codeActionKind = json['codeActionKind'] != null
-        ? CodeActionClientCapabilitiesCodeActionKind.fromJson(
-            json['codeActionKind'])
-        : null;
+    final codeActionKind = CodeActionClientCapabilitiesCodeActionKind.fromJson(
+        json['codeActionKind']);
     return CodeActionClientCapabilitiesCodeActionLiteralSupport(
         codeActionKind: codeActionKind);
   }
@@ -3109,8 +2961,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['codeActionKind'] = codeActionKind?.toJson() ??
-        (throw 'codeActionKind is required but was not set');
+    __result['codeActionKind'] = codeActionKind.toJson();
     return __result;
   }
 
@@ -3169,11 +3020,7 @@
       CodeActionClientCapabilitiesResolveSupport.canParse,
       CodeActionClientCapabilitiesResolveSupport.fromJson);
 
-  CodeActionClientCapabilitiesResolveSupport({@required this.properties}) {
-    if (properties == null) {
-      throw 'properties is required but was not provided';
-    }
-  }
+  CodeActionClientCapabilitiesResolveSupport({required this.properties});
   static CodeActionClientCapabilitiesResolveSupport fromJson(
       Map<String, dynamic> json) {
     final properties =
@@ -3186,8 +3033,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['properties'] =
-        properties ?? (throw 'properties is required but was not set');
+    __result['properties'] = properties;
     return __result;
   }
 
@@ -3247,14 +3093,10 @@
   static const jsonHandler =
       LspJsonHandler(CodeActionContext.canParse, CodeActionContext.fromJson);
 
-  CodeActionContext({@required this.diagnostics, this.only}) {
-    if (diagnostics == null) {
-      throw 'diagnostics is required but was not provided';
-    }
-  }
+  CodeActionContext({required this.diagnostics, this.only});
   static CodeActionContext fromJson(Map<String, dynamic> json) {
     final diagnostics = json['diagnostics']
-        ?.map((item) => item != null ? Diagnostic.fromJson(item) : null)
+        ?.map((item) => Diagnostic.fromJson(item))
         ?.cast<Diagnostic>()
         ?.toList();
     final only = json['only']
@@ -3276,15 +3118,13 @@
   ///
   /// Actions not of this kind are filtered out by the client before being
   /// shown. So servers can omit computing them.
-  final List<CodeActionKind> only;
+  final List<CodeActionKind>? only;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['diagnostics'] =
-        diagnostics?.map((item) => item.toJson())?.toList() ??
-            (throw 'diagnostics is required but was not set');
+    __result['diagnostics'] = diagnostics.map((item) => item.toJson()).toList();
     if (only != null) {
-      __result['only'] = only.map((item) => item.toJson()).toList();
+      __result['only'] = only?.map((item) => item.toJson()).toList();
     }
     return __result;
   }
@@ -3357,11 +3197,7 @@
   static const jsonHandler =
       LspJsonHandler(CodeActionDisabled.canParse, CodeActionDisabled.fromJson);
 
-  CodeActionDisabled({@required this.reason}) {
-    if (reason == null) {
-      throw 'reason is required but was not provided';
-    }
-  }
+  CodeActionDisabled({required this.reason});
   static CodeActionDisabled fromJson(Map<String, dynamic> json) {
     final reason = json['reason'];
     return CodeActionDisabled(reason: reason);
@@ -3374,7 +3210,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['reason'] = reason ?? (throw 'reason is required but was not set');
+    __result['reason'] = reason;
     return __result;
   }
 
@@ -3522,19 +3358,19 @@
   ///
   /// The list of kinds may be generic, such as `CodeActionKind.Refactor`, or
   /// the server may list out every specific kind they provide.
-  final List<CodeActionKind> codeActionKinds;
+  final List<CodeActionKind>? codeActionKinds;
 
   /// The server provides support to resolve additional information for a code
   /// action.
   ///  @since 3.16.0
-  final bool resolveProvider;
-  final bool workDoneProgress;
+  final bool? resolveProvider;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
     if (codeActionKinds != null) {
       __result['codeActionKinds'] =
-          codeActionKinds.map((item) => item.toJson()).toList();
+          codeActionKinds?.map((item) => item.toJson()).toList();
     }
     if (resolveProvider != null) {
       __result['resolveProvider'] = resolveProvider;
@@ -3618,42 +3454,28 @@
       LspJsonHandler(CodeActionParams.canParse, CodeActionParams.fromJson);
 
   CodeActionParams(
-      {@required this.textDocument,
-      @required this.range,
-      @required this.context,
+      {required this.textDocument,
+      required this.range,
+      required this.context,
       this.workDoneToken,
-      this.partialResultToken}) {
-    if (textDocument == null) {
-      throw 'textDocument is required but was not provided';
-    }
-    if (range == null) {
-      throw 'range is required but was not provided';
-    }
-    if (context == null) {
-      throw 'context is required but was not provided';
-    }
-  }
+      this.partialResultToken});
   static CodeActionParams fromJson(Map<String, dynamic> json) {
-    final textDocument = json['textDocument'] != null
-        ? TextDocumentIdentifier.fromJson(json['textDocument'])
-        : null;
-    final range = json['range'] != null ? Range.fromJson(json['range']) : null;
-    final context = json['context'] != null
-        ? CodeActionContext.fromJson(json['context'])
-        : null;
-    final workDoneToken = json['workDoneToken'] is num
-        ? Either2<num, String>.t1(json['workDoneToken'])
-        : (json['workDoneToken'] is String
-            ? Either2<num, String>.t2(json['workDoneToken'])
-            : (json['workDoneToken'] == null
-                ? null
+    final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
+    final range = Range.fromJson(json['range']);
+    final context = CodeActionContext.fromJson(json['context']);
+    final workDoneToken = json['workDoneToken'] == null
+        ? null
+        : (json['workDoneToken'] is num
+            ? Either2<num, String>.t1(json['workDoneToken'])
+            : (json['workDoneToken'] is String
+                ? Either2<num, String>.t2(json['workDoneToken'])
                 : (throw '''${json['workDoneToken']} was not one of (num, String)''')));
-    final partialResultToken = json['partialResultToken'] is num
-        ? Either2<num, String>.t1(json['partialResultToken'])
-        : (json['partialResultToken'] is String
-            ? Either2<num, String>.t2(json['partialResultToken'])
-            : (json['partialResultToken'] == null
-                ? null
+    final partialResultToken = json['partialResultToken'] == null
+        ? null
+        : (json['partialResultToken'] is num
+            ? Either2<num, String>.t1(json['partialResultToken'])
+            : (json['partialResultToken'] is String
+                ? Either2<num, String>.t2(json['partialResultToken'])
                 : (throw '''${json['partialResultToken']} was not one of (num, String)''')));
     return CodeActionParams(
         textDocument: textDocument,
@@ -3668,7 +3490,7 @@
 
   /// An optional token that a server can use to report partial results (e.g.
   /// streaming) to the client.
-  final Either2<num, String> partialResultToken;
+  final Either2<num, String>? partialResultToken;
 
   /// The range for which the command was invoked.
   final Range range;
@@ -3677,16 +3499,13 @@
   final TextDocumentIdentifier textDocument;
 
   /// An optional token that a server can use to report work done progress.
-  final Either2<num, String> workDoneToken;
+  final Either2<num, String>? workDoneToken;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['textDocument'] = textDocument?.toJson() ??
-        (throw 'textDocument is required but was not set');
-    __result['range'] =
-        range?.toJson() ?? (throw 'range is required but was not set');
-    __result['context'] =
-        context?.toJson() ?? (throw 'context is required but was not set');
+    __result['textDocument'] = textDocument.toJson();
+    __result['range'] = range.toJson();
+    __result['context'] = context.toJson();
     if (workDoneToken != null) {
       __result['workDoneToken'] = workDoneToken;
     }
@@ -3839,24 +3658,24 @@
   ///
   /// The list of kinds may be generic, such as `CodeActionKind.Refactor`, or
   /// the server may list out every specific kind they provide.
-  final List<CodeActionKind> codeActionKinds;
+  final List<CodeActionKind>? codeActionKinds;
 
   /// A document selector to identify the scope of the registration. If set to
   /// null the document selector provided on the client side will be used.
-  final List<DocumentFilter> documentSelector;
+  final List<DocumentFilter>? documentSelector;
 
   /// The server provides support to resolve additional information for a code
   /// action.
   ///  @since 3.16.0
-  final bool resolveProvider;
-  final bool workDoneProgress;
+  final bool? resolveProvider;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
     __result['documentSelector'] = documentSelector;
     if (codeActionKinds != null) {
       __result['codeActionKinds'] =
-          codeActionKinds.map((item) => item.toJson()).toList();
+          codeActionKinds?.map((item) => item.toJson()).toList();
     }
     if (resolveProvider != null) {
       __result['resolveProvider'] = resolveProvider;
@@ -3959,11 +3778,7 @@
   static const jsonHandler =
       LspJsonHandler(CodeDescription.canParse, CodeDescription.fromJson);
 
-  CodeDescription({@required this.href}) {
-    if (href == null) {
-      throw 'href is required but was not provided';
-    }
-  }
+  CodeDescription({required this.href});
   static CodeDescription fromJson(Map<String, dynamic> json) {
     final href = json['href'];
     return CodeDescription(href: href);
@@ -3974,7 +3789,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['href'] = href ?? (throw 'href is required but was not set');
+    __result['href'] = href;
     return __result;
   }
 
@@ -4033,13 +3848,9 @@
   static const jsonHandler =
       LspJsonHandler(CodeLens.canParse, CodeLens.fromJson);
 
-  CodeLens({@required this.range, this.command, this.data}) {
-    if (range == null) {
-      throw 'range is required but was not provided';
-    }
-  }
+  CodeLens({required this.range, this.command, this.data});
   static CodeLens fromJson(Map<String, dynamic> json) {
-    final range = json['range'] != null ? Range.fromJson(json['range']) : null;
+    final range = Range.fromJson(json['range']);
     final command =
         json['command'] != null ? Command.fromJson(json['command']) : null;
     final data = json['data'];
@@ -4047,7 +3858,7 @@
   }
 
   /// The command this code lens represents.
-  final Command command;
+  final Command? command;
 
   /// A data entry field that is preserved on a code lens item between a code
   /// lens and a code lens resolve request.
@@ -4059,10 +3870,9 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['range'] =
-        range?.toJson() ?? (throw 'range is required but was not set');
+    __result['range'] = range.toJson();
     if (command != null) {
-      __result['command'] = command.toJson();
+      __result['command'] = command?.toJson();
     }
     if (data != null) {
       __result['data'] = data;
@@ -4099,15 +3909,6 @@
       } finally {
         reporter.pop();
       }
-      reporter.push('data');
-      try {
-        if (obj['data'] != null && !(true)) {
-          reporter.reportError('must be of type dynamic');
-          return false;
-        }
-      } finally {
-        reporter.pop();
-      }
       return true;
     } else {
       reporter.reportError('must be of type CodeLens');
@@ -4150,7 +3951,7 @@
   }
 
   /// Whether code lens supports dynamic registration.
-  final bool dynamicRegistration;
+  final bool? dynamicRegistration;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -4215,8 +4016,8 @@
   }
 
   /// Code lens has a resolve provider as well.
-  final bool resolveProvider;
-  final bool workDoneProgress;
+  final bool? resolveProvider;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -4286,30 +4087,24 @@
       LspJsonHandler(CodeLensParams.canParse, CodeLensParams.fromJson);
 
   CodeLensParams(
-      {@required this.textDocument,
+      {required this.textDocument,
       this.workDoneToken,
-      this.partialResultToken}) {
-    if (textDocument == null) {
-      throw 'textDocument is required but was not provided';
-    }
-  }
+      this.partialResultToken});
   static CodeLensParams fromJson(Map<String, dynamic> json) {
-    final textDocument = json['textDocument'] != null
-        ? TextDocumentIdentifier.fromJson(json['textDocument'])
-        : null;
-    final workDoneToken = json['workDoneToken'] is num
-        ? Either2<num, String>.t1(json['workDoneToken'])
-        : (json['workDoneToken'] is String
-            ? Either2<num, String>.t2(json['workDoneToken'])
-            : (json['workDoneToken'] == null
-                ? null
+    final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
+    final workDoneToken = json['workDoneToken'] == null
+        ? null
+        : (json['workDoneToken'] is num
+            ? Either2<num, String>.t1(json['workDoneToken'])
+            : (json['workDoneToken'] is String
+                ? Either2<num, String>.t2(json['workDoneToken'])
                 : (throw '''${json['workDoneToken']} was not one of (num, String)''')));
-    final partialResultToken = json['partialResultToken'] is num
-        ? Either2<num, String>.t1(json['partialResultToken'])
-        : (json['partialResultToken'] is String
-            ? Either2<num, String>.t2(json['partialResultToken'])
-            : (json['partialResultToken'] == null
-                ? null
+    final partialResultToken = json['partialResultToken'] == null
+        ? null
+        : (json['partialResultToken'] is num
+            ? Either2<num, String>.t1(json['partialResultToken'])
+            : (json['partialResultToken'] is String
+                ? Either2<num, String>.t2(json['partialResultToken'])
                 : (throw '''${json['partialResultToken']} was not one of (num, String)''')));
     return CodeLensParams(
         textDocument: textDocument,
@@ -4319,18 +4114,17 @@
 
   /// An optional token that a server can use to report partial results (e.g.
   /// streaming) to the client.
-  final Either2<num, String> partialResultToken;
+  final Either2<num, String>? partialResultToken;
 
   /// The document to request code lens for.
   final TextDocumentIdentifier textDocument;
 
   /// An optional token that a server can use to report work done progress.
-  final Either2<num, String> workDoneToken;
+  final Either2<num, String>? workDoneToken;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['textDocument'] = textDocument?.toJson() ??
-        (throw 'textDocument is required but was not set');
+    __result['textDocument'] = textDocument.toJson();
     if (workDoneToken != null) {
       __result['workDoneToken'] = workDoneToken;
     }
@@ -4435,11 +4229,11 @@
 
   /// A document selector to identify the scope of the registration. If set to
   /// null the document selector provided on the client side will be used.
-  final List<DocumentFilter> documentSelector;
+  final List<DocumentFilter>? documentSelector;
 
   /// Code lens has a resolve provider as well.
-  final bool resolveProvider;
-  final bool workDoneProgress;
+  final bool? resolveProvider;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -4543,7 +4337,7 @@
   /// code lenses currently shown. It should be used with absolute care and is
   /// useful for situation where a server for example detect a project wide
   /// change that requires such a calculation.
-  final bool refreshSupport;
+  final bool? refreshSupport;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -4597,23 +4391,10 @@
   static const jsonHandler = LspJsonHandler(Color.canParse, Color.fromJson);
 
   Color(
-      {@required this.red,
-      @required this.green,
-      @required this.blue,
-      @required this.alpha}) {
-    if (red == null) {
-      throw 'red is required but was not provided';
-    }
-    if (green == null) {
-      throw 'green is required but was not provided';
-    }
-    if (blue == null) {
-      throw 'blue is required but was not provided';
-    }
-    if (alpha == null) {
-      throw 'alpha is required but was not provided';
-    }
-  }
+      {required this.red,
+      required this.green,
+      required this.blue,
+      required this.alpha});
   static Color fromJson(Map<String, dynamic> json) {
     final red = json['red'];
     final green = json['green'];
@@ -4636,10 +4417,10 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['red'] = red ?? (throw 'red is required but was not set');
-    __result['green'] = green ?? (throw 'green is required but was not set');
-    __result['blue'] = blue ?? (throw 'blue is required but was not set');
-    __result['alpha'] = alpha ?? (throw 'alpha is required but was not set');
+    __result['red'] = red;
+    __result['green'] = green;
+    __result['blue'] = blue;
+    __result['alpha'] = alpha;
     return __result;
   }
 
@@ -4750,17 +4531,10 @@
   static const jsonHandler =
       LspJsonHandler(ColorInformation.canParse, ColorInformation.fromJson);
 
-  ColorInformation({@required this.range, @required this.color}) {
-    if (range == null) {
-      throw 'range is required but was not provided';
-    }
-    if (color == null) {
-      throw 'color is required but was not provided';
-    }
-  }
+  ColorInformation({required this.range, required this.color});
   static ColorInformation fromJson(Map<String, dynamic> json) {
-    final range = json['range'] != null ? Range.fromJson(json['range']) : null;
-    final color = json['color'] != null ? Color.fromJson(json['color']) : null;
+    final range = Range.fromJson(json['range']);
+    final color = Color.fromJson(json['color']);
     return ColorInformation(range: range, color: color);
   }
 
@@ -4772,10 +4546,8 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['range'] =
-        range?.toJson() ?? (throw 'range is required but was not set');
-    __result['color'] =
-        color?.toJson() ?? (throw 'color is required but was not set');
+    __result['range'] = range.toJson();
+    __result['color'] = color.toJson();
     return __result;
   }
 
@@ -4847,11 +4619,7 @@
       LspJsonHandler(ColorPresentation.canParse, ColorPresentation.fromJson);
 
   ColorPresentation(
-      {@required this.label, this.textEdit, this.additionalTextEdits}) {
-    if (label == null) {
-      throw 'label is required but was not provided';
-    }
-  }
+      {required this.label, this.textEdit, this.additionalTextEdits});
   static ColorPresentation fromJson(Map<String, dynamic> json) {
     final label = json['label'];
     final textEdit =
@@ -4869,7 +4637,7 @@
   /// An optional array of additional text edits ([TextEdit]) that are applied
   /// when selecting this color presentation. Edits must not overlap with the
   /// main [edit](#ColorPresentation.textEdit) nor with themselves.
-  final List<TextEdit> additionalTextEdits;
+  final List<TextEdit>? additionalTextEdits;
 
   /// The label of this color presentation. It will be shown on the color picker
   /// header. By default this is also the text that is inserted when selecting
@@ -4879,17 +4647,17 @@
   /// An edit ([TextEdit]) which is applied to a document when selecting this
   /// presentation for the color.  When `falsy` the
   /// [label](#ColorPresentation.label) is used.
-  final TextEdit textEdit;
+  final TextEdit? textEdit;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['label'] = label ?? (throw 'label is required but was not set');
+    __result['label'] = label;
     if (textEdit != null) {
-      __result['textEdit'] = textEdit.toJson();
+      __result['textEdit'] = textEdit?.toJson();
     }
     if (additionalTextEdits != null) {
       __result['additionalTextEdits'] =
-          additionalTextEdits.map((item) => item.toJson()).toList();
+          additionalTextEdits?.map((item) => item.toJson()).toList();
     }
     return __result;
   }
@@ -4973,40 +4741,28 @@
       ColorPresentationParams.canParse, ColorPresentationParams.fromJson);
 
   ColorPresentationParams(
-      {@required this.textDocument,
-      @required this.color,
-      @required this.range,
+      {required this.textDocument,
+      required this.color,
+      required this.range,
       this.workDoneToken,
-      this.partialResultToken}) {
-    if (textDocument == null) {
-      throw 'textDocument is required but was not provided';
-    }
-    if (color == null) {
-      throw 'color is required but was not provided';
-    }
-    if (range == null) {
-      throw 'range is required but was not provided';
-    }
-  }
+      this.partialResultToken});
   static ColorPresentationParams fromJson(Map<String, dynamic> json) {
-    final textDocument = json['textDocument'] != null
-        ? TextDocumentIdentifier.fromJson(json['textDocument'])
-        : null;
-    final color = json['color'] != null ? Color.fromJson(json['color']) : null;
-    final range = json['range'] != null ? Range.fromJson(json['range']) : null;
-    final workDoneToken = json['workDoneToken'] is num
-        ? Either2<num, String>.t1(json['workDoneToken'])
-        : (json['workDoneToken'] is String
-            ? Either2<num, String>.t2(json['workDoneToken'])
-            : (json['workDoneToken'] == null
-                ? null
+    final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
+    final color = Color.fromJson(json['color']);
+    final range = Range.fromJson(json['range']);
+    final workDoneToken = json['workDoneToken'] == null
+        ? null
+        : (json['workDoneToken'] is num
+            ? Either2<num, String>.t1(json['workDoneToken'])
+            : (json['workDoneToken'] is String
+                ? Either2<num, String>.t2(json['workDoneToken'])
                 : (throw '''${json['workDoneToken']} was not one of (num, String)''')));
-    final partialResultToken = json['partialResultToken'] is num
-        ? Either2<num, String>.t1(json['partialResultToken'])
-        : (json['partialResultToken'] is String
-            ? Either2<num, String>.t2(json['partialResultToken'])
-            : (json['partialResultToken'] == null
-                ? null
+    final partialResultToken = json['partialResultToken'] == null
+        ? null
+        : (json['partialResultToken'] is num
+            ? Either2<num, String>.t1(json['partialResultToken'])
+            : (json['partialResultToken'] is String
+                ? Either2<num, String>.t2(json['partialResultToken'])
                 : (throw '''${json['partialResultToken']} was not one of (num, String)''')));
     return ColorPresentationParams(
         textDocument: textDocument,
@@ -5021,7 +4777,7 @@
 
   /// An optional token that a server can use to report partial results (e.g.
   /// streaming) to the client.
-  final Either2<num, String> partialResultToken;
+  final Either2<num, String>? partialResultToken;
 
   /// The range where the color would be inserted. Serves as a context.
   final Range range;
@@ -5030,16 +4786,13 @@
   final TextDocumentIdentifier textDocument;
 
   /// An optional token that a server can use to report work done progress.
-  final Either2<num, String> workDoneToken;
+  final Either2<num, String>? workDoneToken;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['textDocument'] = textDocument?.toJson() ??
-        (throw 'textDocument is required but was not set');
-    __result['color'] =
-        color?.toJson() ?? (throw 'color is required but was not set');
-    __result['range'] =
-        range?.toJson() ?? (throw 'range is required but was not set');
+    __result['textDocument'] = textDocument.toJson();
+    __result['color'] = color.toJson();
+    __result['range'] = range.toJson();
     if (workDoneToken != null) {
       __result['workDoneToken'] = workDoneToken;
     }
@@ -5163,14 +4916,7 @@
 class Command implements ToJsonable {
   static const jsonHandler = LspJsonHandler(Command.canParse, Command.fromJson);
 
-  Command({@required this.title, @required this.command, this.arguments}) {
-    if (title == null) {
-      throw 'title is required but was not provided';
-    }
-    if (command == null) {
-      throw 'command is required but was not provided';
-    }
-  }
+  Command({required this.title, required this.command, this.arguments});
   static Command fromJson(Map<String, dynamic> json) {
     final title = json['title'];
     final command = json['command'];
@@ -5180,7 +4926,7 @@
   }
 
   /// Arguments that the command handler should be invoked with.
-  final List<dynamic> arguments;
+  final List<dynamic>? arguments;
 
   /// The identifier of the actual command handler.
   final String command;
@@ -5190,9 +4936,8 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['title'] = title ?? (throw 'title is required but was not set');
-    __result['command'] =
-        command ?? (throw 'command is required but was not set');
+    __result['title'] = title;
+    __result['command'] = command;
     if (arguments != null) {
       __result['arguments'] = arguments;
     }
@@ -5307,15 +5052,15 @@
   }
 
   /// The client supports the following `CompletionItem` specific capabilities.
-  final CompletionClientCapabilitiesCompletionItem completionItem;
-  final CompletionClientCapabilitiesCompletionItemKind completionItemKind;
+  final CompletionClientCapabilitiesCompletionItem? completionItem;
+  final CompletionClientCapabilitiesCompletionItemKind? completionItemKind;
 
   /// The client supports to send additional context information for a
   /// `textDocument/completion` request.
-  final bool contextSupport;
+  final bool? contextSupport;
 
   /// Whether completion supports dynamic registration.
-  final bool dynamicRegistration;
+  final bool? dynamicRegistration;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -5323,10 +5068,10 @@
       __result['dynamicRegistration'] = dynamicRegistration;
     }
     if (completionItem != null) {
-      __result['completionItem'] = completionItem.toJson();
+      __result['completionItem'] = completionItem?.toJson();
     }
     if (completionItemKind != null) {
-      __result['completionItemKind'] = completionItemKind.toJson();
+      __result['completionItemKind'] = completionItemKind?.toJson();
     }
     if (contextSupport != null) {
       __result['contextSupport'] = contextSupport;
@@ -5463,34 +5208,35 @@
   }
 
   /// Client supports commit characters on a completion item.
-  final bool commitCharactersSupport;
+  final bool? commitCharactersSupport;
 
   /// Client supports the deprecated property on a completion item.
-  final bool deprecatedSupport;
+  final bool? deprecatedSupport;
 
   /// Client supports the follow content formats for the documentation property.
   /// The order describes the preferred format of the client.
-  final List<MarkupKind> documentationFormat;
+  final List<MarkupKind>? documentationFormat;
 
   /// Client supports insert replace edit to control different behavior if a
   /// completion item is inserted in the text or should replace text.
   ///  @since 3.16.0
-  final bool insertReplaceSupport;
+  final bool? insertReplaceSupport;
 
   /// The client supports the `insertTextMode` property on a completion item to
   /// override the whitespace handling mode as defined by the client (see
   /// `insertTextMode`).
   ///  @since 3.16.0
-  final CompletionClientCapabilitiesInsertTextModeSupport insertTextModeSupport;
+  final CompletionClientCapabilitiesInsertTextModeSupport?
+      insertTextModeSupport;
 
   /// Client supports the preselect property on a completion item.
-  final bool preselectSupport;
+  final bool? preselectSupport;
 
   /// Indicates which properties a client can resolve lazily on a completion
   /// item. Before version 3.16.0 only the predefined properties `documentation`
   /// and `details` could be resolved lazily.
   ///  @since 3.16.0
-  final CompletionClientCapabilitiesResolveSupport resolveSupport;
+  final CompletionClientCapabilitiesResolveSupport? resolveSupport;
 
   /// Client supports snippets as insert text.
   ///
@@ -5498,14 +5244,14 @@
   /// `${3:foo}`. `$0` defines the final tab stop, it defaults to the end of the
   /// snippet. Placeholders with equal identifiers are linked, that is typing in
   /// one will update others too.
-  final bool snippetSupport;
+  final bool? snippetSupport;
 
   /// Client supports the tag property on a completion item. Clients supporting
   /// tags have to handle unknown tags gracefully. Clients especially need to
   /// preserve unknown tags when sending a completion item back to the server in
   /// a resolve call.
   ///  @since 3.15.0
-  final CompletionClientCapabilitiesTagSupport tagSupport;
+  final CompletionClientCapabilitiesTagSupport? tagSupport;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -5517,7 +5263,7 @@
     }
     if (documentationFormat != null) {
       __result['documentationFormat'] =
-          documentationFormat.map((item) => item.toJson()).toList();
+          documentationFormat?.map((item) => item.toJson()).toList();
     }
     if (deprecatedSupport != null) {
       __result['deprecatedSupport'] = deprecatedSupport;
@@ -5526,16 +5272,16 @@
       __result['preselectSupport'] = preselectSupport;
     }
     if (tagSupport != null) {
-      __result['tagSupport'] = tagSupport.toJson();
+      __result['tagSupport'] = tagSupport?.toJson();
     }
     if (insertReplaceSupport != null) {
       __result['insertReplaceSupport'] = insertReplaceSupport;
     }
     if (resolveSupport != null) {
-      __result['resolveSupport'] = resolveSupport.toJson();
+      __result['resolveSupport'] = resolveSupport?.toJson();
     }
     if (insertTextModeSupport != null) {
-      __result['insertTextModeSupport'] = insertTextModeSupport.toJson();
+      __result['insertTextModeSupport'] = insertTextModeSupport?.toJson();
     }
     return __result;
   }
@@ -5707,12 +5453,12 @@
   /// If this property is not present the client only supports the completion
   /// items kinds from `Text` to `Reference` as defined in the initial version
   /// of the protocol.
-  final List<CompletionItemKind> valueSet;
+  final List<CompletionItemKind>? valueSet;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
     if (valueSet != null) {
-      __result['valueSet'] = valueSet.map((item) => item.toJson()).toList();
+      __result['valueSet'] = valueSet?.map((item) => item.toJson()).toList();
     }
     return __result;
   }
@@ -5766,15 +5512,11 @@
       CompletionClientCapabilitiesInsertTextModeSupport.canParse,
       CompletionClientCapabilitiesInsertTextModeSupport.fromJson);
 
-  CompletionClientCapabilitiesInsertTextModeSupport({@required this.valueSet}) {
-    if (valueSet == null) {
-      throw 'valueSet is required but was not provided';
-    }
-  }
+  CompletionClientCapabilitiesInsertTextModeSupport({required this.valueSet});
   static CompletionClientCapabilitiesInsertTextModeSupport fromJson(
       Map<String, dynamic> json) {
     final valueSet = json['valueSet']
-        ?.map((item) => item != null ? InsertTextMode.fromJson(item) : null)
+        ?.map((item) => InsertTextMode.fromJson(item))
         ?.cast<InsertTextMode>()
         ?.toList();
     return CompletionClientCapabilitiesInsertTextModeSupport(
@@ -5785,8 +5527,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['valueSet'] = valueSet?.map((item) => item.toJson())?.toList() ??
-        (throw 'valueSet is required but was not set');
+    __result['valueSet'] = valueSet.map((item) => item.toJson()).toList();
     return __result;
   }
 
@@ -5847,11 +5588,7 @@
       CompletionClientCapabilitiesResolveSupport.canParse,
       CompletionClientCapabilitiesResolveSupport.fromJson);
 
-  CompletionClientCapabilitiesResolveSupport({@required this.properties}) {
-    if (properties == null) {
-      throw 'properties is required but was not provided';
-    }
-  }
+  CompletionClientCapabilitiesResolveSupport({required this.properties});
   static CompletionClientCapabilitiesResolveSupport fromJson(
       Map<String, dynamic> json) {
     final properties =
@@ -5864,8 +5601,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['properties'] =
-        properties ?? (throw 'properties is required but was not set');
+    __result['properties'] = properties;
     return __result;
   }
 
@@ -5924,15 +5660,11 @@
       CompletionClientCapabilitiesTagSupport.canParse,
       CompletionClientCapabilitiesTagSupport.fromJson);
 
-  CompletionClientCapabilitiesTagSupport({@required this.valueSet}) {
-    if (valueSet == null) {
-      throw 'valueSet is required but was not provided';
-    }
-  }
+  CompletionClientCapabilitiesTagSupport({required this.valueSet});
   static CompletionClientCapabilitiesTagSupport fromJson(
       Map<String, dynamic> json) {
     final valueSet = json['valueSet']
-        ?.map((item) => item != null ? CompletionItemTag.fromJson(item) : null)
+        ?.map((item) => CompletionItemTag.fromJson(item))
         ?.cast<CompletionItemTag>()
         ?.toList();
     return CompletionClientCapabilitiesTagSupport(valueSet: valueSet);
@@ -5943,8 +5675,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['valueSet'] = valueSet?.map((item) => item.toJson())?.toList() ??
-        (throw 'valueSet is required but was not set');
+    __result['valueSet'] = valueSet.map((item) => item.toJson()).toList();
     return __result;
   }
 
@@ -6005,15 +5736,9 @@
   static const jsonHandler =
       LspJsonHandler(CompletionContext.canParse, CompletionContext.fromJson);
 
-  CompletionContext({@required this.triggerKind, this.triggerCharacter}) {
-    if (triggerKind == null) {
-      throw 'triggerKind is required but was not provided';
-    }
-  }
+  CompletionContext({required this.triggerKind, this.triggerCharacter});
   static CompletionContext fromJson(Map<String, dynamic> json) {
-    final triggerKind = json['triggerKind'] != null
-        ? CompletionTriggerKind.fromJson(json['triggerKind'])
-        : null;
+    final triggerKind = CompletionTriggerKind.fromJson(json['triggerKind']);
     final triggerCharacter = json['triggerCharacter'];
     return CompletionContext(
         triggerKind: triggerKind, triggerCharacter: triggerCharacter);
@@ -6021,15 +5746,14 @@
 
   /// The trigger character (a single character) that has trigger code complete.
   /// Is undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter`
-  final String triggerCharacter;
+  final String? triggerCharacter;
 
   /// How the completion was triggered.
   final CompletionTriggerKind triggerKind;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['triggerKind'] = triggerKind?.toJson() ??
-        (throw 'triggerKind is required but was not set');
+    __result['triggerKind'] = triggerKind.toJson();
     if (triggerCharacter != null) {
       __result['triggerCharacter'] = triggerCharacter;
     }
@@ -6099,7 +5823,7 @@
       LspJsonHandler(CompletionItem.canParse, CompletionItem.fromJson);
 
   CompletionItem(
-      {@required this.label,
+      {required this.label,
       this.kind,
       this.tags,
       this.detail,
@@ -6115,11 +5839,7 @@
       this.additionalTextEdits,
       this.commitCharacters,
       this.command,
-      this.data}) {
-    if (label == null) {
-      throw 'label is required but was not provided';
-    }
-  }
+      this.data});
   static CompletionItem fromJson(Map<String, dynamic> json) {
     final label = json['label'];
     final kind =
@@ -6129,14 +5849,14 @@
         ?.cast<CompletionItemTag>()
         ?.toList();
     final detail = json['detail'];
-    final documentation = json['documentation'] is String
-        ? Either2<String, MarkupContent>.t1(json['documentation'])
-        : (MarkupContent.canParse(json['documentation'], nullLspJsonReporter)
-            ? Either2<String, MarkupContent>.t2(json['documentation'] != null
-                ? MarkupContent.fromJson(json['documentation'])
-                : null)
-            : (json['documentation'] == null
-                ? null
+    final documentation = json['documentation'] == null
+        ? null
+        : (json['documentation'] is String
+            ? Either2<String, MarkupContent>.t1(json['documentation'])
+            : (MarkupContent.canParse(
+                    json['documentation'], nullLspJsonReporter)
+                ? Either2<String, MarkupContent>.t2(
+                    MarkupContent.fromJson(json['documentation']))
                 : (throw '''${json['documentation']} was not one of (String, MarkupContent)''')));
     final deprecated = json['deprecated'];
     final preselect = json['preselect'];
@@ -6149,16 +5869,14 @@
     final insertTextMode = json['insertTextMode'] != null
         ? InsertTextMode.fromJson(json['insertTextMode'])
         : null;
-    final textEdit = TextEdit.canParse(json['textEdit'], nullLspJsonReporter)
-        ? Either2<TextEdit, InsertReplaceEdit>.t1(json['textEdit'] != null
-            ? TextEdit.fromJson(json['textEdit'])
-            : null)
-        : (InsertReplaceEdit.canParse(json['textEdit'], nullLspJsonReporter)
-            ? Either2<TextEdit, InsertReplaceEdit>.t2(json['textEdit'] != null
-                ? InsertReplaceEdit.fromJson(json['textEdit'])
-                : null)
-            : (json['textEdit'] == null
-                ? null
+    final textEdit = json['textEdit'] == null
+        ? null
+        : (TextEdit.canParse(json['textEdit'], nullLspJsonReporter)
+            ? Either2<TextEdit, InsertReplaceEdit>.t1(
+                TextEdit.fromJson(json['textEdit']))
+            : (InsertReplaceEdit.canParse(json['textEdit'], nullLspJsonReporter)
+                ? Either2<TextEdit, InsertReplaceEdit>.t2(
+                    InsertReplaceEdit.fromJson(json['textEdit']))
                 : (throw '''${json['textEdit']} was not one of (TextEdit, InsertReplaceEdit)''')));
     final additionalTextEdits = json['additionalTextEdits']
         ?.map((item) => item != null ? TextEdit.fromJson(item) : null)
@@ -6198,37 +5916,37 @@
   /// Additional text edits should be used to change text unrelated to the
   /// current cursor position (for example adding an import statement at the top
   /// of the file if the completion item will insert an unqualified type).
-  final List<TextEdit> additionalTextEdits;
+  final List<TextEdit>? additionalTextEdits;
 
   /// An optional command that is executed *after* inserting this completion.
   /// *Note* that additional modifications to the current document should be
   /// described with the additionalTextEdits-property.
-  final Command command;
+  final Command? command;
 
   /// An optional set of characters that when pressed while this completion is
   /// active will accept it first and then type that character. *Note* that all
   /// commit characters should have `length=1` and that superfluous characters
   /// will be ignored.
-  final List<String> commitCharacters;
+  final List<String>? commitCharacters;
 
   /// A data entry field that is preserved on a completion item between a
   /// completion and a completion resolve request.
-  final CompletionItemResolutionInfo data;
+  final CompletionItemResolutionInfo? data;
 
   /// Indicates if this item is deprecated.
   ///  @deprecated Use `tags` instead if supported.
-  final bool deprecated;
+  final bool? deprecated;
 
   /// A human-readable string with additional information about this item, like
   /// type or symbol information.
-  final String detail;
+  final String? detail;
 
   /// A human-readable string that represents a doc-comment.
-  final Either2<String, MarkupContent> documentation;
+  final Either2<String, MarkupContent>? documentation;
 
   /// A string that should be used when filtering a set of completion items.
   /// When `falsy` the label is used.
-  final String filterText;
+  final String? filterText;
 
   /// A string that should be inserted into a document when selecting this
   /// completion. When `falsy` the label is used.
@@ -6239,23 +5957,23 @@
   /// completion item with an `insertText` of `console` is provided it will only
   /// insert `sole`. Therefore it is recommended to use `textEdit` instead since
   /// it avoids additional client side interpretation.
-  final String insertText;
+  final String? insertText;
 
   /// The format of the insert text. The format applies to both the `insertText`
   /// property and the `newText` property of a provided `textEdit`. If omitted
   /// defaults to `InsertTextFormat.PlainText`.
-  final InsertTextFormat insertTextFormat;
+  final InsertTextFormat? insertTextFormat;
 
   /// How whitespace and indentation is handled during completion item
   /// insertion. If not provided the client's default value depends on the
   /// `textDocument.completion.insertTextMode` client capability.
   ///  @since 3.16.0
-  final InsertTextMode insertTextMode;
+  final InsertTextMode? insertTextMode;
 
   /// The kind of this completion item. Based of the kind an icon is chosen by
   /// the editor. The standardized set of available values is defined in
   /// `CompletionItemKind`.
-  final CompletionItemKind kind;
+  final CompletionItemKind? kind;
 
   /// The label of this completion item. By default also the text that is
   /// inserted when selecting this completion.
@@ -6266,15 +5984,15 @@
   /// *Note* that only one completion item can be selected and that the tool /
   /// client decides which item that is. The rule is that the *first* item of
   /// those that match best is selected.
-  final bool preselect;
+  final bool? preselect;
 
   /// A string that should be used when comparing this item with other items.
   /// When `falsy` the label is used.
-  final String sortText;
+  final String? sortText;
 
   /// Tags for this completion item.
   ///  @since 3.15.0
-  final List<CompletionItemTag> tags;
+  final List<CompletionItemTag>? tags;
 
   /// An edit which is applied to a document when selecting this completion.
   /// When an edit is provided the value of `insertText` is ignored.
@@ -6296,16 +6014,16 @@
   /// must be a prefix of the edit's replace range, that means it must be
   /// contained and starting at the same position.
   ///  @since 3.16.0 additional type `InsertReplaceEdit`
-  final Either2<TextEdit, InsertReplaceEdit> textEdit;
+  final Either2<TextEdit, InsertReplaceEdit>? textEdit;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['label'] = label ?? (throw 'label is required but was not set');
+    __result['label'] = label;
     if (kind != null) {
-      __result['kind'] = kind.toJson();
+      __result['kind'] = kind?.toJson();
     }
     if (tags != null) {
-      __result['tags'] = tags.map((item) => item.toJson()).toList();
+      __result['tags'] = tags?.map((item) => item.toJson()).toList();
     }
     if (detail != null) {
       __result['detail'] = detail;
@@ -6329,26 +6047,26 @@
       __result['insertText'] = insertText;
     }
     if (insertTextFormat != null) {
-      __result['insertTextFormat'] = insertTextFormat.toJson();
+      __result['insertTextFormat'] = insertTextFormat?.toJson();
     }
     if (insertTextMode != null) {
-      __result['insertTextMode'] = insertTextMode.toJson();
+      __result['insertTextMode'] = insertTextMode?.toJson();
     }
     if (textEdit != null) {
       __result['textEdit'] = textEdit;
     }
     if (additionalTextEdits != null) {
       __result['additionalTextEdits'] =
-          additionalTextEdits.map((item) => item.toJson()).toList();
+          additionalTextEdits?.map((item) => item.toJson()).toList();
     }
     if (commitCharacters != null) {
       __result['commitCharacters'] = commitCharacters;
     }
     if (command != null) {
-      __result['command'] = command.toJson();
+      __result['command'] = command?.toJson();
     }
     if (data != null) {
-      __result['data'] = data.toJson();
+      __result['data'] = data?.toJson();
     }
     return __result;
   }
@@ -6678,18 +6396,11 @@
   static const jsonHandler =
       LspJsonHandler(CompletionList.canParse, CompletionList.fromJson);
 
-  CompletionList({@required this.isIncomplete, @required this.items}) {
-    if (isIncomplete == null) {
-      throw 'isIncomplete is required but was not provided';
-    }
-    if (items == null) {
-      throw 'items is required but was not provided';
-    }
-  }
+  CompletionList({required this.isIncomplete, required this.items});
   static CompletionList fromJson(Map<String, dynamic> json) {
     final isIncomplete = json['isIncomplete'];
     final items = json['items']
-        ?.map((item) => item != null ? CompletionItem.fromJson(item) : null)
+        ?.map((item) => CompletionItem.fromJson(item))
         ?.cast<CompletionItem>()
         ?.toList();
     return CompletionList(isIncomplete: isIncomplete, items: items);
@@ -6704,10 +6415,8 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['isIncomplete'] =
-        isIncomplete ?? (throw 'isIncomplete is required but was not set');
-    __result['items'] = items?.map((item) => item.toJson())?.toList() ??
-        (throw 'items is required but was not set');
+    __result['isIncomplete'] = isIncomplete;
+    __result['items'] = items.map((item) => item.toJson()).toList();
     return __result;
   }
 
@@ -6818,11 +6527,11 @@
   /// If a server provides both `allCommitCharacters` and commit characters on
   /// an individual completion item the ones on the completion item win.
   ///  @since 3.2.0
-  final List<String> allCommitCharacters;
+  final List<String>? allCommitCharacters;
 
   /// The server provides support to resolve additional information for a
   /// completion item.
-  final bool resolveProvider;
+  final bool? resolveProvider;
 
   /// Most tools trigger completion request automatically without explicitly
   /// requesting it using a keyboard shortcut (e.g. Ctrl+Space). Typically they
@@ -6834,8 +6543,8 @@
   /// If code complete should automatically be trigger on characters not being
   /// valid inside an identifier (for example `.` in JavaScript) list them in
   /// `triggerCharacters`.
-  final List<String> triggerCharacters;
-  final bool workDoneProgress;
+  final List<String>? triggerCharacters;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -6945,39 +6654,29 @@
 
   CompletionParams(
       {this.context,
-      @required this.textDocument,
-      @required this.position,
+      required this.textDocument,
+      required this.position,
       this.workDoneToken,
-      this.partialResultToken}) {
-    if (textDocument == null) {
-      throw 'textDocument is required but was not provided';
-    }
-    if (position == null) {
-      throw 'position is required but was not provided';
-    }
-  }
+      this.partialResultToken});
   static CompletionParams fromJson(Map<String, dynamic> json) {
     final context = json['context'] != null
         ? CompletionContext.fromJson(json['context'])
         : null;
-    final textDocument = json['textDocument'] != null
-        ? TextDocumentIdentifier.fromJson(json['textDocument'])
-        : null;
-    final position =
-        json['position'] != null ? Position.fromJson(json['position']) : null;
-    final workDoneToken = json['workDoneToken'] is num
-        ? Either2<num, String>.t1(json['workDoneToken'])
-        : (json['workDoneToken'] is String
-            ? Either2<num, String>.t2(json['workDoneToken'])
-            : (json['workDoneToken'] == null
-                ? null
+    final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
+    final position = Position.fromJson(json['position']);
+    final workDoneToken = json['workDoneToken'] == null
+        ? null
+        : (json['workDoneToken'] is num
+            ? Either2<num, String>.t1(json['workDoneToken'])
+            : (json['workDoneToken'] is String
+                ? Either2<num, String>.t2(json['workDoneToken'])
                 : (throw '''${json['workDoneToken']} was not one of (num, String)''')));
-    final partialResultToken = json['partialResultToken'] is num
-        ? Either2<num, String>.t1(json['partialResultToken'])
-        : (json['partialResultToken'] is String
-            ? Either2<num, String>.t2(json['partialResultToken'])
-            : (json['partialResultToken'] == null
-                ? null
+    final partialResultToken = json['partialResultToken'] == null
+        ? null
+        : (json['partialResultToken'] is num
+            ? Either2<num, String>.t1(json['partialResultToken'])
+            : (json['partialResultToken'] is String
+                ? Either2<num, String>.t2(json['partialResultToken'])
                 : (throw '''${json['partialResultToken']} was not one of (num, String)''')));
     return CompletionParams(
         context: context,
@@ -6989,11 +6688,11 @@
 
   /// The completion context. This is only available if the client specifies to
   /// send this using the client capability `completion.contextSupport === true`
-  final CompletionContext context;
+  final CompletionContext? context;
 
   /// An optional token that a server can use to report partial results (e.g.
   /// streaming) to the client.
-  final Either2<num, String> partialResultToken;
+  final Either2<num, String>? partialResultToken;
 
   /// The position inside the text document.
   final Position position;
@@ -7002,17 +6701,15 @@
   final TextDocumentIdentifier textDocument;
 
   /// An optional token that a server can use to report work done progress.
-  final Either2<num, String> workDoneToken;
+  final Either2<num, String>? workDoneToken;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
     if (context != null) {
-      __result['context'] = context.toJson();
+      __result['context'] = context?.toJson();
     }
-    __result['textDocument'] = textDocument?.toJson() ??
-        (throw 'textDocument is required but was not set');
-    __result['position'] =
-        position?.toJson() ?? (throw 'position is required but was not set');
+    __result['textDocument'] = textDocument.toJson();
+    __result['position'] = position.toJson();
     if (workDoneToken != null) {
       __result['workDoneToken'] = workDoneToken;
     }
@@ -7168,15 +6865,15 @@
   /// If a server provides both `allCommitCharacters` and commit characters on
   /// an individual completion item the ones on the completion item win.
   ///  @since 3.2.0
-  final List<String> allCommitCharacters;
+  final List<String>? allCommitCharacters;
 
   /// A document selector to identify the scope of the registration. If set to
   /// null the document selector provided on the client side will be used.
-  final List<DocumentFilter> documentSelector;
+  final List<DocumentFilter>? documentSelector;
 
   /// The server provides support to resolve additional information for a
   /// completion item.
-  final bool resolveProvider;
+  final bool? resolveProvider;
 
   /// Most tools trigger completion request automatically without explicitly
   /// requesting it using a keyboard shortcut (e.g. Ctrl+Space). Typically they
@@ -7188,8 +6885,8 @@
   /// If code complete should automatically be trigger on characters not being
   /// valid inside an identifier (for example `.` in JavaScript) list them in
   /// `triggerCharacters`.
-  final List<String> triggerCharacters;
-  final bool workDoneProgress;
+  final List<String>? triggerCharacters;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -7361,10 +7058,10 @@
   }
 
   /// The scope to get the configuration section for.
-  final String scopeUri;
+  final String? scopeUri;
 
   /// The configuration section asked for.
-  final String section;
+  final String? section;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -7428,14 +7125,10 @@
   static const jsonHandler = LspJsonHandler(
       ConfigurationParams.canParse, ConfigurationParams.fromJson);
 
-  ConfigurationParams({@required this.items}) {
-    if (items == null) {
-      throw 'items is required but was not provided';
-    }
-  }
+  ConfigurationParams({required this.items});
   static ConfigurationParams fromJson(Map<String, dynamic> json) {
     final items = json['items']
-        ?.map((item) => item != null ? ConfigurationItem.fromJson(item) : null)
+        ?.map((item) => ConfigurationItem.fromJson(item))
         ?.cast<ConfigurationItem>()
         ?.toList();
     return ConfigurationParams(items: items);
@@ -7445,8 +7138,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['items'] = items?.map((item) => item.toJson())?.toList() ??
-        (throw 'items is required but was not set');
+    __result['items'] = items.map((item) => item.toJson()).toList();
     return __result;
   }
 
@@ -7507,15 +7199,12 @@
 
   CreateFile(
       {this.kind = 'create',
-      @required this.uri,
+      required this.uri,
       this.options,
       this.annotationId}) {
     if (kind != 'create') {
       throw 'kind may only be the literal \'create\'';
     }
-    if (uri == null) {
-      throw 'uri is required but was not provided';
-    }
   }
   static CreateFile fromJson(Map<String, dynamic> json) {
     final kind = json['kind'];
@@ -7530,23 +7219,23 @@
 
   /// An optional annotation identifer describing the operation.
   ///  @since 3.16.0
-  final String annotationId;
+  final String? annotationId;
 
   /// A create
   final String kind;
 
   /// Additional options
-  final CreateFileOptions options;
+  final CreateFileOptions? options;
 
   /// The resource to create.
   final String uri;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['kind'] = kind ?? (throw 'kind is required but was not set');
-    __result['uri'] = uri ?? (throw 'uri is required but was not set');
+    __result['kind'] = kind;
+    __result['uri'] = uri;
     if (options != null) {
-      __result['options'] = options.toJson();
+      __result['options'] = options?.toJson();
     }
     if (annotationId != null) {
       __result['annotationId'] = annotationId;
@@ -7656,10 +7345,10 @@
   }
 
   /// Ignore if exists.
-  final bool ignoreIfExists;
+  final bool? ignoreIfExists;
 
   /// Overwrite existing file. Overwrite wins over `ignoreIfExists`
-  final bool overwrite;
+  final bool? overwrite;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -7728,14 +7417,10 @@
   static const jsonHandler =
       LspJsonHandler(CreateFilesParams.canParse, CreateFilesParams.fromJson);
 
-  CreateFilesParams({@required this.files}) {
-    if (files == null) {
-      throw 'files is required but was not provided';
-    }
-  }
+  CreateFilesParams({required this.files});
   static CreateFilesParams fromJson(Map<String, dynamic> json) {
     final files = json['files']
-        ?.map((item) => item != null ? FileCreate.fromJson(item) : null)
+        ?.map((item) => FileCreate.fromJson(item))
         ?.cast<FileCreate>()
         ?.toList();
     return CreateFilesParams(files: files);
@@ -7746,8 +7431,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['files'] = files?.map((item) => item.toJson())?.toList() ??
-        (throw 'files is required but was not set');
+    __result['files'] = files.map((item) => item.toJson()).toList();
     return __result;
   }
 
@@ -7816,10 +7500,10 @@
   /// Whether declaration supports dynamic registration. If this is set to
   /// `true` the client supports the new `DeclarationRegistrationOptions` return
   /// value for the corresponding server capability as well.
-  final bool dynamicRegistration;
+  final bool? dynamicRegistration;
 
   /// The client supports additional metadata in the form of declaration links.
-  final bool linkSupport;
+  final bool? linkSupport;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -7896,7 +7580,7 @@
     return DeclarationOptions(workDoneProgress: workDoneProgress);
   }
 
-  final bool workDoneProgress;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -7955,36 +7639,26 @@
       LspJsonHandler(DeclarationParams.canParse, DeclarationParams.fromJson);
 
   DeclarationParams(
-      {@required this.textDocument,
-      @required this.position,
+      {required this.textDocument,
+      required this.position,
       this.workDoneToken,
-      this.partialResultToken}) {
-    if (textDocument == null) {
-      throw 'textDocument is required but was not provided';
-    }
-    if (position == null) {
-      throw 'position is required but was not provided';
-    }
-  }
+      this.partialResultToken});
   static DeclarationParams fromJson(Map<String, dynamic> json) {
-    final textDocument = json['textDocument'] != null
-        ? TextDocumentIdentifier.fromJson(json['textDocument'])
-        : null;
-    final position =
-        json['position'] != null ? Position.fromJson(json['position']) : null;
-    final workDoneToken = json['workDoneToken'] is num
-        ? Either2<num, String>.t1(json['workDoneToken'])
-        : (json['workDoneToken'] is String
-            ? Either2<num, String>.t2(json['workDoneToken'])
-            : (json['workDoneToken'] == null
-                ? null
+    final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
+    final position = Position.fromJson(json['position']);
+    final workDoneToken = json['workDoneToken'] == null
+        ? null
+        : (json['workDoneToken'] is num
+            ? Either2<num, String>.t1(json['workDoneToken'])
+            : (json['workDoneToken'] is String
+                ? Either2<num, String>.t2(json['workDoneToken'])
                 : (throw '''${json['workDoneToken']} was not one of (num, String)''')));
-    final partialResultToken = json['partialResultToken'] is num
-        ? Either2<num, String>.t1(json['partialResultToken'])
-        : (json['partialResultToken'] is String
-            ? Either2<num, String>.t2(json['partialResultToken'])
-            : (json['partialResultToken'] == null
-                ? null
+    final partialResultToken = json['partialResultToken'] == null
+        ? null
+        : (json['partialResultToken'] is num
+            ? Either2<num, String>.t1(json['partialResultToken'])
+            : (json['partialResultToken'] is String
+                ? Either2<num, String>.t2(json['partialResultToken'])
                 : (throw '''${json['partialResultToken']} was not one of (num, String)''')));
     return DeclarationParams(
         textDocument: textDocument,
@@ -7995,7 +7669,7 @@
 
   /// An optional token that a server can use to report partial results (e.g.
   /// streaming) to the client.
-  final Either2<num, String> partialResultToken;
+  final Either2<num, String>? partialResultToken;
 
   /// The position inside the text document.
   final Position position;
@@ -8004,14 +7678,12 @@
   final TextDocumentIdentifier textDocument;
 
   /// An optional token that a server can use to report work done progress.
-  final Either2<num, String> workDoneToken;
+  final Either2<num, String>? workDoneToken;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['textDocument'] = textDocument?.toJson() ??
-        (throw 'textDocument is required but was not set');
-    __result['position'] =
-        position?.toJson() ?? (throw 'position is required but was not set');
+    __result['textDocument'] = textDocument.toJson();
+    __result['position'] = position.toJson();
     if (workDoneToken != null) {
       __result['workDoneToken'] = workDoneToken;
     }
@@ -8139,12 +7811,12 @@
 
   /// A document selector to identify the scope of the registration. If set to
   /// null the document selector provided on the client side will be used.
-  final List<DocumentFilter> documentSelector;
+  final List<DocumentFilter>? documentSelector;
 
   /// The id used to register the request. The id can be used to deregister the
   /// request again. See also Registration#id.
-  final String id;
-  final bool workDoneProgress;
+  final String? id;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -8242,11 +7914,11 @@
   }
 
   /// Whether definition supports dynamic registration.
-  final bool dynamicRegistration;
+  final bool? dynamicRegistration;
 
   /// The client supports additional metadata in the form of definition links.
   ///  @since 3.14.0
-  final bool linkSupport;
+  final bool? linkSupport;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -8323,7 +7995,7 @@
     return DefinitionOptions(workDoneProgress: workDoneProgress);
   }
 
-  final bool workDoneProgress;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -8381,36 +8053,26 @@
       LspJsonHandler(DefinitionParams.canParse, DefinitionParams.fromJson);
 
   DefinitionParams(
-      {@required this.textDocument,
-      @required this.position,
+      {required this.textDocument,
+      required this.position,
       this.workDoneToken,
-      this.partialResultToken}) {
-    if (textDocument == null) {
-      throw 'textDocument is required but was not provided';
-    }
-    if (position == null) {
-      throw 'position is required but was not provided';
-    }
-  }
+      this.partialResultToken});
   static DefinitionParams fromJson(Map<String, dynamic> json) {
-    final textDocument = json['textDocument'] != null
-        ? TextDocumentIdentifier.fromJson(json['textDocument'])
-        : null;
-    final position =
-        json['position'] != null ? Position.fromJson(json['position']) : null;
-    final workDoneToken = json['workDoneToken'] is num
-        ? Either2<num, String>.t1(json['workDoneToken'])
-        : (json['workDoneToken'] is String
-            ? Either2<num, String>.t2(json['workDoneToken'])
-            : (json['workDoneToken'] == null
-                ? null
+    final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
+    final position = Position.fromJson(json['position']);
+    final workDoneToken = json['workDoneToken'] == null
+        ? null
+        : (json['workDoneToken'] is num
+            ? Either2<num, String>.t1(json['workDoneToken'])
+            : (json['workDoneToken'] is String
+                ? Either2<num, String>.t2(json['workDoneToken'])
                 : (throw '''${json['workDoneToken']} was not one of (num, String)''')));
-    final partialResultToken = json['partialResultToken'] is num
-        ? Either2<num, String>.t1(json['partialResultToken'])
-        : (json['partialResultToken'] is String
-            ? Either2<num, String>.t2(json['partialResultToken'])
-            : (json['partialResultToken'] == null
-                ? null
+    final partialResultToken = json['partialResultToken'] == null
+        ? null
+        : (json['partialResultToken'] is num
+            ? Either2<num, String>.t1(json['partialResultToken'])
+            : (json['partialResultToken'] is String
+                ? Either2<num, String>.t2(json['partialResultToken'])
                 : (throw '''${json['partialResultToken']} was not one of (num, String)''')));
     return DefinitionParams(
         textDocument: textDocument,
@@ -8421,7 +8083,7 @@
 
   /// An optional token that a server can use to report partial results (e.g.
   /// streaming) to the client.
-  final Either2<num, String> partialResultToken;
+  final Either2<num, String>? partialResultToken;
 
   /// The position inside the text document.
   final Position position;
@@ -8430,14 +8092,12 @@
   final TextDocumentIdentifier textDocument;
 
   /// An optional token that a server can use to report work done progress.
-  final Either2<num, String> workDoneToken;
+  final Either2<num, String>? workDoneToken;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['textDocument'] = textDocument?.toJson() ??
-        (throw 'textDocument is required but was not set');
-    __result['position'] =
-        position?.toJson() ?? (throw 'position is required but was not set');
+    __result['textDocument'] = textDocument.toJson();
+    __result['position'] = position.toJson();
     if (workDoneToken != null) {
       __result['workDoneToken'] = workDoneToken;
     }
@@ -8557,8 +8217,8 @@
 
   /// A document selector to identify the scope of the registration. If set to
   /// null the document selector provided on the client side will be used.
-  final List<DocumentFilter> documentSelector;
-  final bool workDoneProgress;
+  final List<DocumentFilter>? documentSelector;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -8635,15 +8295,12 @@
 
   DeleteFile(
       {this.kind = 'delete',
-      @required this.uri,
+      required this.uri,
       this.options,
       this.annotationId}) {
     if (kind != 'delete') {
       throw 'kind may only be the literal \'delete\'';
     }
-    if (uri == null) {
-      throw 'uri is required but was not provided';
-    }
   }
   static DeleteFile fromJson(Map<String, dynamic> json) {
     final kind = json['kind'];
@@ -8658,23 +8315,23 @@
 
   /// An optional annotation identifer describing the operation.
   ///  @since 3.16.0
-  final String annotationId;
+  final String? annotationId;
 
   /// A delete
   final String kind;
 
   /// Delete options.
-  final DeleteFileOptions options;
+  final DeleteFileOptions? options;
 
   /// The file to delete.
   final String uri;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['kind'] = kind ?? (throw 'kind is required but was not set');
-    __result['uri'] = uri ?? (throw 'uri is required but was not set');
+    __result['kind'] = kind;
+    __result['uri'] = uri;
     if (options != null) {
-      __result['options'] = options.toJson();
+      __result['options'] = options?.toJson();
     }
     if (annotationId != null) {
       __result['annotationId'] = annotationId;
@@ -8784,10 +8441,10 @@
   }
 
   /// Ignore the operation if the file doesn't exist.
-  final bool ignoreIfNotExists;
+  final bool? ignoreIfNotExists;
 
   /// Delete the content recursively if a folder is denoted.
-  final bool recursive;
+  final bool? recursive;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -8857,14 +8514,10 @@
   static const jsonHandler =
       LspJsonHandler(DeleteFilesParams.canParse, DeleteFilesParams.fromJson);
 
-  DeleteFilesParams({@required this.files}) {
-    if (files == null) {
-      throw 'files is required but was not provided';
-    }
-  }
+  DeleteFilesParams({required this.files});
   static DeleteFilesParams fromJson(Map<String, dynamic> json) {
     final files = json['files']
-        ?.map((item) => item != null ? FileDelete.fromJson(item) : null)
+        ?.map((item) => FileDelete.fromJson(item))
         ?.cast<FileDelete>()
         ?.toList();
     return DeleteFilesParams(files: files);
@@ -8875,8 +8528,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['files'] = files?.map((item) => item.toJson())?.toList() ??
-        (throw 'files is required but was not set');
+    __result['files'] = files.map((item) => item.toJson()).toList();
     return __result;
   }
 
@@ -8934,24 +8586,17 @@
       LspJsonHandler(Diagnostic.canParse, Diagnostic.fromJson);
 
   Diagnostic(
-      {@required this.range,
+      {required this.range,
       this.severity,
       this.code,
       this.codeDescription,
       this.source,
-      @required this.message,
+      required this.message,
       this.tags,
       this.relatedInformation,
-      this.data}) {
-    if (range == null) {
-      throw 'range is required but was not provided';
-    }
-    if (message == null) {
-      throw 'message is required but was not provided';
-    }
-  }
+      this.data});
   static Diagnostic fromJson(Map<String, dynamic> json) {
-    final range = json['range'] != null ? Range.fromJson(json['range']) : null;
+    final range = Range.fromJson(json['range']);
     final severity = json['severity'] != null
         ? DiagnosticSeverity.fromJson(json['severity'])
         : null;
@@ -8984,11 +8629,11 @@
   }
 
   /// The diagnostic's code, which might appear in the user interface.
-  final String code;
+  final String? code;
 
   /// An optional property to describe the error code.
   ///  @since 3.16.0
-  final CodeDescription codeDescription;
+  final CodeDescription? codeDescription;
 
   /// A data entry field that is preserved between a
   /// `textDocument/publishDiagnostics` notification and
@@ -9004,44 +8649,42 @@
 
   /// An array of related diagnostic information, e.g. when symbol-names within
   /// a scope collide all definitions can be marked via this property.
-  final List<DiagnosticRelatedInformation> relatedInformation;
+  final List<DiagnosticRelatedInformation>? relatedInformation;
 
   /// The diagnostic's severity. Can be omitted. If omitted it is up to the
   /// client to interpret diagnostics as error, warning, info or hint.
-  final DiagnosticSeverity severity;
+  final DiagnosticSeverity? severity;
 
   /// A human-readable string describing the source of this diagnostic, e.g.
   /// 'typescript' or 'super lint'.
-  final String source;
+  final String? source;
 
   /// Additional metadata about the diagnostic.
   ///  @since 3.15.0
-  final List<DiagnosticTag> tags;
+  final List<DiagnosticTag>? tags;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['range'] =
-        range?.toJson() ?? (throw 'range is required but was not set');
+    __result['range'] = range.toJson();
     if (severity != null) {
-      __result['severity'] = severity.toJson();
+      __result['severity'] = severity?.toJson();
     }
     if (code != null) {
       __result['code'] = code;
     }
     if (codeDescription != null) {
-      __result['codeDescription'] = codeDescription.toJson();
+      __result['codeDescription'] = codeDescription?.toJson();
     }
     if (source != null) {
       __result['source'] = source;
     }
-    __result['message'] =
-        message ?? (throw 'message is required but was not set');
+    __result['message'] = message;
     if (tags != null) {
-      __result['tags'] = tags.map((item) => item.toJson()).toList();
+      __result['tags'] = tags?.map((item) => item.toJson()).toList();
     }
     if (relatedInformation != null) {
       __result['relatedInformation'] =
-          relatedInformation.map((item) => item.toJson()).toList();
+          relatedInformation?.map((item) => item.toJson()).toList();
     }
     if (data != null) {
       __result['data'] = data;
@@ -9148,15 +8791,6 @@
       } finally {
         reporter.pop();
       }
-      reporter.push('data');
-      try {
-        if (obj['data'] != null && !(true)) {
-          reporter.reportError('must be of type dynamic');
-          return false;
-        }
-      } finally {
-        reporter.pop();
-      }
       return true;
     } else {
       reporter.reportError('must be of type Diagnostic');
@@ -9214,18 +8848,9 @@
       DiagnosticRelatedInformation.canParse,
       DiagnosticRelatedInformation.fromJson);
 
-  DiagnosticRelatedInformation(
-      {@required this.location, @required this.message}) {
-    if (location == null) {
-      throw 'location is required but was not provided';
-    }
-    if (message == null) {
-      throw 'message is required but was not provided';
-    }
-  }
+  DiagnosticRelatedInformation({required this.location, required this.message});
   static DiagnosticRelatedInformation fromJson(Map<String, dynamic> json) {
-    final location =
-        json['location'] != null ? Location.fromJson(json['location']) : null;
+    final location = Location.fromJson(json['location']);
     final message = json['message'];
     return DiagnosticRelatedInformation(location: location, message: message);
   }
@@ -9238,10 +8863,8 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['location'] =
-        location?.toJson() ?? (throw 'location is required but was not set');
-    __result['message'] =
-        message ?? (throw 'message is required but was not set');
+    __result['location'] = location.toJson();
+    __result['message'] = message;
     return __result;
   }
 
@@ -9390,7 +9013,7 @@
   }
 
   /// Did change configuration notification supports dynamic registration.
-  final bool dynamicRegistration;
+  final bool? dynamicRegistration;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -9462,19 +9085,6 @@
 
   static bool canParse(Object obj, LspJsonReporter reporter) {
     if (obj is Map<String, dynamic>) {
-      reporter.push('settings');
-      try {
-        if (!obj.containsKey('settings')) {
-          reporter.reportError('must not be undefined');
-          return false;
-        }
-        if (obj['settings'] != null && !(true)) {
-          reporter.reportError('must be of type dynamic');
-          return false;
-        }
-      } finally {
-        reporter.pop();
-      }
       return true;
     } else {
       reporter.reportError('must be of type DidChangeConfigurationParams');
@@ -9508,31 +9118,20 @@
       DidChangeTextDocumentParams.fromJson);
 
   DidChangeTextDocumentParams(
-      {@required this.textDocument, @required this.contentChanges}) {
-    if (textDocument == null) {
-      throw 'textDocument is required but was not provided';
-    }
-    if (contentChanges == null) {
-      throw 'contentChanges is required but was not provided';
-    }
-  }
+      {required this.textDocument, required this.contentChanges});
   static DidChangeTextDocumentParams fromJson(Map<String, dynamic> json) {
-    final textDocument = json['textDocument'] != null
-        ? VersionedTextDocumentIdentifier.fromJson(json['textDocument'])
-        : null;
+    final textDocument =
+        VersionedTextDocumentIdentifier.fromJson(json['textDocument']);
     final contentChanges = json['contentChanges']
         ?.map((item) => TextDocumentContentChangeEvent1.canParse(
                 item, nullLspJsonReporter)
-            ? Either2<TextDocumentContentChangeEvent1, TextDocumentContentChangeEvent2>.t1(
-                item != null
-                    ? TextDocumentContentChangeEvent1.fromJson(item)
-                    : null)
+            ? Either2<TextDocumentContentChangeEvent1,
+                    TextDocumentContentChangeEvent2>.t1(
+                TextDocumentContentChangeEvent1.fromJson(item))
             : (TextDocumentContentChangeEvent2.canParse(item, nullLspJsonReporter)
                 ? Either2<TextDocumentContentChangeEvent1,
                         TextDocumentContentChangeEvent2>.t2(
-                    item != null
-                        ? TextDocumentContentChangeEvent2.fromJson(item)
-                        : null)
+                    TextDocumentContentChangeEvent2.fromJson(item))
                 : (throw '''$item was not one of (TextDocumentContentChangeEvent1, TextDocumentContentChangeEvent2)''')))
         ?.cast<Either2<TextDocumentContentChangeEvent1, TextDocumentContentChangeEvent2>>()
         ?.toList();
@@ -9563,10 +9162,8 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['textDocument'] = textDocument?.toJson() ??
-        (throw 'textDocument is required but was not set');
-    __result['contentChanges'] =
-        contentChanges ?? (throw 'contentChanges is required but was not set');
+    __result['textDocument'] = textDocument.toJson();
+    __result['contentChanges'] = contentChanges;
     return __result;
   }
 
@@ -9668,7 +9265,7 @@
   /// Did change watched files notification supports dynamic registration.
   /// Please note that the current protocol doesn't support static configuration
   /// for file changes from the server side.
-  final bool dynamicRegistration;
+  final bool? dynamicRegistration;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -9723,14 +9320,10 @@
       DidChangeWatchedFilesParams.canParse,
       DidChangeWatchedFilesParams.fromJson);
 
-  DidChangeWatchedFilesParams({@required this.changes}) {
-    if (changes == null) {
-      throw 'changes is required but was not provided';
-    }
-  }
+  DidChangeWatchedFilesParams({required this.changes});
   static DidChangeWatchedFilesParams fromJson(Map<String, dynamic> json) {
     final changes = json['changes']
-        ?.map((item) => item != null ? FileEvent.fromJson(item) : null)
+        ?.map((item) => FileEvent.fromJson(item))
         ?.cast<FileEvent>()
         ?.toList();
     return DidChangeWatchedFilesParams(changes: changes);
@@ -9741,8 +9334,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['changes'] = changes?.map((item) => item.toJson())?.toList() ??
-        (throw 'changes is required but was not set');
+    __result['changes'] = changes.map((item) => item.toJson()).toList();
     return __result;
   }
 
@@ -9802,15 +9394,11 @@
       DidChangeWatchedFilesRegistrationOptions.canParse,
       DidChangeWatchedFilesRegistrationOptions.fromJson);
 
-  DidChangeWatchedFilesRegistrationOptions({@required this.watchers}) {
-    if (watchers == null) {
-      throw 'watchers is required but was not provided';
-    }
-  }
+  DidChangeWatchedFilesRegistrationOptions({required this.watchers});
   static DidChangeWatchedFilesRegistrationOptions fromJson(
       Map<String, dynamic> json) {
     final watchers = json['watchers']
-        ?.map((item) => item != null ? FileSystemWatcher.fromJson(item) : null)
+        ?.map((item) => FileSystemWatcher.fromJson(item))
         ?.cast<FileSystemWatcher>()
         ?.toList();
     return DidChangeWatchedFilesRegistrationOptions(watchers: watchers);
@@ -9821,8 +9409,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['watchers'] = watchers?.map((item) => item.toJson())?.toList() ??
-        (throw 'watchers is required but was not set');
+    __result['watchers'] = watchers.map((item) => item.toJson()).toList();
     return __result;
   }
 
@@ -9882,15 +9469,9 @@
       DidChangeWorkspaceFoldersParams.canParse,
       DidChangeWorkspaceFoldersParams.fromJson);
 
-  DidChangeWorkspaceFoldersParams({@required this.event}) {
-    if (event == null) {
-      throw 'event is required but was not provided';
-    }
-  }
+  DidChangeWorkspaceFoldersParams({required this.event});
   static DidChangeWorkspaceFoldersParams fromJson(Map<String, dynamic> json) {
-    final event = json['event'] != null
-        ? WorkspaceFoldersChangeEvent.fromJson(json['event'])
-        : null;
+    final event = WorkspaceFoldersChangeEvent.fromJson(json['event']);
     return DidChangeWorkspaceFoldersParams(event: event);
   }
 
@@ -9899,8 +9480,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['event'] =
-        event?.toJson() ?? (throw 'event is required but was not set');
+    __result['event'] = event.toJson();
     return __result;
   }
 
@@ -9954,15 +9534,9 @@
   static const jsonHandler = LspJsonHandler(
       DidCloseTextDocumentParams.canParse, DidCloseTextDocumentParams.fromJson);
 
-  DidCloseTextDocumentParams({@required this.textDocument}) {
-    if (textDocument == null) {
-      throw 'textDocument is required but was not provided';
-    }
-  }
+  DidCloseTextDocumentParams({required this.textDocument});
   static DidCloseTextDocumentParams fromJson(Map<String, dynamic> json) {
-    final textDocument = json['textDocument'] != null
-        ? TextDocumentIdentifier.fromJson(json['textDocument'])
-        : null;
+    final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
     return DidCloseTextDocumentParams(textDocument: textDocument);
   }
 
@@ -9971,8 +9545,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['textDocument'] = textDocument?.toJson() ??
-        (throw 'textDocument is required but was not set');
+    __result['textDocument'] = textDocument.toJson();
     return __result;
   }
 
@@ -10026,15 +9599,9 @@
   static const jsonHandler = LspJsonHandler(
       DidOpenTextDocumentParams.canParse, DidOpenTextDocumentParams.fromJson);
 
-  DidOpenTextDocumentParams({@required this.textDocument}) {
-    if (textDocument == null) {
-      throw 'textDocument is required but was not provided';
-    }
-  }
+  DidOpenTextDocumentParams({required this.textDocument});
   static DidOpenTextDocumentParams fromJson(Map<String, dynamic> json) {
-    final textDocument = json['textDocument'] != null
-        ? TextDocumentItem.fromJson(json['textDocument'])
-        : null;
+    final textDocument = TextDocumentItem.fromJson(json['textDocument']);
     return DidOpenTextDocumentParams(textDocument: textDocument);
   }
 
@@ -10043,8 +9610,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['textDocument'] = textDocument?.toJson() ??
-        (throw 'textDocument is required but was not set');
+    __result['textDocument'] = textDocument.toJson();
     return __result;
   }
 
@@ -10098,30 +9664,23 @@
   static const jsonHandler = LspJsonHandler(
       DidSaveTextDocumentParams.canParse, DidSaveTextDocumentParams.fromJson);
 
-  DidSaveTextDocumentParams({@required this.textDocument, this.text}) {
-    if (textDocument == null) {
-      throw 'textDocument is required but was not provided';
-    }
-  }
+  DidSaveTextDocumentParams({required this.textDocument, this.text});
   static DidSaveTextDocumentParams fromJson(Map<String, dynamic> json) {
-    final textDocument = json['textDocument'] != null
-        ? TextDocumentIdentifier.fromJson(json['textDocument'])
-        : null;
+    final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
     final text = json['text'];
     return DidSaveTextDocumentParams(textDocument: textDocument, text: text);
   }
 
   /// Optional the content when saved. Depends on the includeText value when the
   /// save notification was requested.
-  final String text;
+  final String? text;
 
   /// The document that was saved.
   final TextDocumentIdentifier textDocument;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['textDocument'] = textDocument?.toJson() ??
-        (throw 'textDocument is required but was not set');
+    __result['textDocument'] = textDocument.toJson();
     if (text != null) {
       __result['text'] = text;
     }
@@ -10197,7 +9756,7 @@
   }
 
   /// Whether document color supports dynamic registration.
-  final bool dynamicRegistration;
+  final bool? dynamicRegistration;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -10259,7 +9818,7 @@
     return DocumentColorOptions(workDoneProgress: workDoneProgress);
   }
 
-  final bool workDoneProgress;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -10314,30 +9873,24 @@
       DocumentColorParams.canParse, DocumentColorParams.fromJson);
 
   DocumentColorParams(
-      {@required this.textDocument,
+      {required this.textDocument,
       this.workDoneToken,
-      this.partialResultToken}) {
-    if (textDocument == null) {
-      throw 'textDocument is required but was not provided';
-    }
-  }
+      this.partialResultToken});
   static DocumentColorParams fromJson(Map<String, dynamic> json) {
-    final textDocument = json['textDocument'] != null
-        ? TextDocumentIdentifier.fromJson(json['textDocument'])
-        : null;
-    final workDoneToken = json['workDoneToken'] is num
-        ? Either2<num, String>.t1(json['workDoneToken'])
-        : (json['workDoneToken'] is String
-            ? Either2<num, String>.t2(json['workDoneToken'])
-            : (json['workDoneToken'] == null
-                ? null
+    final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
+    final workDoneToken = json['workDoneToken'] == null
+        ? null
+        : (json['workDoneToken'] is num
+            ? Either2<num, String>.t1(json['workDoneToken'])
+            : (json['workDoneToken'] is String
+                ? Either2<num, String>.t2(json['workDoneToken'])
                 : (throw '''${json['workDoneToken']} was not one of (num, String)''')));
-    final partialResultToken = json['partialResultToken'] is num
-        ? Either2<num, String>.t1(json['partialResultToken'])
-        : (json['partialResultToken'] is String
-            ? Either2<num, String>.t2(json['partialResultToken'])
-            : (json['partialResultToken'] == null
-                ? null
+    final partialResultToken = json['partialResultToken'] == null
+        ? null
+        : (json['partialResultToken'] is num
+            ? Either2<num, String>.t1(json['partialResultToken'])
+            : (json['partialResultToken'] is String
+                ? Either2<num, String>.t2(json['partialResultToken'])
                 : (throw '''${json['partialResultToken']} was not one of (num, String)''')));
     return DocumentColorParams(
         textDocument: textDocument,
@@ -10347,18 +9900,17 @@
 
   /// An optional token that a server can use to report partial results (e.g.
   /// streaming) to the client.
-  final Either2<num, String> partialResultToken;
+  final Either2<num, String>? partialResultToken;
 
   /// The text document.
   final TextDocumentIdentifier textDocument;
 
   /// An optional token that a server can use to report work done progress.
-  final Either2<num, String> workDoneToken;
+  final Either2<num, String>? workDoneToken;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['textDocument'] = textDocument?.toJson() ??
-        (throw 'textDocument is required but was not set');
+    __result['textDocument'] = textDocument.toJson();
     if (workDoneToken != null) {
       __result['workDoneToken'] = workDoneToken;
     }
@@ -10468,12 +10020,12 @@
 
   /// A document selector to identify the scope of the registration. If set to
   /// null the document selector provided on the client side will be used.
-  final List<DocumentFilter> documentSelector;
+  final List<DocumentFilter>? documentSelector;
 
   /// The id used to register the request. The id can be used to deregister the
   /// request again. See also Registration#id.
-  final String id;
-  final bool workDoneProgress;
+  final String? id;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -10570,7 +10122,7 @@
   }
 
   /// A language id, like `typescript`.
-  final String language;
+  final String? language;
 
   /// A glob pattern, like `*.{ts,js}`.
   ///
@@ -10585,10 +10137,10 @@
   /// - `[!...]` to negate a range of characters to match in a path segment
   ///   (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but
   ///   not `example.0`)
-  final String pattern;
+  final String? pattern;
 
   /// A Uri [scheme](#Uri.scheme), like `file` or `untitled`.
-  final String scheme;
+  final String? scheme;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -10678,7 +10230,7 @@
   }
 
   /// Whether formatting supports dynamic registration.
-  final bool dynamicRegistration;
+  final bool? dynamicRegistration;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -10742,7 +10294,7 @@
     return DocumentFormattingOptions(workDoneProgress: workDoneProgress);
   }
 
-  final bool workDoneProgress;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -10796,29 +10348,16 @@
       DocumentFormattingParams.canParse, DocumentFormattingParams.fromJson);
 
   DocumentFormattingParams(
-      {@required this.textDocument,
-      @required this.options,
-      this.workDoneToken}) {
-    if (textDocument == null) {
-      throw 'textDocument is required but was not provided';
-    }
-    if (options == null) {
-      throw 'options is required but was not provided';
-    }
-  }
+      {required this.textDocument, required this.options, this.workDoneToken});
   static DocumentFormattingParams fromJson(Map<String, dynamic> json) {
-    final textDocument = json['textDocument'] != null
-        ? TextDocumentIdentifier.fromJson(json['textDocument'])
-        : null;
-    final options = json['options'] != null
-        ? FormattingOptions.fromJson(json['options'])
-        : null;
-    final workDoneToken = json['workDoneToken'] is num
-        ? Either2<num, String>.t1(json['workDoneToken'])
-        : (json['workDoneToken'] is String
-            ? Either2<num, String>.t2(json['workDoneToken'])
-            : (json['workDoneToken'] == null
-                ? null
+    final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
+    final options = FormattingOptions.fromJson(json['options']);
+    final workDoneToken = json['workDoneToken'] == null
+        ? null
+        : (json['workDoneToken'] is num
+            ? Either2<num, String>.t1(json['workDoneToken'])
+            : (json['workDoneToken'] is String
+                ? Either2<num, String>.t2(json['workDoneToken'])
                 : (throw '''${json['workDoneToken']} was not one of (num, String)''')));
     return DocumentFormattingParams(
         textDocument: textDocument,
@@ -10833,14 +10372,12 @@
   final TextDocumentIdentifier textDocument;
 
   /// An optional token that a server can use to report work done progress.
-  final Either2<num, String> workDoneToken;
+  final Either2<num, String>? workDoneToken;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['textDocument'] = textDocument?.toJson() ??
-        (throw 'textDocument is required but was not set');
-    __result['options'] =
-        options?.toJson() ?? (throw 'options is required but was not set');
+    __result['textDocument'] = textDocument.toJson();
+    __result['options'] = options.toJson();
     if (workDoneToken != null) {
       __result['workDoneToken'] = workDoneToken;
     }
@@ -10950,8 +10487,8 @@
 
   /// A document selector to identify the scope of the registration. If set to
   /// null the document selector provided on the client side will be used.
-  final List<DocumentFilter> documentSelector;
-  final bool workDoneProgress;
+  final List<DocumentFilter>? documentSelector;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -11029,13 +10566,9 @@
   static const jsonHandler =
       LspJsonHandler(DocumentHighlight.canParse, DocumentHighlight.fromJson);
 
-  DocumentHighlight({@required this.range, this.kind}) {
-    if (range == null) {
-      throw 'range is required but was not provided';
-    }
-  }
+  DocumentHighlight({required this.range, this.kind});
   static DocumentHighlight fromJson(Map<String, dynamic> json) {
-    final range = json['range'] != null ? Range.fromJson(json['range']) : null;
+    final range = Range.fromJson(json['range']);
     final kind = json['kind'] != null
         ? DocumentHighlightKind.fromJson(json['kind'])
         : null;
@@ -11043,17 +10576,16 @@
   }
 
   /// The highlight kind, default is DocumentHighlightKind.Text.
-  final DocumentHighlightKind kind;
+  final DocumentHighlightKind? kind;
 
   /// The range this highlight applies to.
   final Range range;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['range'] =
-        range?.toJson() ?? (throw 'range is required but was not set');
+    __result['range'] = range.toJson();
     if (kind != null) {
-      __result['kind'] = kind.toJson();
+      __result['kind'] = kind?.toJson();
     }
     return __result;
   }
@@ -11128,7 +10660,7 @@
   }
 
   /// Whether document highlight supports dynamic registration.
-  final bool dynamicRegistration;
+  final bool? dynamicRegistration;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -11224,7 +10756,7 @@
     return DocumentHighlightOptions(workDoneProgress: workDoneProgress);
   }
 
-  final bool workDoneProgress;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -11283,36 +10815,26 @@
       DocumentHighlightParams.canParse, DocumentHighlightParams.fromJson);
 
   DocumentHighlightParams(
-      {@required this.textDocument,
-      @required this.position,
+      {required this.textDocument,
+      required this.position,
       this.workDoneToken,
-      this.partialResultToken}) {
-    if (textDocument == null) {
-      throw 'textDocument is required but was not provided';
-    }
-    if (position == null) {
-      throw 'position is required but was not provided';
-    }
-  }
+      this.partialResultToken});
   static DocumentHighlightParams fromJson(Map<String, dynamic> json) {
-    final textDocument = json['textDocument'] != null
-        ? TextDocumentIdentifier.fromJson(json['textDocument'])
-        : null;
-    final position =
-        json['position'] != null ? Position.fromJson(json['position']) : null;
-    final workDoneToken = json['workDoneToken'] is num
-        ? Either2<num, String>.t1(json['workDoneToken'])
-        : (json['workDoneToken'] is String
-            ? Either2<num, String>.t2(json['workDoneToken'])
-            : (json['workDoneToken'] == null
-                ? null
+    final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
+    final position = Position.fromJson(json['position']);
+    final workDoneToken = json['workDoneToken'] == null
+        ? null
+        : (json['workDoneToken'] is num
+            ? Either2<num, String>.t1(json['workDoneToken'])
+            : (json['workDoneToken'] is String
+                ? Either2<num, String>.t2(json['workDoneToken'])
                 : (throw '''${json['workDoneToken']} was not one of (num, String)''')));
-    final partialResultToken = json['partialResultToken'] is num
-        ? Either2<num, String>.t1(json['partialResultToken'])
-        : (json['partialResultToken'] is String
-            ? Either2<num, String>.t2(json['partialResultToken'])
-            : (json['partialResultToken'] == null
-                ? null
+    final partialResultToken = json['partialResultToken'] == null
+        ? null
+        : (json['partialResultToken'] is num
+            ? Either2<num, String>.t1(json['partialResultToken'])
+            : (json['partialResultToken'] is String
+                ? Either2<num, String>.t2(json['partialResultToken'])
                 : (throw '''${json['partialResultToken']} was not one of (num, String)''')));
     return DocumentHighlightParams(
         textDocument: textDocument,
@@ -11323,7 +10845,7 @@
 
   /// An optional token that a server can use to report partial results (e.g.
   /// streaming) to the client.
-  final Either2<num, String> partialResultToken;
+  final Either2<num, String>? partialResultToken;
 
   /// The position inside the text document.
   final Position position;
@@ -11332,14 +10854,12 @@
   final TextDocumentIdentifier textDocument;
 
   /// An optional token that a server can use to report work done progress.
-  final Either2<num, String> workDoneToken;
+  final Either2<num, String>? workDoneToken;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['textDocument'] = textDocument?.toJson() ??
-        (throw 'textDocument is required but was not set');
-    __result['position'] =
-        position?.toJson() ?? (throw 'position is required but was not set');
+    __result['textDocument'] = textDocument.toJson();
+    __result['position'] = position.toJson();
     if (workDoneToken != null) {
       __result['workDoneToken'] = workDoneToken;
     }
@@ -11465,8 +10985,8 @@
 
   /// A document selector to identify the scope of the registration. If set to
   /// null the document selector provided on the client side will be used.
-  final List<DocumentFilter> documentSelector;
-  final bool workDoneProgress;
+  final List<DocumentFilter>? documentSelector;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -11543,13 +11063,9 @@
   static const jsonHandler =
       LspJsonHandler(DocumentLink.canParse, DocumentLink.fromJson);
 
-  DocumentLink({@required this.range, this.target, this.tooltip, this.data}) {
-    if (range == null) {
-      throw 'range is required but was not provided';
-    }
-  }
+  DocumentLink({required this.range, this.target, this.tooltip, this.data});
   static DocumentLink fromJson(Map<String, dynamic> json) {
-    final range = json['range'] != null ? Range.fromJson(json['range']) : null;
+    final range = Range.fromJson(json['range']);
     final target = json['target'];
     final tooltip = json['tooltip'];
     final data = json['data'];
@@ -11565,7 +11081,7 @@
   final Range range;
 
   /// The uri this link points to. If missing a resolve request is sent later.
-  final String target;
+  final String? target;
 
   /// The tooltip text when you hover over this link.
   ///
@@ -11574,12 +11090,11 @@
   /// specific instructions vary depending on OS, user settings, and
   /// localization.
   ///  @since 3.15.0
-  final String tooltip;
+  final String? tooltip;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['range'] =
-        range?.toJson() ?? (throw 'range is required but was not set');
+    __result['range'] = range.toJson();
     if (target != null) {
       __result['target'] = target;
     }
@@ -11629,15 +11144,6 @@
       } finally {
         reporter.pop();
       }
-      reporter.push('data');
-      try {
-        if (obj['data'] != null && !(true)) {
-          reporter.reportError('must be of type dynamic');
-          return false;
-        }
-      } finally {
-        reporter.pop();
-      }
       return true;
     } else {
       reporter.reportError('must be of type DocumentLink');
@@ -11687,11 +11193,11 @@
   }
 
   /// Whether document link supports dynamic registration.
-  final bool dynamicRegistration;
+  final bool? dynamicRegistration;
 
   /// Whether the client supports the `tooltip` property on `DocumentLink`.
   ///  @since 3.15.0
-  final bool tooltipSupport;
+  final bool? tooltipSupport;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -11771,8 +11277,8 @@
   }
 
   /// Document links have a resolve provider as well.
-  final bool resolveProvider;
-  final bool workDoneProgress;
+  final bool? resolveProvider;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -11843,30 +11349,24 @@
       LspJsonHandler(DocumentLinkParams.canParse, DocumentLinkParams.fromJson);
 
   DocumentLinkParams(
-      {@required this.textDocument,
+      {required this.textDocument,
       this.workDoneToken,
-      this.partialResultToken}) {
-    if (textDocument == null) {
-      throw 'textDocument is required but was not provided';
-    }
-  }
+      this.partialResultToken});
   static DocumentLinkParams fromJson(Map<String, dynamic> json) {
-    final textDocument = json['textDocument'] != null
-        ? TextDocumentIdentifier.fromJson(json['textDocument'])
-        : null;
-    final workDoneToken = json['workDoneToken'] is num
-        ? Either2<num, String>.t1(json['workDoneToken'])
-        : (json['workDoneToken'] is String
-            ? Either2<num, String>.t2(json['workDoneToken'])
-            : (json['workDoneToken'] == null
-                ? null
+    final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
+    final workDoneToken = json['workDoneToken'] == null
+        ? null
+        : (json['workDoneToken'] is num
+            ? Either2<num, String>.t1(json['workDoneToken'])
+            : (json['workDoneToken'] is String
+                ? Either2<num, String>.t2(json['workDoneToken'])
                 : (throw '''${json['workDoneToken']} was not one of (num, String)''')));
-    final partialResultToken = json['partialResultToken'] is num
-        ? Either2<num, String>.t1(json['partialResultToken'])
-        : (json['partialResultToken'] is String
-            ? Either2<num, String>.t2(json['partialResultToken'])
-            : (json['partialResultToken'] == null
-                ? null
+    final partialResultToken = json['partialResultToken'] == null
+        ? null
+        : (json['partialResultToken'] is num
+            ? Either2<num, String>.t1(json['partialResultToken'])
+            : (json['partialResultToken'] is String
+                ? Either2<num, String>.t2(json['partialResultToken'])
                 : (throw '''${json['partialResultToken']} was not one of (num, String)''')));
     return DocumentLinkParams(
         textDocument: textDocument,
@@ -11876,18 +11376,17 @@
 
   /// An optional token that a server can use to report partial results (e.g.
   /// streaming) to the client.
-  final Either2<num, String> partialResultToken;
+  final Either2<num, String>? partialResultToken;
 
   /// The document to provide document links for.
   final TextDocumentIdentifier textDocument;
 
   /// An optional token that a server can use to report work done progress.
-  final Either2<num, String> workDoneToken;
+  final Either2<num, String>? workDoneToken;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['textDocument'] = textDocument?.toJson() ??
-        (throw 'textDocument is required but was not set');
+    __result['textDocument'] = textDocument.toJson();
     if (workDoneToken != null) {
       __result['workDoneToken'] = workDoneToken;
     }
@@ -11996,11 +11495,11 @@
 
   /// A document selector to identify the scope of the registration. If set to
   /// null the document selector provided on the client side will be used.
-  final List<DocumentFilter> documentSelector;
+  final List<DocumentFilter>? documentSelector;
 
   /// Document links have a resolve provider as well.
-  final bool resolveProvider;
-  final bool workDoneProgress;
+  final bool? resolveProvider;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -12099,7 +11598,7 @@
   }
 
   /// Whether on type formatting supports dynamic registration.
-  final bool dynamicRegistration;
+  final bool? dynamicRegistration;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -12155,11 +11654,7 @@
       DocumentOnTypeFormattingOptions.fromJson);
 
   DocumentOnTypeFormattingOptions(
-      {@required this.firstTriggerCharacter, this.moreTriggerCharacter}) {
-    if (firstTriggerCharacter == null) {
-      throw 'firstTriggerCharacter is required but was not provided';
-    }
-  }
+      {required this.firstTriggerCharacter, this.moreTriggerCharacter});
   static DocumentOnTypeFormattingOptions fromJson(Map<String, dynamic> json) {
     if (DocumentOnTypeFormattingRegistrationOptions.canParse(
         json, nullLspJsonReporter)) {
@@ -12179,12 +11674,11 @@
   final String firstTriggerCharacter;
 
   /// More trigger characters.
-  final List<String> moreTriggerCharacter;
+  final List<String>? moreTriggerCharacter;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['firstTriggerCharacter'] = firstTriggerCharacter ??
-        (throw 'firstTriggerCharacter is required but was not set');
+    __result['firstTriggerCharacter'] = firstTriggerCharacter;
     if (moreTriggerCharacter != null) {
       __result['moreTriggerCharacter'] = moreTriggerCharacter;
     }
@@ -12260,33 +11754,15 @@
       DocumentOnTypeFormattingParams.fromJson);
 
   DocumentOnTypeFormattingParams(
-      {@required this.ch,
-      @required this.options,
-      @required this.textDocument,
-      @required this.position}) {
-    if (ch == null) {
-      throw 'ch is required but was not provided';
-    }
-    if (options == null) {
-      throw 'options is required but was not provided';
-    }
-    if (textDocument == null) {
-      throw 'textDocument is required but was not provided';
-    }
-    if (position == null) {
-      throw 'position is required but was not provided';
-    }
-  }
+      {required this.ch,
+      required this.options,
+      required this.textDocument,
+      required this.position});
   static DocumentOnTypeFormattingParams fromJson(Map<String, dynamic> json) {
     final ch = json['ch'];
-    final options = json['options'] != null
-        ? FormattingOptions.fromJson(json['options'])
-        : null;
-    final textDocument = json['textDocument'] != null
-        ? TextDocumentIdentifier.fromJson(json['textDocument'])
-        : null;
-    final position =
-        json['position'] != null ? Position.fromJson(json['position']) : null;
+    final options = FormattingOptions.fromJson(json['options']);
+    final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
+    final position = Position.fromJson(json['position']);
     return DocumentOnTypeFormattingParams(
         ch: ch,
         options: options,
@@ -12308,13 +11784,10 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['ch'] = ch ?? (throw 'ch is required but was not set');
-    __result['options'] =
-        options?.toJson() ?? (throw 'options is required but was not set');
-    __result['textDocument'] = textDocument?.toJson() ??
-        (throw 'textDocument is required but was not set');
-    __result['position'] =
-        position?.toJson() ?? (throw 'position is required but was not set');
+    __result['ch'] = ch;
+    __result['options'] = options.toJson();
+    __result['textDocument'] = textDocument.toJson();
+    __result['position'] = position.toJson();
     return __result;
   }
 
@@ -12433,12 +11906,8 @@
 
   DocumentOnTypeFormattingRegistrationOptions(
       {this.documentSelector,
-      @required this.firstTriggerCharacter,
-      this.moreTriggerCharacter}) {
-    if (firstTriggerCharacter == null) {
-      throw 'firstTriggerCharacter is required but was not provided';
-    }
-  }
+      required this.firstTriggerCharacter,
+      this.moreTriggerCharacter});
   static DocumentOnTypeFormattingRegistrationOptions fromJson(
       Map<String, dynamic> json) {
     final documentSelector = json['documentSelector']
@@ -12458,19 +11927,18 @@
 
   /// A document selector to identify the scope of the registration. If set to
   /// null the document selector provided on the client side will be used.
-  final List<DocumentFilter> documentSelector;
+  final List<DocumentFilter>? documentSelector;
 
   /// A character on which formatting should be triggered, like `}`.
   final String firstTriggerCharacter;
 
   /// More trigger characters.
-  final List<String> moreTriggerCharacter;
+  final List<String>? moreTriggerCharacter;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
     __result['documentSelector'] = documentSelector;
-    __result['firstTriggerCharacter'] = firstTriggerCharacter ??
-        (throw 'firstTriggerCharacter is required but was not set');
+    __result['firstTriggerCharacter'] = firstTriggerCharacter;
     if (moreTriggerCharacter != null) {
       __result['moreTriggerCharacter'] = moreTriggerCharacter;
     }
@@ -12573,7 +12041,7 @@
   }
 
   /// Whether formatting supports dynamic registration.
-  final bool dynamicRegistration;
+  final bool? dynamicRegistration;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -12639,7 +12107,7 @@
     return DocumentRangeFormattingOptions(workDoneProgress: workDoneProgress);
   }
 
-  final bool workDoneProgress;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -12695,34 +12163,20 @@
       DocumentRangeFormattingParams.fromJson);
 
   DocumentRangeFormattingParams(
-      {@required this.textDocument,
-      @required this.range,
-      @required this.options,
-      this.workDoneToken}) {
-    if (textDocument == null) {
-      throw 'textDocument is required but was not provided';
-    }
-    if (range == null) {
-      throw 'range is required but was not provided';
-    }
-    if (options == null) {
-      throw 'options is required but was not provided';
-    }
-  }
+      {required this.textDocument,
+      required this.range,
+      required this.options,
+      this.workDoneToken});
   static DocumentRangeFormattingParams fromJson(Map<String, dynamic> json) {
-    final textDocument = json['textDocument'] != null
-        ? TextDocumentIdentifier.fromJson(json['textDocument'])
-        : null;
-    final range = json['range'] != null ? Range.fromJson(json['range']) : null;
-    final options = json['options'] != null
-        ? FormattingOptions.fromJson(json['options'])
-        : null;
-    final workDoneToken = json['workDoneToken'] is num
-        ? Either2<num, String>.t1(json['workDoneToken'])
-        : (json['workDoneToken'] is String
-            ? Either2<num, String>.t2(json['workDoneToken'])
-            : (json['workDoneToken'] == null
-                ? null
+    final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
+    final range = Range.fromJson(json['range']);
+    final options = FormattingOptions.fromJson(json['options']);
+    final workDoneToken = json['workDoneToken'] == null
+        ? null
+        : (json['workDoneToken'] is num
+            ? Either2<num, String>.t1(json['workDoneToken'])
+            : (json['workDoneToken'] is String
+                ? Either2<num, String>.t2(json['workDoneToken'])
                 : (throw '''${json['workDoneToken']} was not one of (num, String)''')));
     return DocumentRangeFormattingParams(
         textDocument: textDocument,
@@ -12741,16 +12195,13 @@
   final TextDocumentIdentifier textDocument;
 
   /// An optional token that a server can use to report work done progress.
-  final Either2<num, String> workDoneToken;
+  final Either2<num, String>? workDoneToken;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['textDocument'] = textDocument?.toJson() ??
-        (throw 'textDocument is required but was not set');
-    __result['range'] =
-        range?.toJson() ?? (throw 'range is required but was not set');
-    __result['options'] =
-        options?.toJson() ?? (throw 'options is required but was not set');
+    __result['textDocument'] = textDocument.toJson();
+    __result['range'] = range.toJson();
+    __result['options'] = options.toJson();
     if (workDoneToken != null) {
       __result['workDoneToken'] = workDoneToken;
     }
@@ -12879,8 +12330,8 @@
 
   /// A document selector to identify the scope of the registration. If set to
   /// null the document selector provided on the client side will be used.
-  final List<DocumentFilter> documentSelector;
-  final bool workDoneProgress;
+  final List<DocumentFilter>? documentSelector;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -12960,41 +12411,25 @@
       LspJsonHandler(DocumentSymbol.canParse, DocumentSymbol.fromJson);
 
   DocumentSymbol(
-      {@required this.name,
+      {required this.name,
       this.detail,
-      @required this.kind,
+      required this.kind,
       this.tags,
       this.deprecated,
-      @required this.range,
-      @required this.selectionRange,
-      this.children}) {
-    if (name == null) {
-      throw 'name is required but was not provided';
-    }
-    if (kind == null) {
-      throw 'kind is required but was not provided';
-    }
-    if (range == null) {
-      throw 'range is required but was not provided';
-    }
-    if (selectionRange == null) {
-      throw 'selectionRange is required but was not provided';
-    }
-  }
+      required this.range,
+      required this.selectionRange,
+      this.children});
   static DocumentSymbol fromJson(Map<String, dynamic> json) {
     final name = json['name'];
     final detail = json['detail'];
-    final kind =
-        json['kind'] != null ? SymbolKind.fromJson(json['kind']) : null;
+    final kind = SymbolKind.fromJson(json['kind']);
     final tags = json['tags']
         ?.map((item) => item != null ? SymbolTag.fromJson(item) : null)
         ?.cast<SymbolTag>()
         ?.toList();
     final deprecated = json['deprecated'];
-    final range = json['range'] != null ? Range.fromJson(json['range']) : null;
-    final selectionRange = json['selectionRange'] != null
-        ? Range.fromJson(json['selectionRange'])
-        : null;
+    final range = Range.fromJson(json['range']);
+    final selectionRange = Range.fromJson(json['selectionRange']);
     final children = json['children']
         ?.map((item) => item != null ? DocumentSymbol.fromJson(item) : null)
         ?.cast<DocumentSymbol>()
@@ -13011,14 +12446,14 @@
   }
 
   /// Children of this symbol, e.g. properties of a class.
-  final List<DocumentSymbol> children;
+  final List<DocumentSymbol>? children;
 
   /// Indicates if this symbol is deprecated.
   ///  @deprecated Use tags instead
-  final bool deprecated;
+  final bool? deprecated;
 
   /// More detail for this symbol, e.g the signature of a function.
-  final String detail;
+  final String? detail;
 
   /// The kind of this symbol.
   final SymbolKind kind;
@@ -13040,28 +12475,25 @@
 
   /// Tags for this document symbol.
   ///  @since 3.16.0
-  final List<SymbolTag> tags;
+  final List<SymbolTag>? tags;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['name'] = name ?? (throw 'name is required but was not set');
+    __result['name'] = name;
     if (detail != null) {
       __result['detail'] = detail;
     }
-    __result['kind'] =
-        kind?.toJson() ?? (throw 'kind is required but was not set');
+    __result['kind'] = kind.toJson();
     if (tags != null) {
-      __result['tags'] = tags.map((item) => item.toJson()).toList();
+      __result['tags'] = tags?.map((item) => item.toJson()).toList();
     }
     if (deprecated != null) {
       __result['deprecated'] = deprecated;
     }
-    __result['range'] =
-        range?.toJson() ?? (throw 'range is required but was not set');
-    __result['selectionRange'] = selectionRange?.toJson() ??
-        (throw 'selectionRange is required but was not set');
+    __result['range'] = range.toJson();
+    __result['selectionRange'] = selectionRange.toJson();
     if (children != null) {
-      __result['children'] = children.map((item) => item.toJson()).toList();
+      __result['children'] = children?.map((item) => item.toJson()).toList();
     }
     return __result;
   }
@@ -13253,25 +12685,25 @@
   }
 
   /// Whether document symbol supports dynamic registration.
-  final bool dynamicRegistration;
+  final bool? dynamicRegistration;
 
   /// The client supports hierarchical document symbols.
-  final bool hierarchicalDocumentSymbolSupport;
+  final bool? hierarchicalDocumentSymbolSupport;
 
   /// The client supports an additional label presented in the UI when
   /// registering a document symbol provider.
   ///  @since 3.16.0
-  final bool labelSupport;
+  final bool? labelSupport;
 
   /// Specific capabilities for the `SymbolKind` in the
   /// `textDocument/documentSymbol` request.
-  final DocumentSymbolClientCapabilitiesSymbolKind symbolKind;
+  final DocumentSymbolClientCapabilitiesSymbolKind? symbolKind;
 
   /// The client supports tags on `SymbolInformation`. Tags are supported on
   /// `DocumentSymbol` if `hierarchicalDocumentSymbolSupport` is set to true.
   /// Clients supporting tags have to handle unknown tags gracefully.
   ///  @since 3.16.0
-  final DocumentSymbolClientCapabilitiesTagSupport tagSupport;
+  final DocumentSymbolClientCapabilitiesTagSupport? tagSupport;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -13279,14 +12711,14 @@
       __result['dynamicRegistration'] = dynamicRegistration;
     }
     if (symbolKind != null) {
-      __result['symbolKind'] = symbolKind.toJson();
+      __result['symbolKind'] = symbolKind?.toJson();
     }
     if (hierarchicalDocumentSymbolSupport != null) {
       __result['hierarchicalDocumentSymbolSupport'] =
           hierarchicalDocumentSymbolSupport;
     }
     if (tagSupport != null) {
-      __result['tagSupport'] = tagSupport.toJson();
+      __result['tagSupport'] = tagSupport?.toJson();
     }
     if (labelSupport != null) {
       __result['labelSupport'] = labelSupport;
@@ -13408,12 +12840,12 @@
   ///
   /// If this property is not present the client only supports the symbol kinds
   /// from `File` to `Array` as defined in the initial version of the protocol.
-  final List<SymbolKind> valueSet;
+  final List<SymbolKind>? valueSet;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
     if (valueSet != null) {
-      __result['valueSet'] = valueSet.map((item) => item.toJson()).toList();
+      __result['valueSet'] = valueSet?.map((item) => item.toJson()).toList();
     }
     return __result;
   }
@@ -13467,15 +12899,11 @@
       DocumentSymbolClientCapabilitiesTagSupport.canParse,
       DocumentSymbolClientCapabilitiesTagSupport.fromJson);
 
-  DocumentSymbolClientCapabilitiesTagSupport({@required this.valueSet}) {
-    if (valueSet == null) {
-      throw 'valueSet is required but was not provided';
-    }
-  }
+  DocumentSymbolClientCapabilitiesTagSupport({required this.valueSet});
   static DocumentSymbolClientCapabilitiesTagSupport fromJson(
       Map<String, dynamic> json) {
     final valueSet = json['valueSet']
-        ?.map((item) => item != null ? SymbolTag.fromJson(item) : null)
+        ?.map((item) => SymbolTag.fromJson(item))
         ?.cast<SymbolTag>()
         ?.toList();
     return DocumentSymbolClientCapabilitiesTagSupport(valueSet: valueSet);
@@ -13486,8 +12914,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['valueSet'] = valueSet?.map((item) => item.toJson())?.toList() ??
-        (throw 'valueSet is required but was not set');
+    __result['valueSet'] = valueSet.map((item) => item.toJson()).toList();
     return __result;
   }
 
@@ -13560,8 +12987,8 @@
   /// A human-readable string that is shown when multiple outlines trees are
   /// shown for the same document.
   ///  @since 3.16.0
-  final String label;
-  final bool workDoneProgress;
+  final String? label;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -13631,30 +13058,24 @@
       DocumentSymbolParams.canParse, DocumentSymbolParams.fromJson);
 
   DocumentSymbolParams(
-      {@required this.textDocument,
+      {required this.textDocument,
       this.workDoneToken,
-      this.partialResultToken}) {
-    if (textDocument == null) {
-      throw 'textDocument is required but was not provided';
-    }
-  }
+      this.partialResultToken});
   static DocumentSymbolParams fromJson(Map<String, dynamic> json) {
-    final textDocument = json['textDocument'] != null
-        ? TextDocumentIdentifier.fromJson(json['textDocument'])
-        : null;
-    final workDoneToken = json['workDoneToken'] is num
-        ? Either2<num, String>.t1(json['workDoneToken'])
-        : (json['workDoneToken'] is String
-            ? Either2<num, String>.t2(json['workDoneToken'])
-            : (json['workDoneToken'] == null
-                ? null
+    final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
+    final workDoneToken = json['workDoneToken'] == null
+        ? null
+        : (json['workDoneToken'] is num
+            ? Either2<num, String>.t1(json['workDoneToken'])
+            : (json['workDoneToken'] is String
+                ? Either2<num, String>.t2(json['workDoneToken'])
                 : (throw '''${json['workDoneToken']} was not one of (num, String)''')));
-    final partialResultToken = json['partialResultToken'] is num
-        ? Either2<num, String>.t1(json['partialResultToken'])
-        : (json['partialResultToken'] is String
-            ? Either2<num, String>.t2(json['partialResultToken'])
-            : (json['partialResultToken'] == null
-                ? null
+    final partialResultToken = json['partialResultToken'] == null
+        ? null
+        : (json['partialResultToken'] is num
+            ? Either2<num, String>.t1(json['partialResultToken'])
+            : (json['partialResultToken'] is String
+                ? Either2<num, String>.t2(json['partialResultToken'])
                 : (throw '''${json['partialResultToken']} was not one of (num, String)''')));
     return DocumentSymbolParams(
         textDocument: textDocument,
@@ -13664,18 +13085,17 @@
 
   /// An optional token that a server can use to report partial results (e.g.
   /// streaming) to the client.
-  final Either2<num, String> partialResultToken;
+  final Either2<num, String>? partialResultToken;
 
   /// The text document.
   final TextDocumentIdentifier textDocument;
 
   /// An optional token that a server can use to report work done progress.
-  final Either2<num, String> workDoneToken;
+  final Either2<num, String>? workDoneToken;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['textDocument'] = textDocument?.toJson() ??
-        (throw 'textDocument is required but was not set');
+    __result['textDocument'] = textDocument.toJson();
     if (workDoneToken != null) {
       __result['workDoneToken'] = workDoneToken;
     }
@@ -13784,13 +13204,13 @@
 
   /// A document selector to identify the scope of the registration. If set to
   /// null the document selector provided on the client side will be used.
-  final List<DocumentFilter> documentSelector;
+  final List<DocumentFilter>? documentSelector;
 
   /// A human-readable string that is shown when multiple outlines trees are
   /// shown for the same document.
   ///  @since 3.16.0
-  final String label;
-  final bool workDoneProgress;
+  final String? label;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -13940,7 +13360,7 @@
   }
 
   /// Execute command supports dynamic registration.
-  final bool dynamicRegistration;
+  final bool? dynamicRegistration;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -13993,11 +13413,7 @@
   static const jsonHandler = LspJsonHandler(
       ExecuteCommandOptions.canParse, ExecuteCommandOptions.fromJson);
 
-  ExecuteCommandOptions({@required this.commands, this.workDoneProgress}) {
-    if (commands == null) {
-      throw 'commands is required but was not provided';
-    }
-  }
+  ExecuteCommandOptions({required this.commands, this.workDoneProgress});
   static ExecuteCommandOptions fromJson(Map<String, dynamic> json) {
     if (ExecuteCommandRegistrationOptions.canParse(json, nullLspJsonReporter)) {
       return ExecuteCommandRegistrationOptions.fromJson(json);
@@ -14011,12 +13427,11 @@
 
   /// The commands to be executed on the server
   final List<String> commands;
-  final bool workDoneProgress;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['commands'] =
-        commands ?? (throw 'commands is required but was not set');
+    __result['commands'] = commands;
     if (workDoneProgress != null) {
       __result['workDoneProgress'] = workDoneProgress;
     }
@@ -14089,39 +13504,34 @@
       ExecuteCommandParams.canParse, ExecuteCommandParams.fromJson);
 
   ExecuteCommandParams(
-      {@required this.command, this.arguments, this.workDoneToken}) {
-    if (command == null) {
-      throw 'command is required but was not provided';
-    }
-  }
+      {required this.command, this.arguments, this.workDoneToken});
   static ExecuteCommandParams fromJson(Map<String, dynamic> json) {
     final command = json['command'];
     final arguments =
         json['arguments']?.map((item) => item)?.cast<dynamic>()?.toList();
-    final workDoneToken = json['workDoneToken'] is num
-        ? Either2<num, String>.t1(json['workDoneToken'])
-        : (json['workDoneToken'] is String
-            ? Either2<num, String>.t2(json['workDoneToken'])
-            : (json['workDoneToken'] == null
-                ? null
+    final workDoneToken = json['workDoneToken'] == null
+        ? null
+        : (json['workDoneToken'] is num
+            ? Either2<num, String>.t1(json['workDoneToken'])
+            : (json['workDoneToken'] is String
+                ? Either2<num, String>.t2(json['workDoneToken'])
                 : (throw '''${json['workDoneToken']} was not one of (num, String)''')));
     return ExecuteCommandParams(
         command: command, arguments: arguments, workDoneToken: workDoneToken);
   }
 
   /// Arguments that the command should be invoked with.
-  final List<dynamic> arguments;
+  final List<dynamic>? arguments;
 
   /// The identifier of the actual command handler.
   final String command;
 
   /// An optional token that a server can use to report work done progress.
-  final Either2<num, String> workDoneToken;
+  final Either2<num, String>? workDoneToken;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['command'] =
-        command ?? (throw 'command is required but was not set');
+    __result['command'] = command;
     if (arguments != null) {
       __result['arguments'] = arguments;
     }
@@ -14213,11 +13623,7 @@
       ExecuteCommandRegistrationOptions.fromJson);
 
   ExecuteCommandRegistrationOptions(
-      {@required this.commands, this.workDoneProgress}) {
-    if (commands == null) {
-      throw 'commands is required but was not provided';
-    }
-  }
+      {required this.commands, this.workDoneProgress});
   static ExecuteCommandRegistrationOptions fromJson(Map<String, dynamic> json) {
     final commands =
         json['commands']?.map((item) => item)?.cast<String>()?.toList();
@@ -14228,12 +13634,11 @@
 
   /// The commands to be executed on the server
   final List<String> commands;
-  final bool workDoneProgress;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['commands'] =
-        commands ?? (throw 'commands is required but was not set');
+    __result['commands'] = commands;
     if (workDoneProgress != null) {
       __result['workDoneProgress'] = workDoneProgress;
     }
@@ -14385,11 +13790,7 @@
   static const jsonHandler =
       LspJsonHandler(FileCreate.canParse, FileCreate.fromJson);
 
-  FileCreate({@required this.uri}) {
-    if (uri == null) {
-      throw 'uri is required but was not provided';
-    }
-  }
+  FileCreate({required this.uri});
   static FileCreate fromJson(Map<String, dynamic> json) {
     final uri = json['uri'];
     return FileCreate(uri: uri);
@@ -14400,7 +13801,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['uri'] = uri ?? (throw 'uri is required but was not set');
+    __result['uri'] = uri;
     return __result;
   }
 
@@ -14455,11 +13856,7 @@
   static const jsonHandler =
       LspJsonHandler(FileDelete.canParse, FileDelete.fromJson);
 
-  FileDelete({@required this.uri}) {
-    if (uri == null) {
-      throw 'uri is required but was not provided';
-    }
-  }
+  FileDelete({required this.uri});
   static FileDelete fromJson(Map<String, dynamic> json) {
     final uri = json['uri'];
     return FileDelete(uri: uri);
@@ -14470,7 +13867,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['uri'] = uri ?? (throw 'uri is required but was not set');
+    __result['uri'] = uri;
     return __result;
   }
 
@@ -14524,14 +13921,7 @@
   static const jsonHandler =
       LspJsonHandler(FileEvent.canParse, FileEvent.fromJson);
 
-  FileEvent({@required this.uri, @required this.type}) {
-    if (uri == null) {
-      throw 'uri is required but was not provided';
-    }
-    if (type == null) {
-      throw 'type is required but was not provided';
-    }
-  }
+  FileEvent({required this.uri, required this.type});
   static FileEvent fromJson(Map<String, dynamic> json) {
     final uri = json['uri'];
     final type = json['type'];
@@ -14546,8 +13936,8 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['uri'] = uri ?? (throw 'uri is required but was not set');
-    __result['type'] = type ?? (throw 'type is required but was not set');
+    __result['uri'] = uri;
+    __result['type'] = type;
     return __result;
   }
 
@@ -14621,16 +14011,10 @@
   static const jsonHandler = LspJsonHandler(
       FileOperationFilter.canParse, FileOperationFilter.fromJson);
 
-  FileOperationFilter({this.scheme, @required this.pattern}) {
-    if (pattern == null) {
-      throw 'pattern is required but was not provided';
-    }
-  }
+  FileOperationFilter({this.scheme, required this.pattern});
   static FileOperationFilter fromJson(Map<String, dynamic> json) {
     final scheme = json['scheme'];
-    final pattern = json['pattern'] != null
-        ? FileOperationPattern.fromJson(json['pattern'])
-        : null;
+    final pattern = FileOperationPattern.fromJson(json['pattern']);
     return FileOperationFilter(scheme: scheme, pattern: pattern);
   }
 
@@ -14638,15 +14022,14 @@
   final FileOperationPattern pattern;
 
   /// A Uri like `file` or `untitled`.
-  final String scheme;
+  final String? scheme;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
     if (scheme != null) {
       __result['scheme'] = scheme;
     }
-    __result['pattern'] =
-        pattern?.toJson() ?? (throw 'pattern is required but was not set');
+    __result['pattern'] = pattern.toJson();
     return __result;
   }
 
@@ -14713,11 +14096,7 @@
   static const jsonHandler = LspJsonHandler(
       FileOperationPattern.canParse, FileOperationPattern.fromJson);
 
-  FileOperationPattern({@required this.glob, this.matches, this.options}) {
-    if (glob == null) {
-      throw 'glob is required but was not provided';
-    }
-  }
+  FileOperationPattern({required this.glob, this.matches, this.options});
   static FileOperationPattern fromJson(Map<String, dynamic> json) {
     final glob = json['glob'];
     final matches = json['matches'] != null
@@ -14745,19 +14124,19 @@
   /// Whether to match files or folders with this pattern.
   ///
   /// Matches both if undefined.
-  final FileOperationPatternKind matches;
+  final FileOperationPatternKind? matches;
 
   /// Additional options used during matching.
-  final FileOperationPatternOptions options;
+  final FileOperationPatternOptions? options;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['glob'] = glob ?? (throw 'glob is required but was not set');
+    __result['glob'] = glob;
     if (matches != null) {
-      __result['matches'] = matches.toJson();
+      __result['matches'] = matches?.toJson();
     }
     if (options != null) {
-      __result['options'] = options.toJson();
+      __result['options'] = options?.toJson();
     }
     return __result;
   }
@@ -14877,7 +14256,7 @@
   }
 
   /// The pattern should be matched ignoring casing.
-  final bool ignoreCase;
+  final bool? ignoreCase;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -14932,15 +14311,10 @@
       FileOperationRegistrationOptions.canParse,
       FileOperationRegistrationOptions.fromJson);
 
-  FileOperationRegistrationOptions({@required this.filters}) {
-    if (filters == null) {
-      throw 'filters is required but was not provided';
-    }
-  }
+  FileOperationRegistrationOptions({required this.filters});
   static FileOperationRegistrationOptions fromJson(Map<String, dynamic> json) {
     final filters = json['filters']
-        ?.map(
-            (item) => item != null ? FileOperationFilter.fromJson(item) : null)
+        ?.map((item) => FileOperationFilter.fromJson(item))
         ?.cast<FileOperationFilter>()
         ?.toList();
     return FileOperationRegistrationOptions(filters: filters);
@@ -14951,8 +14325,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['filters'] = filters?.map((item) => item.toJson())?.toList() ??
-        (throw 'filters is required but was not set');
+    __result['filters'] = filters.map((item) => item.toJson()).toList();
     return __result;
   }
 
@@ -15012,14 +14385,7 @@
   static const jsonHandler =
       LspJsonHandler(FileRename.canParse, FileRename.fromJson);
 
-  FileRename({@required this.oldUri, @required this.newUri}) {
-    if (oldUri == null) {
-      throw 'oldUri is required but was not provided';
-    }
-    if (newUri == null) {
-      throw 'newUri is required but was not provided';
-    }
-  }
+  FileRename({required this.oldUri, required this.newUri});
   static FileRename fromJson(Map<String, dynamic> json) {
     final oldUri = json['oldUri'];
     final newUri = json['newUri'];
@@ -15034,8 +14400,8 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['oldUri'] = oldUri ?? (throw 'oldUri is required but was not set');
-    __result['newUri'] = newUri ?? (throw 'newUri is required but was not set');
+    __result['oldUri'] = oldUri;
+    __result['newUri'] = newUri;
     return __result;
   }
 
@@ -15106,11 +14472,7 @@
   static const jsonHandler =
       LspJsonHandler(FileSystemWatcher.canParse, FileSystemWatcher.fromJson);
 
-  FileSystemWatcher({@required this.globPattern, this.kind}) {
-    if (globPattern == null) {
-      throw 'globPattern is required but was not provided';
-    }
-  }
+  FileSystemWatcher({required this.globPattern, this.kind});
   static FileSystemWatcher fromJson(Map<String, dynamic> json) {
     final globPattern = json['globPattern'];
     final kind = json['kind'] != null ? WatchKind.fromJson(json['kind']) : null;
@@ -15134,14 +14496,13 @@
 
   /// The kind of events of interest. If omitted it defaults to WatchKind.Create
   /// | WatchKind.Change | WatchKind.Delete which is 7.
-  final WatchKind kind;
+  final WatchKind? kind;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['globPattern'] =
-        globPattern ?? (throw 'globPattern is required but was not set');
+    __result['globPattern'] = globPattern;
     if (kind != null) {
-      __result['kind'] = kind.toJson();
+      __result['kind'] = kind?.toJson();
     }
     return __result;
   }
@@ -15210,18 +14571,11 @@
       LspJsonHandler(FoldingRange.canParse, FoldingRange.fromJson);
 
   FoldingRange(
-      {@required this.startLine,
+      {required this.startLine,
       this.startCharacter,
-      @required this.endLine,
+      required this.endLine,
       this.endCharacter,
-      this.kind}) {
-    if (startLine == null) {
-      throw 'startLine is required but was not provided';
-    }
-    if (endLine == null) {
-      throw 'endLine is required but was not provided';
-    }
-  }
+      this.kind});
   static FoldingRange fromJson(Map<String, dynamic> json) {
     final startLine = json['startLine'];
     final startCharacter = json['startCharacter'];
@@ -15239,7 +14593,7 @@
 
   /// The zero-based character offset before the folded range ends. If not
   /// defined, defaults to the length of the end line.
-  final num endCharacter;
+  final num? endCharacter;
 
   /// The zero-based end line of the range to fold. The folded area ends with
   /// the line's last character. To be valid, the end must be zero or larger and
@@ -15250,11 +14604,11 @@
   /// kind is used to categorize folding ranges and used by commands like 'Fold
   /// all comments'. See [FoldingRangeKind] for an enumeration of standardized
   /// kinds.
-  final FoldingRangeKind kind;
+  final FoldingRangeKind? kind;
 
   /// The zero-based character offset from where the folded range starts. If not
   /// defined, defaults to the length of the start line.
-  final num startCharacter;
+  final num? startCharacter;
 
   /// The zero-based start line of the range to fold. The folded area starts
   /// after the line's last character. To be valid, the end must be zero or
@@ -15263,18 +14617,16 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['startLine'] =
-        startLine ?? (throw 'startLine is required but was not set');
+    __result['startLine'] = startLine;
     if (startCharacter != null) {
       __result['startCharacter'] = startCharacter;
     }
-    __result['endLine'] =
-        endLine ?? (throw 'endLine is required but was not set');
+    __result['endLine'] = endLine;
     if (endCharacter != null) {
       __result['endCharacter'] = endCharacter;
     }
     if (kind != null) {
-      __result['kind'] = kind.toJson();
+      __result['kind'] = kind?.toJson();
     }
     return __result;
   }
@@ -15399,17 +14751,17 @@
   /// providers. If this is set to `true` the client supports the new
   /// `FoldingRangeRegistrationOptions` return value for the corresponding
   /// server capability as well.
-  final bool dynamicRegistration;
+  final bool? dynamicRegistration;
 
   /// If set, the client signals that it only supports folding complete lines.
   /// If set, client will ignore specified `startCharacter` and `endCharacter`
   /// properties in a FoldingRange.
-  final bool lineFoldingOnly;
+  final bool? lineFoldingOnly;
 
   /// The maximum number of folding ranges that the client prefers to receive
   /// per document. The value serves as a hint, servers are free to follow the
   /// limit.
-  final num rangeLimit;
+  final num? rangeLimit;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -15532,7 +14884,7 @@
     return FoldingRangeOptions(workDoneProgress: workDoneProgress);
   }
 
-  final bool workDoneProgress;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -15587,30 +14939,24 @@
       LspJsonHandler(FoldingRangeParams.canParse, FoldingRangeParams.fromJson);
 
   FoldingRangeParams(
-      {@required this.textDocument,
+      {required this.textDocument,
       this.workDoneToken,
-      this.partialResultToken}) {
-    if (textDocument == null) {
-      throw 'textDocument is required but was not provided';
-    }
-  }
+      this.partialResultToken});
   static FoldingRangeParams fromJson(Map<String, dynamic> json) {
-    final textDocument = json['textDocument'] != null
-        ? TextDocumentIdentifier.fromJson(json['textDocument'])
-        : null;
-    final workDoneToken = json['workDoneToken'] is num
-        ? Either2<num, String>.t1(json['workDoneToken'])
-        : (json['workDoneToken'] is String
-            ? Either2<num, String>.t2(json['workDoneToken'])
-            : (json['workDoneToken'] == null
-                ? null
+    final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
+    final workDoneToken = json['workDoneToken'] == null
+        ? null
+        : (json['workDoneToken'] is num
+            ? Either2<num, String>.t1(json['workDoneToken'])
+            : (json['workDoneToken'] is String
+                ? Either2<num, String>.t2(json['workDoneToken'])
                 : (throw '''${json['workDoneToken']} was not one of (num, String)''')));
-    final partialResultToken = json['partialResultToken'] is num
-        ? Either2<num, String>.t1(json['partialResultToken'])
-        : (json['partialResultToken'] is String
-            ? Either2<num, String>.t2(json['partialResultToken'])
-            : (json['partialResultToken'] == null
-                ? null
+    final partialResultToken = json['partialResultToken'] == null
+        ? null
+        : (json['partialResultToken'] is num
+            ? Either2<num, String>.t1(json['partialResultToken'])
+            : (json['partialResultToken'] is String
+                ? Either2<num, String>.t2(json['partialResultToken'])
                 : (throw '''${json['partialResultToken']} was not one of (num, String)''')));
     return FoldingRangeParams(
         textDocument: textDocument,
@@ -15620,18 +14966,17 @@
 
   /// An optional token that a server can use to report partial results (e.g.
   /// streaming) to the client.
-  final Either2<num, String> partialResultToken;
+  final Either2<num, String>? partialResultToken;
 
   /// The text document.
   final TextDocumentIdentifier textDocument;
 
   /// An optional token that a server can use to report work done progress.
-  final Either2<num, String> workDoneToken;
+  final Either2<num, String>? workDoneToken;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['textDocument'] = textDocument?.toJson() ??
-        (throw 'textDocument is required but was not set');
+    __result['textDocument'] = textDocument.toJson();
     if (workDoneToken != null) {
       __result['workDoneToken'] = workDoneToken;
     }
@@ -15741,12 +15086,12 @@
 
   /// A document selector to identify the scope of the registration. If set to
   /// null the document selector provided on the client side will be used.
-  final List<DocumentFilter> documentSelector;
+  final List<DocumentFilter>? documentSelector;
 
   /// The id used to register the request. The id can be used to deregister the
   /// request again. See also Registration#id.
-  final String id;
-  final bool workDoneProgress;
+  final String? id;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -15836,18 +15181,11 @@
       LspJsonHandler(FormattingOptions.canParse, FormattingOptions.fromJson);
 
   FormattingOptions(
-      {@required this.tabSize,
-      @required this.insertSpaces,
+      {required this.tabSize,
+      required this.insertSpaces,
       this.trimTrailingWhitespace,
       this.insertFinalNewline,
-      this.trimFinalNewlines}) {
-    if (tabSize == null) {
-      throw 'tabSize is required but was not provided';
-    }
-    if (insertSpaces == null) {
-      throw 'insertSpaces is required but was not provided';
-    }
-  }
+      this.trimFinalNewlines});
   static FormattingOptions fromJson(Map<String, dynamic> json) {
     final tabSize = json['tabSize'];
     final insertSpaces = json['insertSpaces'];
@@ -15864,7 +15202,7 @@
 
   /// Insert a newline character at the end of the file if one does not exist.
   ///  @since 3.15.0
-  final bool insertFinalNewline;
+  final bool? insertFinalNewline;
 
   /// Prefer spaces over tabs.
   final bool insertSpaces;
@@ -15874,18 +15212,16 @@
 
   /// Trim all newlines after the final newline at the end of the file.
   ///  @since 3.15.0
-  final bool trimFinalNewlines;
+  final bool? trimFinalNewlines;
 
   /// Trim trailing whitespace on a line.
   ///  @since 3.15.0
-  final bool trimTrailingWhitespace;
+  final bool? trimTrailingWhitespace;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['tabSize'] =
-        tabSize ?? (throw 'tabSize is required but was not set');
-    __result['insertSpaces'] =
-        insertSpaces ?? (throw 'insertSpaces is required but was not set');
+    __result['tabSize'] = tabSize;
+    __result['insertSpaces'] = insertSpaces;
     if (trimTrailingWhitespace != null) {
       __result['trimTrailingWhitespace'] = trimTrailingWhitespace;
     }
@@ -16003,18 +15339,13 @@
 class Hover implements ToJsonable {
   static const jsonHandler = LspJsonHandler(Hover.canParse, Hover.fromJson);
 
-  Hover({@required this.contents, this.range}) {
-    if (contents == null) {
-      throw 'contents is required but was not provided';
-    }
-  }
+  Hover({required this.contents, this.range});
   static Hover fromJson(Map<String, dynamic> json) {
     final contents = json['contents'] is String
         ? Either2<String, MarkupContent>.t1(json['contents'])
         : (MarkupContent.canParse(json['contents'], nullLspJsonReporter)
-            ? Either2<String, MarkupContent>.t2(json['contents'] != null
-                ? MarkupContent.fromJson(json['contents'])
-                : null)
+            ? Either2<String, MarkupContent>.t2(
+                MarkupContent.fromJson(json['contents']))
             : (throw '''${json['contents']} was not one of (String, MarkupContent)'''));
     final range = json['range'] != null ? Range.fromJson(json['range']) : null;
     return Hover(contents: contents, range: range);
@@ -16025,14 +15356,13 @@
 
   /// An optional range is a range inside a text document that is used to
   /// visualize a hover, e.g. by changing the background color.
-  final Range range;
+  final Range? range;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['contents'] =
-        contents ?? (throw 'contents is required but was not set');
+    __result['contents'] = contents;
     if (range != null) {
-      __result['range'] = range.toJson();
+      __result['range'] = range?.toJson();
     }
     return __result;
   }
@@ -16112,10 +15442,10 @@
   /// Client supports the follow content formats if the content property refers
   /// to a `literal of type MarkupContent`. The order describes the preferred
   /// format of the client.
-  final List<MarkupKind> contentFormat;
+  final List<MarkupKind>? contentFormat;
 
   /// Whether hover supports dynamic registration.
-  final bool dynamicRegistration;
+  final bool? dynamicRegistration;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -16124,7 +15454,7 @@
     }
     if (contentFormat != null) {
       __result['contentFormat'] =
-          contentFormat.map((item) => item.toJson()).toList();
+          contentFormat?.map((item) => item.toJson()).toList();
     }
     return __result;
   }
@@ -16197,7 +15527,7 @@
     return HoverOptions(workDoneProgress: workDoneProgress);
   }
 
-  final bool workDoneProgress;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -16251,28 +15581,16 @@
       LspJsonHandler(HoverParams.canParse, HoverParams.fromJson);
 
   HoverParams(
-      {@required this.textDocument,
-      @required this.position,
-      this.workDoneToken}) {
-    if (textDocument == null) {
-      throw 'textDocument is required but was not provided';
-    }
-    if (position == null) {
-      throw 'position is required but was not provided';
-    }
-  }
+      {required this.textDocument, required this.position, this.workDoneToken});
   static HoverParams fromJson(Map<String, dynamic> json) {
-    final textDocument = json['textDocument'] != null
-        ? TextDocumentIdentifier.fromJson(json['textDocument'])
-        : null;
-    final position =
-        json['position'] != null ? Position.fromJson(json['position']) : null;
-    final workDoneToken = json['workDoneToken'] is num
-        ? Either2<num, String>.t1(json['workDoneToken'])
-        : (json['workDoneToken'] is String
-            ? Either2<num, String>.t2(json['workDoneToken'])
-            : (json['workDoneToken'] == null
-                ? null
+    final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
+    final position = Position.fromJson(json['position']);
+    final workDoneToken = json['workDoneToken'] == null
+        ? null
+        : (json['workDoneToken'] is num
+            ? Either2<num, String>.t1(json['workDoneToken'])
+            : (json['workDoneToken'] is String
+                ? Either2<num, String>.t2(json['workDoneToken'])
                 : (throw '''${json['workDoneToken']} was not one of (num, String)''')));
     return HoverParams(
         textDocument: textDocument,
@@ -16287,14 +15605,12 @@
   final TextDocumentIdentifier textDocument;
 
   /// An optional token that a server can use to report work done progress.
-  final Either2<num, String> workDoneToken;
+  final Either2<num, String>? workDoneToken;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['textDocument'] = textDocument?.toJson() ??
-        (throw 'textDocument is required but was not set');
-    __result['position'] =
-        position?.toJson() ?? (throw 'position is required but was not set');
+    __result['textDocument'] = textDocument.toJson();
+    __result['position'] = position.toJson();
     if (workDoneToken != null) {
       __result['workDoneToken'] = workDoneToken;
     }
@@ -16397,8 +15713,8 @@
 
   /// A document selector to identify the scope of the registration. If set to
   /// null the document selector provided on the client side will be used.
-  final List<DocumentFilter> documentSelector;
-  final bool workDoneProgress;
+  final List<DocumentFilter>? documentSelector;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -16485,11 +15801,11 @@
   /// Whether implementation supports dynamic registration. If this is set to
   /// `true` the client supports the new `ImplementationRegistrationOptions`
   /// return value for the corresponding server capability as well.
-  final bool dynamicRegistration;
+  final bool? dynamicRegistration;
 
   /// The client supports additional metadata in the form of definition links.
   ///  @since 3.14.0
-  final bool linkSupport;
+  final bool? linkSupport;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -16566,7 +15882,7 @@
     return ImplementationOptions(workDoneProgress: workDoneProgress);
   }
 
-  final bool workDoneProgress;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -16625,36 +15941,26 @@
       ImplementationParams.canParse, ImplementationParams.fromJson);
 
   ImplementationParams(
-      {@required this.textDocument,
-      @required this.position,
+      {required this.textDocument,
+      required this.position,
       this.workDoneToken,
-      this.partialResultToken}) {
-    if (textDocument == null) {
-      throw 'textDocument is required but was not provided';
-    }
-    if (position == null) {
-      throw 'position is required but was not provided';
-    }
-  }
+      this.partialResultToken});
   static ImplementationParams fromJson(Map<String, dynamic> json) {
-    final textDocument = json['textDocument'] != null
-        ? TextDocumentIdentifier.fromJson(json['textDocument'])
-        : null;
-    final position =
-        json['position'] != null ? Position.fromJson(json['position']) : null;
-    final workDoneToken = json['workDoneToken'] is num
-        ? Either2<num, String>.t1(json['workDoneToken'])
-        : (json['workDoneToken'] is String
-            ? Either2<num, String>.t2(json['workDoneToken'])
-            : (json['workDoneToken'] == null
-                ? null
+    final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
+    final position = Position.fromJson(json['position']);
+    final workDoneToken = json['workDoneToken'] == null
+        ? null
+        : (json['workDoneToken'] is num
+            ? Either2<num, String>.t1(json['workDoneToken'])
+            : (json['workDoneToken'] is String
+                ? Either2<num, String>.t2(json['workDoneToken'])
                 : (throw '''${json['workDoneToken']} was not one of (num, String)''')));
-    final partialResultToken = json['partialResultToken'] is num
-        ? Either2<num, String>.t1(json['partialResultToken'])
-        : (json['partialResultToken'] is String
-            ? Either2<num, String>.t2(json['partialResultToken'])
-            : (json['partialResultToken'] == null
-                ? null
+    final partialResultToken = json['partialResultToken'] == null
+        ? null
+        : (json['partialResultToken'] is num
+            ? Either2<num, String>.t1(json['partialResultToken'])
+            : (json['partialResultToken'] is String
+                ? Either2<num, String>.t2(json['partialResultToken'])
                 : (throw '''${json['partialResultToken']} was not one of (num, String)''')));
     return ImplementationParams(
         textDocument: textDocument,
@@ -16665,7 +15971,7 @@
 
   /// An optional token that a server can use to report partial results (e.g.
   /// streaming) to the client.
-  final Either2<num, String> partialResultToken;
+  final Either2<num, String>? partialResultToken;
 
   /// The position inside the text document.
   final Position position;
@@ -16674,14 +15980,12 @@
   final TextDocumentIdentifier textDocument;
 
   /// An optional token that a server can use to report work done progress.
-  final Either2<num, String> workDoneToken;
+  final Either2<num, String>? workDoneToken;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['textDocument'] = textDocument?.toJson() ??
-        (throw 'textDocument is required but was not set');
-    __result['position'] =
-        position?.toJson() ?? (throw 'position is required but was not set');
+    __result['textDocument'] = textDocument.toJson();
+    __result['position'] = position.toJson();
     if (workDoneToken != null) {
       __result['workDoneToken'] = workDoneToken;
     }
@@ -16810,12 +16114,12 @@
 
   /// A document selector to identify the scope of the registration. If set to
   /// null the document selector provided on the client side will be used.
-  final List<DocumentFilter> documentSelector;
+  final List<DocumentFilter>? documentSelector;
 
   /// The id used to register the request. The id can be used to deregister the
   /// request again. See also Registration#id.
-  final String id;
-  final bool workDoneProgress;
+  final String? id;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -16910,14 +16214,10 @@
       this.rootPath,
       this.rootUri,
       this.initializationOptions,
-      @required this.capabilities,
+      required this.capabilities,
       this.trace,
       this.workspaceFolders,
-      this.workDoneToken}) {
-    if (capabilities == null) {
-      throw 'capabilities is required but was not provided';
-    }
-  }
+      this.workDoneToken});
   static InitializeParams fromJson(Map<String, dynamic> json) {
     final processId = json['processId'];
     final clientInfo = json['clientInfo'] != null
@@ -16927,9 +16227,7 @@
     final rootPath = json['rootPath'];
     final rootUri = json['rootUri'];
     final initializationOptions = json['initializationOptions'];
-    final capabilities = json['capabilities'] != null
-        ? ClientCapabilities.fromJson(json['capabilities'])
-        : null;
+    final capabilities = ClientCapabilities.fromJson(json['capabilities']);
     final trace = const {null, 'off', 'message', 'verbose'}
             .contains(json['trace'])
         ? json['trace']
@@ -16938,12 +16236,12 @@
         ?.map((item) => item != null ? WorkspaceFolder.fromJson(item) : null)
         ?.cast<WorkspaceFolder>()
         ?.toList();
-    final workDoneToken = json['workDoneToken'] is num
-        ? Either2<num, String>.t1(json['workDoneToken'])
-        : (json['workDoneToken'] is String
-            ? Either2<num, String>.t2(json['workDoneToken'])
-            : (json['workDoneToken'] == null
-                ? null
+    final workDoneToken = json['workDoneToken'] == null
+        ? null
+        : (json['workDoneToken'] is num
+            ? Either2<num, String>.t1(json['workDoneToken'])
+            : (json['workDoneToken'] is String
+                ? Either2<num, String>.t2(json['workDoneToken'])
                 : (throw '''${json['workDoneToken']} was not one of (num, String)''')));
     return InitializeParams(
         processId: processId,
@@ -16963,7 +16261,7 @@
 
   /// Information about the client
   ///  @since 3.15.0
-  final InitializeParamsClientInfo clientInfo;
+  final InitializeParamsClientInfo? clientInfo;
 
   /// User provided initialization options.
   final dynamic initializationOptions;
@@ -16974,41 +16272,41 @@
   /// Uses IETF language tags as the value's syntax (See
   /// https://en.wikipedia.org/wiki/IETF_language_tag)
   ///  @since 3.16.0
-  final String locale;
+  final String? locale;
 
   /// The process Id of the parent process that started the server. Is null if
   /// the process has not been started by another process. If the parent process
   /// is not alive then the server should exit (see exit notification) its
   /// process.
-  final num processId;
+  final num? processId;
 
   /// The rootPath of the workspace. Is null if no folder is open.
   ///  @deprecated in favour of `rootUri`.
-  final String rootPath;
+  final String? rootPath;
 
   /// The rootUri of the workspace. Is null if no folder is open. If both
   /// `rootPath` and `rootUri` are set `rootUri` wins.
   ///  @deprecated in favour of `workspaceFolders`
-  final String rootUri;
+  final String? rootUri;
 
   /// The initial trace setting. If omitted trace is disabled ('off').
-  final String trace;
+  final String? trace;
 
   /// An optional token that a server can use to report work done progress.
-  final Either2<num, String> workDoneToken;
+  final Either2<num, String>? workDoneToken;
 
   /// The workspace folders configured in the client when the server starts.
   /// This property is only available if the client supports workspace folders.
   /// It can be `null` if the client supports workspace folders but none are
   /// configured.
   ///  @since 3.6.0
-  final List<WorkspaceFolder> workspaceFolders;
+  final List<WorkspaceFolder>? workspaceFolders;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
     __result['processId'] = processId;
     if (clientInfo != null) {
-      __result['clientInfo'] = clientInfo.toJson();
+      __result['clientInfo'] = clientInfo?.toJson();
     }
     if (locale != null) {
       __result['locale'] = locale;
@@ -17020,14 +16318,13 @@
     if (initializationOptions != null) {
       __result['initializationOptions'] = initializationOptions;
     }
-    __result['capabilities'] = capabilities?.toJson() ??
-        (throw 'capabilities is required but was not set');
+    __result['capabilities'] = capabilities.toJson();
     if (trace != null) {
       __result['trace'] = trace;
     }
     if (workspaceFolders != null) {
       __result['workspaceFolders'] =
-          workspaceFolders.map((item) => item.toJson()).toList();
+          workspaceFolders?.map((item) => item.toJson()).toList();
     }
     if (workDoneToken != null) {
       __result['workDoneToken'] = workDoneToken;
@@ -17092,15 +16389,6 @@
       } finally {
         reporter.pop();
       }
-      reporter.push('initializationOptions');
-      try {
-        if (obj['initializationOptions'] != null && !(true)) {
-          reporter.reportError('must be of type dynamic');
-          return false;
-        }
-      } finally {
-        reporter.pop();
-      }
       reporter.push('capabilities');
       try {
         if (!obj.containsKey('capabilities')) {
@@ -17203,11 +16491,7 @@
   static const jsonHandler = LspJsonHandler(
       InitializeParamsClientInfo.canParse, InitializeParamsClientInfo.fromJson);
 
-  InitializeParamsClientInfo({@required this.name, this.version}) {
-    if (name == null) {
-      throw 'name is required but was not provided';
-    }
-  }
+  InitializeParamsClientInfo({required this.name, this.version});
   static InitializeParamsClientInfo fromJson(Map<String, dynamic> json) {
     final name = json['name'];
     final version = json['version'];
@@ -17218,11 +16502,11 @@
   final String name;
 
   /// The client's version as defined by the client.
-  final String version;
+  final String? version;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['name'] = name ?? (throw 'name is required but was not set');
+    __result['name'] = name;
     if (version != null) {
       __result['version'] = version;
     }
@@ -17289,15 +16573,9 @@
   static const jsonHandler =
       LspJsonHandler(InitializeResult.canParse, InitializeResult.fromJson);
 
-  InitializeResult({@required this.capabilities, this.serverInfo}) {
-    if (capabilities == null) {
-      throw 'capabilities is required but was not provided';
-    }
-  }
+  InitializeResult({required this.capabilities, this.serverInfo});
   static InitializeResult fromJson(Map<String, dynamic> json) {
-    final capabilities = json['capabilities'] != null
-        ? ServerCapabilities.fromJson(json['capabilities'])
-        : null;
+    final capabilities = ServerCapabilities.fromJson(json['capabilities']);
     final serverInfo = json['serverInfo'] != null
         ? InitializeResultServerInfo.fromJson(json['serverInfo'])
         : null;
@@ -17309,14 +16587,13 @@
 
   /// Information about the server.
   ///  @since 3.15.0
-  final InitializeResultServerInfo serverInfo;
+  final InitializeResultServerInfo? serverInfo;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['capabilities'] = capabilities?.toJson() ??
-        (throw 'capabilities is required but was not set');
+    __result['capabilities'] = capabilities.toJson();
     if (serverInfo != null) {
-      __result['serverInfo'] = serverInfo.toJson();
+      __result['serverInfo'] = serverInfo?.toJson();
     }
     return __result;
   }
@@ -17384,11 +16661,7 @@
   static const jsonHandler = LspJsonHandler(
       InitializeResultServerInfo.canParse, InitializeResultServerInfo.fromJson);
 
-  InitializeResultServerInfo({@required this.name, this.version}) {
-    if (name == null) {
-      throw 'name is required but was not provided';
-    }
-  }
+  InitializeResultServerInfo({required this.name, this.version});
   static InitializeResultServerInfo fromJson(Map<String, dynamic> json) {
     final name = json['name'];
     final version = json['version'];
@@ -17399,11 +16672,11 @@
   final String name;
 
   /// The server's version as defined by the server.
-  final String version;
+  final String? version;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['name'] = name ?? (throw 'name is required but was not set');
+    __result['name'] = name;
     if (version != null) {
       __result['version'] = version;
     }
@@ -17513,23 +16786,11 @@
       LspJsonHandler(InsertReplaceEdit.canParse, InsertReplaceEdit.fromJson);
 
   InsertReplaceEdit(
-      {@required this.newText, @required this.insert, @required this.replace}) {
-    if (newText == null) {
-      throw 'newText is required but was not provided';
-    }
-    if (insert == null) {
-      throw 'insert is required but was not provided';
-    }
-    if (replace == null) {
-      throw 'replace is required but was not provided';
-    }
-  }
+      {required this.newText, required this.insert, required this.replace});
   static InsertReplaceEdit fromJson(Map<String, dynamic> json) {
     final newText = json['newText'];
-    final insert =
-        json['insert'] != null ? Range.fromJson(json['insert']) : null;
-    final replace =
-        json['replace'] != null ? Range.fromJson(json['replace']) : null;
+    final insert = Range.fromJson(json['insert']);
+    final replace = Range.fromJson(json['replace']);
     return InsertReplaceEdit(
         newText: newText, insert: insert, replace: replace);
   }
@@ -17545,12 +16806,9 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['newText'] =
-        newText ?? (throw 'newText is required but was not set');
-    __result['insert'] =
-        insert?.toJson() ?? (throw 'insert is required but was not set');
-    __result['replace'] =
-        replace?.toJson() ?? (throw 'replace is required but was not set');
+    __result['newText'] = newText;
+    __result['insert'] = insert.toJson();
+    __result['replace'] = replace.toJson();
     return __result;
   }
 
@@ -17731,7 +16989,7 @@
   /// `true` the client supports the new `(TextDocumentRegistrationOptions &
   /// StaticRegistrationOptions)` return value for the corresponding server
   /// capability as well.
-  final bool dynamicRegistration;
+  final bool? dynamicRegistration;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -17795,7 +17053,7 @@
     return LinkedEditingRangeOptions(workDoneProgress: workDoneProgress);
   }
 
-  final bool workDoneProgress;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -17850,28 +17108,16 @@
       LinkedEditingRangeParams.canParse, LinkedEditingRangeParams.fromJson);
 
   LinkedEditingRangeParams(
-      {@required this.textDocument,
-      @required this.position,
-      this.workDoneToken}) {
-    if (textDocument == null) {
-      throw 'textDocument is required but was not provided';
-    }
-    if (position == null) {
-      throw 'position is required but was not provided';
-    }
-  }
+      {required this.textDocument, required this.position, this.workDoneToken});
   static LinkedEditingRangeParams fromJson(Map<String, dynamic> json) {
-    final textDocument = json['textDocument'] != null
-        ? TextDocumentIdentifier.fromJson(json['textDocument'])
-        : null;
-    final position =
-        json['position'] != null ? Position.fromJson(json['position']) : null;
-    final workDoneToken = json['workDoneToken'] is num
-        ? Either2<num, String>.t1(json['workDoneToken'])
-        : (json['workDoneToken'] is String
-            ? Either2<num, String>.t2(json['workDoneToken'])
-            : (json['workDoneToken'] == null
-                ? null
+    final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
+    final position = Position.fromJson(json['position']);
+    final workDoneToken = json['workDoneToken'] == null
+        ? null
+        : (json['workDoneToken'] is num
+            ? Either2<num, String>.t1(json['workDoneToken'])
+            : (json['workDoneToken'] is String
+                ? Either2<num, String>.t2(json['workDoneToken'])
                 : (throw '''${json['workDoneToken']} was not one of (num, String)''')));
     return LinkedEditingRangeParams(
         textDocument: textDocument,
@@ -17886,14 +17132,12 @@
   final TextDocumentIdentifier textDocument;
 
   /// An optional token that a server can use to report work done progress.
-  final Either2<num, String> workDoneToken;
+  final Either2<num, String>? workDoneToken;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['textDocument'] = textDocument?.toJson() ??
-        (throw 'textDocument is required but was not set');
-    __result['position'] =
-        position?.toJson() ?? (throw 'position is required but was not set');
+    __result['textDocument'] = textDocument.toJson();
+    __result['position'] = position.toJson();
     if (workDoneToken != null) {
       __result['workDoneToken'] = workDoneToken;
     }
@@ -18007,12 +17251,12 @@
 
   /// A document selector to identify the scope of the registration. If set to
   /// null the document selector provided on the client side will be used.
-  final List<DocumentFilter> documentSelector;
+  final List<DocumentFilter>? documentSelector;
 
   /// The id used to register the request. The id can be used to deregister the
   /// request again. See also Registration#id.
-  final String id;
-  final bool workDoneProgress;
+  final String? id;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -18101,14 +17345,10 @@
   static const jsonHandler = LspJsonHandler(
       LinkedEditingRanges.canParse, LinkedEditingRanges.fromJson);
 
-  LinkedEditingRanges({@required this.ranges, this.wordPattern}) {
-    if (ranges == null) {
-      throw 'ranges is required but was not provided';
-    }
-  }
+  LinkedEditingRanges({required this.ranges, this.wordPattern});
   static LinkedEditingRanges fromJson(Map<String, dynamic> json) {
     final ranges = json['ranges']
-        ?.map((item) => item != null ? Range.fromJson(item) : null)
+        ?.map((item) => Range.fromJson(item))
         ?.cast<Range>()
         ?.toList();
     final wordPattern = json['wordPattern'];
@@ -18123,12 +17363,11 @@
   /// An optional word pattern (regular expression) that describes valid
   /// contents for the given ranges. If no pattern is provided, the client
   /// configuration's word pattern will be used.
-  final String wordPattern;
+  final String? wordPattern;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['ranges'] = ranges?.map((item) => item.toJson())?.toList() ??
-        (throw 'ranges is required but was not set');
+    __result['ranges'] = ranges.map((item) => item.toJson()).toList();
     if (wordPattern != null) {
       __result['wordPattern'] = wordPattern;
     }
@@ -18198,17 +17437,10 @@
   static const jsonHandler =
       LspJsonHandler(Location.canParse, Location.fromJson);
 
-  Location({@required this.uri, @required this.range}) {
-    if (uri == null) {
-      throw 'uri is required but was not provided';
-    }
-    if (range == null) {
-      throw 'range is required but was not provided';
-    }
-  }
+  Location({required this.uri, required this.range});
   static Location fromJson(Map<String, dynamic> json) {
     final uri = json['uri'];
-    final range = json['range'] != null ? Range.fromJson(json['range']) : null;
+    final range = Range.fromJson(json['range']);
     return Location(uri: uri, range: range);
   }
 
@@ -18217,9 +17449,8 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['uri'] = uri ?? (throw 'uri is required but was not set');
-    __result['range'] =
-        range?.toJson() ?? (throw 'range is required but was not set');
+    __result['uri'] = uri;
+    __result['range'] = range.toJson();
     return __result;
   }
 
@@ -18292,30 +17523,16 @@
 
   LocationLink(
       {this.originSelectionRange,
-      @required this.targetUri,
-      @required this.targetRange,
-      @required this.targetSelectionRange}) {
-    if (targetUri == null) {
-      throw 'targetUri is required but was not provided';
-    }
-    if (targetRange == null) {
-      throw 'targetRange is required but was not provided';
-    }
-    if (targetSelectionRange == null) {
-      throw 'targetSelectionRange is required but was not provided';
-    }
-  }
+      required this.targetUri,
+      required this.targetRange,
+      required this.targetSelectionRange});
   static LocationLink fromJson(Map<String, dynamic> json) {
     final originSelectionRange = json['originSelectionRange'] != null
         ? Range.fromJson(json['originSelectionRange'])
         : null;
     final targetUri = json['targetUri'];
-    final targetRange = json['targetRange'] != null
-        ? Range.fromJson(json['targetRange'])
-        : null;
-    final targetSelectionRange = json['targetSelectionRange'] != null
-        ? Range.fromJson(json['targetSelectionRange'])
-        : null;
+    final targetRange = Range.fromJson(json['targetRange']);
+    final targetSelectionRange = Range.fromJson(json['targetSelectionRange']);
     return LocationLink(
         originSelectionRange: originSelectionRange,
         targetUri: targetUri,
@@ -18327,7 +17544,7 @@
   ///
   /// Used as the underlined span for mouse interaction. Defaults to the word
   /// range at the mouse position.
-  final Range originSelectionRange;
+  final Range? originSelectionRange;
 
   /// The full target range of this link. If the target for example is a symbol
   /// then target range is the range enclosing this symbol not including
@@ -18346,14 +17563,11 @@
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
     if (originSelectionRange != null) {
-      __result['originSelectionRange'] = originSelectionRange.toJson();
+      __result['originSelectionRange'] = originSelectionRange?.toJson();
     }
-    __result['targetUri'] =
-        targetUri ?? (throw 'targetUri is required but was not set');
-    __result['targetRange'] = targetRange?.toJson() ??
-        (throw 'targetRange is required but was not set');
-    __result['targetSelectionRange'] = targetSelectionRange?.toJson() ??
-        (throw 'targetSelectionRange is required but was not set');
+    __result['targetUri'] = targetUri;
+    __result['targetRange'] = targetRange.toJson();
+    __result['targetSelectionRange'] = targetSelectionRange.toJson();
     return __result;
   }
 
@@ -18457,17 +17671,9 @@
   static const jsonHandler =
       LspJsonHandler(LogMessageParams.canParse, LogMessageParams.fromJson);
 
-  LogMessageParams({@required this.type, @required this.message}) {
-    if (type == null) {
-      throw 'type is required but was not provided';
-    }
-    if (message == null) {
-      throw 'message is required but was not provided';
-    }
-  }
+  LogMessageParams({required this.type, required this.message});
   static LogMessageParams fromJson(Map<String, dynamic> json) {
-    final type =
-        json['type'] != null ? MessageType.fromJson(json['type']) : null;
+    final type = MessageType.fromJson(json['type']);
     final message = json['message'];
     return LogMessageParams(type: type, message: message);
   }
@@ -18480,10 +17686,8 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['type'] =
-        type?.toJson() ?? (throw 'type is required but was not set');
-    __result['message'] =
-        message ?? (throw 'message is required but was not set');
+    __result['type'] = type.toJson();
+    __result['message'] = message;
     return __result;
   }
 
@@ -18554,11 +17758,7 @@
   static const jsonHandler =
       LspJsonHandler(LogTraceParams.canParse, LogTraceParams.fromJson);
 
-  LogTraceParams({@required this.message, this.verbose}) {
-    if (message == null) {
-      throw 'message is required but was not provided';
-    }
-  }
+  LogTraceParams({required this.message, this.verbose});
   static LogTraceParams fromJson(Map<String, dynamic> json) {
     final message = json['message'];
     final verbose = json['verbose'];
@@ -18570,12 +17770,11 @@
 
   /// Additional information that can be computed if the `trace` configuration
   /// is set to `'verbose'`
-  final String verbose;
+  final String? verbose;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['message'] =
-        message ?? (throw 'message is required but was not set');
+    __result['message'] = message;
     if (verbose != null) {
       __result['verbose'] = verbose;
     }
@@ -18643,11 +17842,7 @@
   static const jsonHandler = LspJsonHandler(
       MarkdownClientCapabilities.canParse, MarkdownClientCapabilities.fromJson);
 
-  MarkdownClientCapabilities({@required this.parser, this.version}) {
-    if (parser == null) {
-      throw 'parser is required but was not provided';
-    }
-  }
+  MarkdownClientCapabilities({required this.parser, this.version});
   static MarkdownClientCapabilities fromJson(Map<String, dynamic> json) {
     final parser = json['parser'];
     final version = json['version'];
@@ -18658,11 +17853,11 @@
   final String parser;
 
   /// The version of the parser.
-  final String version;
+  final String? version;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['parser'] = parser ?? (throw 'parser is required but was not set');
+    __result['parser'] = parser;
     if (version != null) {
       __result['version'] = version;
     }
@@ -18750,17 +17945,9 @@
   static const jsonHandler =
       LspJsonHandler(MarkupContent.canParse, MarkupContent.fromJson);
 
-  MarkupContent({@required this.kind, @required this.value}) {
-    if (kind == null) {
-      throw 'kind is required but was not provided';
-    }
-    if (value == null) {
-      throw 'value is required but was not provided';
-    }
-  }
+  MarkupContent({required this.kind, required this.value});
   static MarkupContent fromJson(Map<String, dynamic> json) {
-    final kind =
-        json['kind'] != null ? MarkupKind.fromJson(json['kind']) : null;
+    final kind = MarkupKind.fromJson(json['kind']);
     final value = json['value'];
     return MarkupContent(kind: kind, value: value);
   }
@@ -18773,9 +17960,8 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['kind'] =
-        kind?.toJson() ?? (throw 'kind is required but was not set');
-    __result['value'] = value ?? (throw 'value is required but was not set');
+    __result['kind'] = kind.toJson();
+    __result['value'] = value;
     return __result;
   }
 
@@ -18882,11 +18068,7 @@
 class Message implements ToJsonable {
   static const jsonHandler = LspJsonHandler(Message.canParse, Message.fromJson);
 
-  Message({@required this.jsonrpc}) {
-    if (jsonrpc == null) {
-      throw 'jsonrpc is required but was not provided';
-    }
-  }
+  Message({required this.jsonrpc});
   static Message fromJson(Map<String, dynamic> json) {
     if (RequestMessage.canParse(json, nullLspJsonReporter)) {
       return RequestMessage.fromJson(json);
@@ -18905,8 +18087,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['jsonrpc'] =
-        jsonrpc ?? (throw 'jsonrpc is required but was not set');
+    __result['jsonrpc'] = jsonrpc;
     return __result;
   }
 
@@ -18959,11 +18140,7 @@
   static const jsonHandler =
       LspJsonHandler(MessageActionItem.canParse, MessageActionItem.fromJson);
 
-  MessageActionItem({@required this.title}) {
-    if (title == null) {
-      throw 'title is required but was not provided';
-    }
-  }
+  MessageActionItem({required this.title});
   static MessageActionItem fromJson(Map<String, dynamic> json) {
     final title = json['title'];
     return MessageActionItem(title: title);
@@ -18974,7 +18151,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['title'] = title ?? (throw 'title is required but was not set');
+    __result['title'] = title;
     return __result;
   }
 
@@ -19334,26 +18511,14 @@
   static const jsonHandler = LspJsonHandler(Moniker.canParse, Moniker.fromJson);
 
   Moniker(
-      {@required this.scheme,
-      @required this.identifier,
-      @required this.unique,
-      this.kind}) {
-    if (scheme == null) {
-      throw 'scheme is required but was not provided';
-    }
-    if (identifier == null) {
-      throw 'identifier is required but was not provided';
-    }
-    if (unique == null) {
-      throw 'unique is required but was not provided';
-    }
-  }
+      {required this.scheme,
+      required this.identifier,
+      required this.unique,
+      this.kind});
   static Moniker fromJson(Map<String, dynamic> json) {
     final scheme = json['scheme'];
     final identifier = json['identifier'];
-    final unique = json['unique'] != null
-        ? UniquenessLevel.fromJson(json['unique'])
-        : null;
+    final unique = UniquenessLevel.fromJson(json['unique']);
     final kind =
         json['kind'] != null ? MonikerKind.fromJson(json['kind']) : null;
     return Moniker(
@@ -19365,7 +18530,7 @@
   final String identifier;
 
   /// The moniker kind if known.
-  final MonikerKind kind;
+  final MonikerKind? kind;
 
   /// The scheme of the moniker. For example tsc or .Net
   final String scheme;
@@ -19375,13 +18540,11 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['scheme'] = scheme ?? (throw 'scheme is required but was not set');
-    __result['identifier'] =
-        identifier ?? (throw 'identifier is required but was not set');
-    __result['unique'] =
-        unique?.toJson() ?? (throw 'unique is required but was not set');
+    __result['scheme'] = scheme;
+    __result['identifier'] = identifier;
+    __result['unique'] = unique.toJson();
     if (kind != null) {
-      __result['kind'] = kind.toJson();
+      __result['kind'] = kind?.toJson();
     }
     return __result;
   }
@@ -19496,7 +18659,7 @@
   /// `true` the client supports the new `(TextDocumentRegistrationOptions &
   /// StaticRegistrationOptions)` return value for the corresponding server
   /// capability as well.
-  final bool dynamicRegistration;
+  final bool? dynamicRegistration;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -19590,7 +18753,7 @@
     return MonikerOptions(workDoneProgress: workDoneProgress);
   }
 
-  final bool workDoneProgress;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -19648,36 +18811,26 @@
       LspJsonHandler(MonikerParams.canParse, MonikerParams.fromJson);
 
   MonikerParams(
-      {@required this.textDocument,
-      @required this.position,
+      {required this.textDocument,
+      required this.position,
       this.workDoneToken,
-      this.partialResultToken}) {
-    if (textDocument == null) {
-      throw 'textDocument is required but was not provided';
-    }
-    if (position == null) {
-      throw 'position is required but was not provided';
-    }
-  }
+      this.partialResultToken});
   static MonikerParams fromJson(Map<String, dynamic> json) {
-    final textDocument = json['textDocument'] != null
-        ? TextDocumentIdentifier.fromJson(json['textDocument'])
-        : null;
-    final position =
-        json['position'] != null ? Position.fromJson(json['position']) : null;
-    final workDoneToken = json['workDoneToken'] is num
-        ? Either2<num, String>.t1(json['workDoneToken'])
-        : (json['workDoneToken'] is String
-            ? Either2<num, String>.t2(json['workDoneToken'])
-            : (json['workDoneToken'] == null
-                ? null
+    final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
+    final position = Position.fromJson(json['position']);
+    final workDoneToken = json['workDoneToken'] == null
+        ? null
+        : (json['workDoneToken'] is num
+            ? Either2<num, String>.t1(json['workDoneToken'])
+            : (json['workDoneToken'] is String
+                ? Either2<num, String>.t2(json['workDoneToken'])
                 : (throw '''${json['workDoneToken']} was not one of (num, String)''')));
-    final partialResultToken = json['partialResultToken'] is num
-        ? Either2<num, String>.t1(json['partialResultToken'])
-        : (json['partialResultToken'] is String
-            ? Either2<num, String>.t2(json['partialResultToken'])
-            : (json['partialResultToken'] == null
-                ? null
+    final partialResultToken = json['partialResultToken'] == null
+        ? null
+        : (json['partialResultToken'] is num
+            ? Either2<num, String>.t1(json['partialResultToken'])
+            : (json['partialResultToken'] is String
+                ? Either2<num, String>.t2(json['partialResultToken'])
                 : (throw '''${json['partialResultToken']} was not one of (num, String)''')));
     return MonikerParams(
         textDocument: textDocument,
@@ -19688,7 +18841,7 @@
 
   /// An optional token that a server can use to report partial results (e.g.
   /// streaming) to the client.
-  final Either2<num, String> partialResultToken;
+  final Either2<num, String>? partialResultToken;
 
   /// The position inside the text document.
   final Position position;
@@ -19697,14 +18850,12 @@
   final TextDocumentIdentifier textDocument;
 
   /// An optional token that a server can use to report work done progress.
-  final Either2<num, String> workDoneToken;
+  final Either2<num, String>? workDoneToken;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['textDocument'] = textDocument?.toJson() ??
-        (throw 'textDocument is required but was not set');
-    __result['position'] =
-        position?.toJson() ?? (throw 'position is required but was not set');
+    __result['textDocument'] = textDocument.toJson();
+    __result['position'] = position.toJson();
     if (workDoneToken != null) {
       __result['workDoneToken'] = workDoneToken;
     }
@@ -19823,8 +18974,8 @@
 
   /// A document selector to identify the scope of the registration. If set to
   /// null the document selector provided on the client side will be used.
-  final List<DocumentFilter> documentSelector;
-  final bool workDoneProgress;
+  final List<DocumentFilter>? documentSelector;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -19899,17 +19050,9 @@
       NotificationMessage.canParse, NotificationMessage.fromJson);
 
   NotificationMessage(
-      {@required this.method, this.params, @required this.jsonrpc}) {
-    if (method == null) {
-      throw 'method is required but was not provided';
-    }
-    if (jsonrpc == null) {
-      throw 'jsonrpc is required but was not provided';
-    }
-  }
+      {required this.method, this.params, required this.jsonrpc});
   static NotificationMessage fromJson(Map<String, dynamic> json) {
-    final method =
-        json['method'] != null ? Method.fromJson(json['method']) : null;
+    final method = Method.fromJson(json['method']);
     final params = json['params'];
     final jsonrpc = json['jsonrpc'];
     return NotificationMessage(
@@ -19926,13 +19069,11 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['method'] =
-        method?.toJson() ?? (throw 'method is required but was not set');
+    __result['method'] = method.toJson();
     if (params != null) {
       __result['params'] = params;
     }
-    __result['jsonrpc'] =
-        jsonrpc ?? (throw 'jsonrpc is required but was not set');
+    __result['jsonrpc'] = jsonrpc;
     return __result;
   }
 
@@ -19955,15 +19096,6 @@
       } finally {
         reporter.pop();
       }
-      reporter.push('params');
-      try {
-        if (obj['params'] != null && !(true)) {
-          reporter.reportError('must be of type dynamic');
-          return false;
-        }
-      } finally {
-        reporter.pop();
-      }
       reporter.push('jsonrpc');
       try {
         if (!obj.containsKey('jsonrpc')) {
@@ -20019,11 +19151,7 @@
       OptionalVersionedTextDocumentIdentifier.canParse,
       OptionalVersionedTextDocumentIdentifier.fromJson);
 
-  OptionalVersionedTextDocumentIdentifier({this.version, @required this.uri}) {
-    if (uri == null) {
-      throw 'uri is required but was not provided';
-    }
-  }
+  OptionalVersionedTextDocumentIdentifier({this.version, required this.uri});
   static OptionalVersionedTextDocumentIdentifier fromJson(
       Map<String, dynamic> json) {
     final version = json['version'];
@@ -20043,12 +19171,12 @@
   ///
   /// The version number of a document will increase after each change,
   /// including undo/redo. The number doesn't need to be consecutive.
-  final num version;
+  final num? version;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
     __result['version'] = version;
-    __result['uri'] = uri ?? (throw 'uri is required but was not set');
+    __result['uri'] = uri;
     return __result;
   }
 
@@ -20119,28 +19247,24 @@
   static const jsonHandler = LspJsonHandler(
       ParameterInformation.canParse, ParameterInformation.fromJson);
 
-  ParameterInformation({@required this.label, this.documentation}) {
-    if (label == null) {
-      throw 'label is required but was not provided';
-    }
-  }
+  ParameterInformation({required this.label, this.documentation});
   static ParameterInformation fromJson(Map<String, dynamic> json) {
     final label = json['label'];
-    final documentation = json['documentation'] is String
-        ? Either2<String, MarkupContent>.t1(json['documentation'])
-        : (MarkupContent.canParse(json['documentation'], nullLspJsonReporter)
-            ? Either2<String, MarkupContent>.t2(json['documentation'] != null
-                ? MarkupContent.fromJson(json['documentation'])
-                : null)
-            : (json['documentation'] == null
-                ? null
+    final documentation = json['documentation'] == null
+        ? null
+        : (json['documentation'] is String
+            ? Either2<String, MarkupContent>.t1(json['documentation'])
+            : (MarkupContent.canParse(
+                    json['documentation'], nullLspJsonReporter)
+                ? Either2<String, MarkupContent>.t2(
+                    MarkupContent.fromJson(json['documentation']))
                 : (throw '''${json['documentation']} was not one of (String, MarkupContent)''')));
     return ParameterInformation(label: label, documentation: documentation);
   }
 
   /// The human-readable doc-comment of this parameter. Will be shown in the UI
   /// but can be omitted.
-  final Either2<String, MarkupContent> documentation;
+  final Either2<String, MarkupContent>? documentation;
 
   /// The label of this parameter information.
   ///
@@ -20156,7 +19280,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['label'] = label ?? (throw 'label is required but was not set');
+    __result['label'] = label;
     if (documentation != null) {
       __result['documentation'] = documentation;
     }
@@ -20296,19 +19420,19 @@
     if (MonikerParams.canParse(json, nullLspJsonReporter)) {
       return MonikerParams.fromJson(json);
     }
-    final partialResultToken = json['partialResultToken'] is num
-        ? Either2<num, String>.t1(json['partialResultToken'])
-        : (json['partialResultToken'] is String
-            ? Either2<num, String>.t2(json['partialResultToken'])
-            : (json['partialResultToken'] == null
-                ? null
+    final partialResultToken = json['partialResultToken'] == null
+        ? null
+        : (json['partialResultToken'] is num
+            ? Either2<num, String>.t1(json['partialResultToken'])
+            : (json['partialResultToken'] is String
+                ? Either2<num, String>.t2(json['partialResultToken'])
                 : (throw '''${json['partialResultToken']} was not one of (num, String)''')));
     return PartialResultParams(partialResultToken: partialResultToken);
   }
 
   /// An optional token that a server can use to report partial results (e.g.
   /// streaming) to the client.
-  final Either2<num, String> partialResultToken;
+  final Either2<num, String>? partialResultToken;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -20362,14 +19486,7 @@
   static const jsonHandler =
       LspJsonHandler(Position.canParse, Position.fromJson);
 
-  Position({@required this.line, @required this.character}) {
-    if (line == null) {
-      throw 'line is required but was not provided';
-    }
-    if (character == null) {
-      throw 'character is required but was not provided';
-    }
-  }
+  Position({required this.line, required this.character});
   static Position fromJson(Map<String, dynamic> json) {
     final line = json['line'];
     final character = json['character'];
@@ -20389,9 +19506,8 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['line'] = line ?? (throw 'line is required but was not set');
-    __result['character'] =
-        character ?? (throw 'character is required but was not set');
+    __result['line'] = line;
+    __result['character'] = character;
     return __result;
   }
 
@@ -20462,20 +19578,10 @@
   static const jsonHandler = LspJsonHandler(
       PrepareRenameParams.canParse, PrepareRenameParams.fromJson);
 
-  PrepareRenameParams({@required this.textDocument, @required this.position}) {
-    if (textDocument == null) {
-      throw 'textDocument is required but was not provided';
-    }
-    if (position == null) {
-      throw 'position is required but was not provided';
-    }
-  }
+  PrepareRenameParams({required this.textDocument, required this.position});
   static PrepareRenameParams fromJson(Map<String, dynamic> json) {
-    final textDocument = json['textDocument'] != null
-        ? TextDocumentIdentifier.fromJson(json['textDocument'])
-        : null;
-    final position =
-        json['position'] != null ? Position.fromJson(json['position']) : null;
+    final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
+    final position = Position.fromJson(json['position']);
     return PrepareRenameParams(textDocument: textDocument, position: position);
   }
 
@@ -20487,10 +19593,8 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['textDocument'] = textDocument?.toJson() ??
-        (throw 'textDocument is required but was not set');
-    __result['position'] =
-        position?.toJson() ?? (throw 'position is required but was not set');
+    __result['textDocument'] = textDocument.toJson();
+    __result['position'] = position.toJson();
     return __result;
   }
 
@@ -20590,14 +19694,7 @@
   static const jsonHandler =
       LspJsonHandler(ProgressParams.canParse, ProgressParams.fromJson);
 
-  ProgressParams({@required this.token, @required this.value}) {
-    if (token == null) {
-      throw 'token is required but was not provided';
-    }
-    if (value == null) {
-      throw 'value is required but was not provided';
-    }
-  }
+  ProgressParams({required this.token, this.value});
   static ProgressParams<T> fromJson<T>(Map<String, dynamic> json) {
     final token = json['token'] is num
         ? Either2<num, String>.t1(json['token'])
@@ -20612,12 +19709,12 @@
   final Either2<num, String> token;
 
   /// The progress data.
-  final T value;
+  final dynamic value;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['token'] = token ?? (throw 'token is required but was not set');
-    __result['value'] = value ?? (throw 'value is required but was not set');
+    __result['token'] = token;
+    __result['value'] = value;
     return __result;
   }
 
@@ -20640,23 +19737,6 @@
       } finally {
         reporter.pop();
       }
-      reporter.push('value');
-      try {
-        if (!obj.containsKey('value')) {
-          reporter.reportError('must not be undefined');
-          return false;
-        }
-        if (obj['value'] == null) {
-          reporter.reportError('must not be null');
-          return false;
-        }
-        if (!(true /* T.canParse(obj['value']) */)) {
-          reporter.reportError('must be of type T');
-          return false;
-        }
-      } finally {
-        reporter.pop();
-      }
       return true;
     } else {
       reporter.reportError('must be of type ProgressParams<T>');
@@ -20715,26 +19795,26 @@
 
   /// Client supports a codeDescription property
   ///  @since 3.16.0
-  final bool codeDescriptionSupport;
+  final bool? codeDescriptionSupport;
 
   /// Whether code action supports the `data` property which is preserved
   /// between a `textDocument/publishDiagnostics` and `textDocument/codeAction`
   /// request.
   ///  @since 3.16.0
-  final bool dataSupport;
+  final bool? dataSupport;
 
   /// Whether the clients accepts diagnostics with related information.
-  final bool relatedInformation;
+  final bool? relatedInformation;
 
   /// Client supports the tag property to provide meta data about a diagnostic.
   /// Clients supporting tags have to handle unknown tags gracefully.
   ///  @since 3.15.0
-  final PublishDiagnosticsClientCapabilitiesTagSupport tagSupport;
+  final PublishDiagnosticsClientCapabilitiesTagSupport? tagSupport;
 
   /// Whether the client interprets the version property of the
   /// `textDocument/publishDiagnostics` notification's parameter.
   ///  @since 3.15.0
-  final bool versionSupport;
+  final bool? versionSupport;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -20742,7 +19822,7 @@
       __result['relatedInformation'] = relatedInformation;
     }
     if (tagSupport != null) {
-      __result['tagSupport'] = tagSupport.toJson();
+      __result['tagSupport'] = tagSupport?.toJson();
     }
     if (versionSupport != null) {
       __result['versionSupport'] = versionSupport;
@@ -20850,15 +19930,11 @@
       PublishDiagnosticsClientCapabilitiesTagSupport.canParse,
       PublishDiagnosticsClientCapabilitiesTagSupport.fromJson);
 
-  PublishDiagnosticsClientCapabilitiesTagSupport({@required this.valueSet}) {
-    if (valueSet == null) {
-      throw 'valueSet is required but was not provided';
-    }
-  }
+  PublishDiagnosticsClientCapabilitiesTagSupport({required this.valueSet});
   static PublishDiagnosticsClientCapabilitiesTagSupport fromJson(
       Map<String, dynamic> json) {
     final valueSet = json['valueSet']
-        ?.map((item) => item != null ? DiagnosticTag.fromJson(item) : null)
+        ?.map((item) => DiagnosticTag.fromJson(item))
         ?.cast<DiagnosticTag>()
         ?.toList();
     return PublishDiagnosticsClientCapabilitiesTagSupport(valueSet: valueSet);
@@ -20869,8 +19945,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['valueSet'] = valueSet?.map((item) => item.toJson())?.toList() ??
-        (throw 'valueSet is required but was not set');
+    __result['valueSet'] = valueSet.map((item) => item.toJson()).toList();
     return __result;
   }
 
@@ -20930,19 +20005,12 @@
       PublishDiagnosticsParams.canParse, PublishDiagnosticsParams.fromJson);
 
   PublishDiagnosticsParams(
-      {@required this.uri, this.version, @required this.diagnostics}) {
-    if (uri == null) {
-      throw 'uri is required but was not provided';
-    }
-    if (diagnostics == null) {
-      throw 'diagnostics is required but was not provided';
-    }
-  }
+      {required this.uri, this.version, required this.diagnostics});
   static PublishDiagnosticsParams fromJson(Map<String, dynamic> json) {
     final uri = json['uri'];
     final version = json['version'];
     final diagnostics = json['diagnostics']
-        ?.map((item) => item != null ? Diagnostic.fromJson(item) : null)
+        ?.map((item) => Diagnostic.fromJson(item))
         ?.cast<Diagnostic>()
         ?.toList();
     return PublishDiagnosticsParams(
@@ -20958,17 +20026,15 @@
   /// Optional the version number of the document the diagnostics are published
   /// for.
   ///  @since 3.15.0
-  final num version;
+  final num? version;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['uri'] = uri ?? (throw 'uri is required but was not set');
+    __result['uri'] = uri;
     if (version != null) {
       __result['version'] = version;
     }
-    __result['diagnostics'] =
-        diagnostics?.map((item) => item.toJson())?.toList() ??
-            (throw 'diagnostics is required but was not set');
+    __result['diagnostics'] = diagnostics.map((item) => item.toJson()).toList();
     return __result;
   }
 
@@ -21055,18 +20121,10 @@
 class Range implements ToJsonable {
   static const jsonHandler = LspJsonHandler(Range.canParse, Range.fromJson);
 
-  Range({@required this.start, @required this.end}) {
-    if (start == null) {
-      throw 'start is required but was not provided';
-    }
-    if (end == null) {
-      throw 'end is required but was not provided';
-    }
-  }
+  Range({required this.start, required this.end});
   static Range fromJson(Map<String, dynamic> json) {
-    final start =
-        json['start'] != null ? Position.fromJson(json['start']) : null;
-    final end = json['end'] != null ? Position.fromJson(json['end']) : null;
+    final start = Position.fromJson(json['start']);
+    final end = Position.fromJson(json['end']);
     return Range(start: start, end: end);
   }
 
@@ -21078,10 +20136,8 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['start'] =
-        start?.toJson() ?? (throw 'start is required but was not set');
-    __result['end'] =
-        end?.toJson() ?? (throw 'end is required but was not set');
+    __result['start'] = start.toJson();
+    __result['end'] = end.toJson();
     return __result;
   }
 
@@ -21152,16 +20208,9 @@
   static const jsonHandler = LspJsonHandler(
       RangeAndPlaceholder.canParse, RangeAndPlaceholder.fromJson);
 
-  RangeAndPlaceholder({@required this.range, @required this.placeholder}) {
-    if (range == null) {
-      throw 'range is required but was not provided';
-    }
-    if (placeholder == null) {
-      throw 'placeholder is required but was not provided';
-    }
-  }
+  RangeAndPlaceholder({required this.range, required this.placeholder});
   static RangeAndPlaceholder fromJson(Map<String, dynamic> json) {
-    final range = json['range'] != null ? Range.fromJson(json['range']) : null;
+    final range = Range.fromJson(json['range']);
     final placeholder = json['placeholder'];
     return RangeAndPlaceholder(range: range, placeholder: placeholder);
   }
@@ -21171,10 +20220,8 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['range'] =
-        range?.toJson() ?? (throw 'range is required but was not set');
-    __result['placeholder'] =
-        placeholder ?? (throw 'placeholder is required but was not set');
+    __result['range'] = range.toJson();
+    __result['placeholder'] = placeholder;
     return __result;
   }
 
@@ -21255,7 +20302,7 @@
   }
 
   /// Whether references supports dynamic registration.
-  final bool dynamicRegistration;
+  final bool? dynamicRegistration;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -21308,11 +20355,7 @@
   static const jsonHandler =
       LspJsonHandler(ReferenceContext.canParse, ReferenceContext.fromJson);
 
-  ReferenceContext({@required this.includeDeclaration}) {
-    if (includeDeclaration == null) {
-      throw 'includeDeclaration is required but was not provided';
-    }
-  }
+  ReferenceContext({required this.includeDeclaration});
   static ReferenceContext fromJson(Map<String, dynamic> json) {
     final includeDeclaration = json['includeDeclaration'];
     return ReferenceContext(includeDeclaration: includeDeclaration);
@@ -21323,8 +20366,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['includeDeclaration'] = includeDeclaration ??
-        (throw 'includeDeclaration is required but was not set');
+    __result['includeDeclaration'] = includeDeclaration;
     return __result;
   }
 
@@ -21386,7 +20428,7 @@
     return ReferenceOptions(workDoneProgress: workDoneProgress);
   }
 
-  final bool workDoneProgress;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -21444,43 +20486,28 @@
       LspJsonHandler(ReferenceParams.canParse, ReferenceParams.fromJson);
 
   ReferenceParams(
-      {@required this.context,
-      @required this.textDocument,
-      @required this.position,
+      {required this.context,
+      required this.textDocument,
+      required this.position,
       this.workDoneToken,
-      this.partialResultToken}) {
-    if (context == null) {
-      throw 'context is required but was not provided';
-    }
-    if (textDocument == null) {
-      throw 'textDocument is required but was not provided';
-    }
-    if (position == null) {
-      throw 'position is required but was not provided';
-    }
-  }
+      this.partialResultToken});
   static ReferenceParams fromJson(Map<String, dynamic> json) {
-    final context = json['context'] != null
-        ? ReferenceContext.fromJson(json['context'])
-        : null;
-    final textDocument = json['textDocument'] != null
-        ? TextDocumentIdentifier.fromJson(json['textDocument'])
-        : null;
-    final position =
-        json['position'] != null ? Position.fromJson(json['position']) : null;
-    final workDoneToken = json['workDoneToken'] is num
-        ? Either2<num, String>.t1(json['workDoneToken'])
-        : (json['workDoneToken'] is String
-            ? Either2<num, String>.t2(json['workDoneToken'])
-            : (json['workDoneToken'] == null
-                ? null
+    final context = ReferenceContext.fromJson(json['context']);
+    final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
+    final position = Position.fromJson(json['position']);
+    final workDoneToken = json['workDoneToken'] == null
+        ? null
+        : (json['workDoneToken'] is num
+            ? Either2<num, String>.t1(json['workDoneToken'])
+            : (json['workDoneToken'] is String
+                ? Either2<num, String>.t2(json['workDoneToken'])
                 : (throw '''${json['workDoneToken']} was not one of (num, String)''')));
-    final partialResultToken = json['partialResultToken'] is num
-        ? Either2<num, String>.t1(json['partialResultToken'])
-        : (json['partialResultToken'] is String
-            ? Either2<num, String>.t2(json['partialResultToken'])
-            : (json['partialResultToken'] == null
-                ? null
+    final partialResultToken = json['partialResultToken'] == null
+        ? null
+        : (json['partialResultToken'] is num
+            ? Either2<num, String>.t1(json['partialResultToken'])
+            : (json['partialResultToken'] is String
+                ? Either2<num, String>.t2(json['partialResultToken'])
                 : (throw '''${json['partialResultToken']} was not one of (num, String)''')));
     return ReferenceParams(
         context: context,
@@ -21494,7 +20521,7 @@
 
   /// An optional token that a server can use to report partial results (e.g.
   /// streaming) to the client.
-  final Either2<num, String> partialResultToken;
+  final Either2<num, String>? partialResultToken;
 
   /// The position inside the text document.
   final Position position;
@@ -21503,16 +20530,13 @@
   final TextDocumentIdentifier textDocument;
 
   /// An optional token that a server can use to report work done progress.
-  final Either2<num, String> workDoneToken;
+  final Either2<num, String>? workDoneToken;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['context'] =
-        context?.toJson() ?? (throw 'context is required but was not set');
-    __result['textDocument'] = textDocument?.toJson() ??
-        (throw 'textDocument is required but was not set');
-    __result['position'] =
-        position?.toJson() ?? (throw 'position is required but was not set');
+    __result['context'] = context.toJson();
+    __result['textDocument'] = textDocument.toJson();
+    __result['position'] = position.toJson();
     if (workDoneToken != null) {
       __result['workDoneToken'] = workDoneToken;
     }
@@ -21651,8 +20675,8 @@
 
   /// A document selector to identify the scope of the registration. If set to
   /// null the document selector provided on the client side will be used.
-  final List<DocumentFilter> documentSelector;
-  final bool workDoneProgress;
+  final List<DocumentFilter>? documentSelector;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -21727,15 +20751,7 @@
   static const jsonHandler =
       LspJsonHandler(Registration.canParse, Registration.fromJson);
 
-  Registration(
-      {@required this.id, @required this.method, this.registerOptions}) {
-    if (id == null) {
-      throw 'id is required but was not provided';
-    }
-    if (method == null) {
-      throw 'method is required but was not provided';
-    }
-  }
+  Registration({required this.id, required this.method, this.registerOptions});
   static Registration fromJson(Map<String, dynamic> json) {
     final id = json['id'];
     final method = json['method'];
@@ -21756,8 +20772,8 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['id'] = id ?? (throw 'id is required but was not set');
-    __result['method'] = method ?? (throw 'method is required but was not set');
+    __result['id'] = id;
+    __result['method'] = method;
     if (registerOptions != null) {
       __result['registerOptions'] = registerOptions;
     }
@@ -21800,15 +20816,6 @@
       } finally {
         reporter.pop();
       }
-      reporter.push('registerOptions');
-      try {
-        if (obj['registerOptions'] != null && !(true)) {
-          reporter.reportError('must be of type dynamic');
-          return false;
-        }
-      } finally {
-        reporter.pop();
-      }
       return true;
     } else {
       reporter.reportError('must be of type Registration');
@@ -21844,14 +20851,10 @@
   static const jsonHandler =
       LspJsonHandler(RegistrationParams.canParse, RegistrationParams.fromJson);
 
-  RegistrationParams({@required this.registrations}) {
-    if (registrations == null) {
-      throw 'registrations is required but was not provided';
-    }
-  }
+  RegistrationParams({required this.registrations});
   static RegistrationParams fromJson(Map<String, dynamic> json) {
     final registrations = json['registrations']
-        ?.map((item) => item != null ? Registration.fromJson(item) : null)
+        ?.map((item) => Registration.fromJson(item))
         ?.cast<Registration>()
         ?.toList();
     return RegistrationParams(registrations: registrations);
@@ -21862,8 +20865,7 @@
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
     __result['registrations'] =
-        registrations?.map((item) => item.toJson())?.toList() ??
-            (throw 'registrations is required but was not set');
+        registrations.map((item) => item.toJson()).toList();
     return __result;
   }
 
@@ -21923,11 +20925,7 @@
       RegularExpressionsClientCapabilities.canParse,
       RegularExpressionsClientCapabilities.fromJson);
 
-  RegularExpressionsClientCapabilities({@required this.engine, this.version}) {
-    if (engine == null) {
-      throw 'engine is required but was not provided';
-    }
-  }
+  RegularExpressionsClientCapabilities({required this.engine, this.version});
   static RegularExpressionsClientCapabilities fromJson(
       Map<String, dynamic> json) {
     final engine = json['engine'];
@@ -21940,11 +20938,11 @@
   final String engine;
 
   /// The engine's version.
-  final String version;
+  final String? version;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['engine'] = engine ?? (throw 'engine is required but was not set');
+    __result['engine'] = engine;
     if (version != null) {
       __result['version'] = version;
     }
@@ -22034,26 +21032,26 @@
   }
 
   /// Whether rename supports dynamic registration.
-  final bool dynamicRegistration;
+  final bool? dynamicRegistration;
 
   /// Whether th client honors the change annotations in text edits and resource
   /// operations returned via the rename request's workspace edit by for example
   /// presenting the workspace edit in the user interface and asking for
   /// confirmation.
   ///  @since 3.16.0
-  final bool honorsChangeAnnotations;
+  final bool? honorsChangeAnnotations;
 
   /// Client supports testing for validity of rename operations before
   /// execution.
   ///  @since version 3.12.0
-  final bool prepareSupport;
+  final bool? prepareSupport;
 
   /// Client supports the default behavior result (`{ defaultBehavior: boolean
   /// }`).
   ///
   /// The value indicates the default behavior used by the client.
   ///  @since version 3.16.0
-  final PrepareSupportDefaultBehavior prepareSupportDefaultBehavior;
+  final PrepareSupportDefaultBehavior? prepareSupportDefaultBehavior;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -22065,7 +21063,7 @@
     }
     if (prepareSupportDefaultBehavior != null) {
       __result['prepareSupportDefaultBehavior'] =
-          prepareSupportDefaultBehavior.toJson();
+          prepareSupportDefaultBehavior?.toJson();
     }
     if (honorsChangeAnnotations != null) {
       __result['honorsChangeAnnotations'] = honorsChangeAnnotations;
@@ -22157,19 +21155,13 @@
 
   RenameFile(
       {this.kind = 'rename',
-      @required this.oldUri,
-      @required this.newUri,
+      required this.oldUri,
+      required this.newUri,
       this.options,
       this.annotationId}) {
     if (kind != 'rename') {
       throw 'kind may only be the literal \'rename\'';
     }
-    if (oldUri == null) {
-      throw 'oldUri is required but was not provided';
-    }
-    if (newUri == null) {
-      throw 'newUri is required but was not provided';
-    }
   }
   static RenameFile fromJson(Map<String, dynamic> json) {
     final kind = json['kind'];
@@ -22189,7 +21181,7 @@
 
   /// An optional annotation identifer describing the operation.
   ///  @since 3.16.0
-  final String annotationId;
+  final String? annotationId;
 
   /// A rename
   final String kind;
@@ -22201,15 +21193,15 @@
   final String oldUri;
 
   /// Rename options.
-  final RenameFileOptions options;
+  final RenameFileOptions? options;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['kind'] = kind ?? (throw 'kind is required but was not set');
-    __result['oldUri'] = oldUri ?? (throw 'oldUri is required but was not set');
-    __result['newUri'] = newUri ?? (throw 'newUri is required but was not set');
+    __result['kind'] = kind;
+    __result['oldUri'] = oldUri;
+    __result['newUri'] = newUri;
     if (options != null) {
-      __result['options'] = options.toJson();
+      __result['options'] = options?.toJson();
     }
     if (annotationId != null) {
       __result['annotationId'] = annotationId;
@@ -22338,10 +21330,10 @@
   }
 
   /// Ignores if target exists.
-  final bool ignoreIfExists;
+  final bool? ignoreIfExists;
 
   /// Overwrite target if existing. Overwrite wins over `ignoreIfExists`
-  final bool overwrite;
+  final bool? overwrite;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -22410,14 +21402,10 @@
   static const jsonHandler =
       LspJsonHandler(RenameFilesParams.canParse, RenameFilesParams.fromJson);
 
-  RenameFilesParams({@required this.files}) {
-    if (files == null) {
-      throw 'files is required but was not provided';
-    }
-  }
+  RenameFilesParams({required this.files});
   static RenameFilesParams fromJson(Map<String, dynamic> json) {
     final files = json['files']
-        ?.map((item) => item != null ? FileRename.fromJson(item) : null)
+        ?.map((item) => FileRename.fromJson(item))
         ?.cast<FileRename>()
         ?.toList();
     return RenameFilesParams(files: files);
@@ -22429,8 +21417,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['files'] = files?.map((item) => item.toJson())?.toList() ??
-        (throw 'files is required but was not set');
+    __result['files'] = files.map((item) => item.toJson()).toList();
     return __result;
   }
 
@@ -22499,8 +21486,8 @@
   }
 
   /// Renames should be checked and tested before being executed.
-  final bool prepareProvider;
-  final bool workDoneProgress;
+  final bool? prepareProvider;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -22570,33 +21557,20 @@
       LspJsonHandler(RenameParams.canParse, RenameParams.fromJson);
 
   RenameParams(
-      {@required this.newName,
-      @required this.textDocument,
-      @required this.position,
-      this.workDoneToken}) {
-    if (newName == null) {
-      throw 'newName is required but was not provided';
-    }
-    if (textDocument == null) {
-      throw 'textDocument is required but was not provided';
-    }
-    if (position == null) {
-      throw 'position is required but was not provided';
-    }
-  }
+      {required this.newName,
+      required this.textDocument,
+      required this.position,
+      this.workDoneToken});
   static RenameParams fromJson(Map<String, dynamic> json) {
     final newName = json['newName'];
-    final textDocument = json['textDocument'] != null
-        ? TextDocumentIdentifier.fromJson(json['textDocument'])
-        : null;
-    final position =
-        json['position'] != null ? Position.fromJson(json['position']) : null;
-    final workDoneToken = json['workDoneToken'] is num
-        ? Either2<num, String>.t1(json['workDoneToken'])
-        : (json['workDoneToken'] is String
-            ? Either2<num, String>.t2(json['workDoneToken'])
-            : (json['workDoneToken'] == null
-                ? null
+    final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
+    final position = Position.fromJson(json['position']);
+    final workDoneToken = json['workDoneToken'] == null
+        ? null
+        : (json['workDoneToken'] is num
+            ? Either2<num, String>.t1(json['workDoneToken'])
+            : (json['workDoneToken'] is String
+                ? Either2<num, String>.t2(json['workDoneToken'])
                 : (throw '''${json['workDoneToken']} was not one of (num, String)''')));
     return RenameParams(
         newName: newName,
@@ -22616,16 +21590,13 @@
   final TextDocumentIdentifier textDocument;
 
   /// An optional token that a server can use to report work done progress.
-  final Either2<num, String> workDoneToken;
+  final Either2<num, String>? workDoneToken;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['newName'] =
-        newName ?? (throw 'newName is required but was not set');
-    __result['textDocument'] = textDocument?.toJson() ??
-        (throw 'textDocument is required but was not set');
-    __result['position'] =
-        position?.toJson() ?? (throw 'position is required but was not set');
+    __result['newName'] = newName;
+    __result['textDocument'] = textDocument.toJson();
+    __result['position'] = position.toJson();
     if (workDoneToken != null) {
       __result['workDoneToken'] = workDoneToken;
     }
@@ -22751,11 +21722,11 @@
 
   /// A document selector to identify the scope of the registration. If set to
   /// null the document selector provided on the client side will be used.
-  final List<DocumentFilter> documentSelector;
+  final List<DocumentFilter>? documentSelector;
 
   /// Renames should be checked and tested before being executed.
-  final bool prepareProvider;
-  final bool workDoneProgress;
+  final bool? prepareProvider;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -22845,28 +21816,17 @@
       LspJsonHandler(RequestMessage.canParse, RequestMessage.fromJson);
 
   RequestMessage(
-      {@required this.id,
-      @required this.method,
+      {required this.id,
+      required this.method,
       this.params,
-      @required this.jsonrpc}) {
-    if (id == null) {
-      throw 'id is required but was not provided';
-    }
-    if (method == null) {
-      throw 'method is required but was not provided';
-    }
-    if (jsonrpc == null) {
-      throw 'jsonrpc is required but was not provided';
-    }
-  }
+      required this.jsonrpc});
   static RequestMessage fromJson(Map<String, dynamic> json) {
     final id = json['id'] is num
         ? Either2<num, String>.t1(json['id'])
         : (json['id'] is String
             ? Either2<num, String>.t2(json['id'])
             : (throw '''${json['id']} was not one of (num, String)'''));
-    final method =
-        json['method'] != null ? Method.fromJson(json['method']) : null;
+    final method = Method.fromJson(json['method']);
     final params = json['params'];
     final jsonrpc = json['jsonrpc'];
     return RequestMessage(
@@ -22885,14 +21845,12 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['id'] = id ?? (throw 'id is required but was not set');
-    __result['method'] =
-        method?.toJson() ?? (throw 'method is required but was not set');
+    __result['id'] = id;
+    __result['method'] = method.toJson();
     if (params != null) {
       __result['params'] = params;
     }
-    __result['jsonrpc'] =
-        jsonrpc ?? (throw 'jsonrpc is required but was not set');
+    __result['jsonrpc'] = jsonrpc;
     return __result;
   }
 
@@ -22932,15 +21890,6 @@
       } finally {
         reporter.pop();
       }
-      reporter.push('params');
-      try {
-        if (obj['params'] != null && !(true)) {
-          reporter.reportError('must be of type dynamic');
-          return false;
-        }
-      } finally {
-        reporter.pop();
-      }
       reporter.push('jsonrpc');
       try {
         if (!obj.containsKey('jsonrpc')) {
@@ -23032,17 +21981,9 @@
   static const jsonHandler =
       LspJsonHandler(ResponseError.canParse, ResponseError.fromJson);
 
-  ResponseError({@required this.code, @required this.message, this.data}) {
-    if (code == null) {
-      throw 'code is required but was not provided';
-    }
-    if (message == null) {
-      throw 'message is required but was not provided';
-    }
-  }
+  ResponseError({required this.code, required this.message, this.data});
   static ResponseError fromJson(Map<String, dynamic> json) {
-    final code =
-        json['code'] != null ? ErrorCodes.fromJson(json['code']) : null;
+    final code = ErrorCodes.fromJson(json['code']);
     final message = json['message'];
     final data = json['data'];
     return ResponseError(code: code, message: message, data: data);
@@ -23053,17 +21994,15 @@
 
   /// A string that contains additional information about the error. Can be
   /// omitted.
-  final String data;
+  final String? data;
 
   /// A string providing a short description of the error.
   final String message;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['code'] =
-        code?.toJson() ?? (throw 'code is required but was not set');
-    __result['message'] =
-        message ?? (throw 'message is required but was not set');
+    __result['code'] = code.toJson();
+    __result['message'] = message;
     if (data != null) {
       __result['data'] = data;
     }
@@ -23150,18 +22089,14 @@
   static const jsonHandler =
       LspJsonHandler(ResponseMessage.canParse, ResponseMessage.fromJson);
 
-  ResponseMessage({this.id, this.result, this.error, @required this.jsonrpc}) {
-    if (jsonrpc == null) {
-      throw 'jsonrpc is required but was not provided';
-    }
-  }
+  ResponseMessage({this.id, this.result, this.error, required this.jsonrpc});
   static ResponseMessage fromJson(Map<String, dynamic> json) {
-    final id = json['id'] is num
-        ? Either2<num, String>.t1(json['id'])
-        : (json['id'] is String
-            ? Either2<num, String>.t2(json['id'])
-            : (json['id'] == null
-                ? null
+    final id = json['id'] == null
+        ? null
+        : (json['id'] is num
+            ? Either2<num, String>.t1(json['id'])
+            : (json['id'] is String
+                ? Either2<num, String>.t2(json['id'])
                 : (throw '''${json['id']} was not one of (num, String)''')));
     final result = json['result'];
     final error =
@@ -23172,10 +22107,10 @@
   }
 
   /// The error object in case a request fails.
-  final ResponseError error;
+  final ResponseError? error;
 
   /// The request id.
-  final Either2<num, String> id;
+  final Either2<num, String>? id;
   final String jsonrpc;
 
   /// The result of a request. This member is REQUIRED on success. This member
@@ -23185,8 +22120,7 @@
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
     __result['id'] = id;
-    __result['jsonrpc'] =
-        jsonrpc ?? (throw 'jsonrpc is required but was not set');
+    __result['jsonrpc'] = jsonrpc;
     if (error != null && result != null) {
       throw 'result and error cannot both be set';
     } else if (error != null) {
@@ -23212,15 +22146,6 @@
       } finally {
         reporter.pop();
       }
-      reporter.push('result');
-      try {
-        if (obj['result'] != null && !(true)) {
-          reporter.reportError('must be of type dynamic');
-          return false;
-        }
-      } finally {
-        reporter.pop();
-      }
       reporter.push('error');
       try {
         if (obj['error'] != null &&
@@ -23292,7 +22217,7 @@
   }
 
   /// The client is supposed to include the content on save.
-  final bool includeText;
+  final bool? includeText;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -23343,13 +22268,9 @@
   static const jsonHandler =
       LspJsonHandler(SelectionRange.canParse, SelectionRange.fromJson);
 
-  SelectionRange({@required this.range, this.parent}) {
-    if (range == null) {
-      throw 'range is required but was not provided';
-    }
-  }
+  SelectionRange({required this.range, this.parent});
   static SelectionRange fromJson(Map<String, dynamic> json) {
-    final range = json['range'] != null ? Range.fromJson(json['range']) : null;
+    final range = Range.fromJson(json['range']);
     final parent =
         json['parent'] != null ? SelectionRange.fromJson(json['parent']) : null;
     return SelectionRange(range: range, parent: parent);
@@ -23357,17 +22278,16 @@
 
   /// The parent selection range containing this range. Therefore `parent.range`
   /// must contain `this.range`.
-  final SelectionRange parent;
+  final SelectionRange? parent;
 
   /// The range ([Range]) of this selection range.
   final Range range;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['range'] =
-        range?.toJson() ?? (throw 'range is required but was not set');
+    __result['range'] = range.toJson();
     if (parent != null) {
-      __result['parent'] = parent.toJson();
+      __result['parent'] = parent?.toJson();
     }
     return __result;
   }
@@ -23444,7 +22364,7 @@
   /// providers. If this is set to `true` the client supports the new
   /// `SelectionRangeRegistrationOptions` return value for the corresponding
   /// server capability as well.
-  final bool dynamicRegistration;
+  final bool? dynamicRegistration;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -23506,7 +22426,7 @@
     return SelectionRangeOptions(workDoneProgress: workDoneProgress);
   }
 
-  final bool workDoneProgress;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -23561,38 +22481,29 @@
       SelectionRangeParams.canParse, SelectionRangeParams.fromJson);
 
   SelectionRangeParams(
-      {@required this.textDocument,
-      @required this.positions,
+      {required this.textDocument,
+      required this.positions,
       this.workDoneToken,
-      this.partialResultToken}) {
-    if (textDocument == null) {
-      throw 'textDocument is required but was not provided';
-    }
-    if (positions == null) {
-      throw 'positions is required but was not provided';
-    }
-  }
+      this.partialResultToken});
   static SelectionRangeParams fromJson(Map<String, dynamic> json) {
-    final textDocument = json['textDocument'] != null
-        ? TextDocumentIdentifier.fromJson(json['textDocument'])
-        : null;
+    final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
     final positions = json['positions']
-        ?.map((item) => item != null ? Position.fromJson(item) : null)
+        ?.map((item) => Position.fromJson(item))
         ?.cast<Position>()
         ?.toList();
-    final workDoneToken = json['workDoneToken'] is num
-        ? Either2<num, String>.t1(json['workDoneToken'])
-        : (json['workDoneToken'] is String
-            ? Either2<num, String>.t2(json['workDoneToken'])
-            : (json['workDoneToken'] == null
-                ? null
+    final workDoneToken = json['workDoneToken'] == null
+        ? null
+        : (json['workDoneToken'] is num
+            ? Either2<num, String>.t1(json['workDoneToken'])
+            : (json['workDoneToken'] is String
+                ? Either2<num, String>.t2(json['workDoneToken'])
                 : (throw '''${json['workDoneToken']} was not one of (num, String)''')));
-    final partialResultToken = json['partialResultToken'] is num
-        ? Either2<num, String>.t1(json['partialResultToken'])
-        : (json['partialResultToken'] is String
-            ? Either2<num, String>.t2(json['partialResultToken'])
-            : (json['partialResultToken'] == null
-                ? null
+    final partialResultToken = json['partialResultToken'] == null
+        ? null
+        : (json['partialResultToken'] is num
+            ? Either2<num, String>.t1(json['partialResultToken'])
+            : (json['partialResultToken'] is String
+                ? Either2<num, String>.t2(json['partialResultToken'])
                 : (throw '''${json['partialResultToken']} was not one of (num, String)''')));
     return SelectionRangeParams(
         textDocument: textDocument,
@@ -23603,7 +22514,7 @@
 
   /// An optional token that a server can use to report partial results (e.g.
   /// streaming) to the client.
-  final Either2<num, String> partialResultToken;
+  final Either2<num, String>? partialResultToken;
 
   /// The positions inside the text document.
   final List<Position> positions;
@@ -23612,14 +22523,12 @@
   final TextDocumentIdentifier textDocument;
 
   /// An optional token that a server can use to report work done progress.
-  final Either2<num, String> workDoneToken;
+  final Either2<num, String>? workDoneToken;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['textDocument'] = textDocument?.toJson() ??
-        (throw 'textDocument is required but was not set');
-    __result['positions'] = positions?.map((item) => item.toJson())?.toList() ??
-        (throw 'positions is required but was not set');
+    __result['textDocument'] = textDocument.toJson();
+    __result['positions'] = positions.map((item) => item.toJson()).toList();
     if (workDoneToken != null) {
       __result['workDoneToken'] = workDoneToken;
     }
@@ -23751,12 +22660,12 @@
 
   /// A document selector to identify the scope of the registration. If set to
   /// null the document selector provided on the client side will be used.
-  final List<DocumentFilter> documentSelector;
+  final List<DocumentFilter>? documentSelector;
 
   /// The id used to register the request. The id can be used to deregister the
   /// request again. See also Registration#id.
-  final String id;
-  final bool workDoneProgress;
+  final String? id;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -23924,11 +22833,7 @@
   static const jsonHandler =
       LspJsonHandler(SemanticTokens.canParse, SemanticTokens.fromJson);
 
-  SemanticTokens({this.resultId, @required this.data}) {
-    if (data == null) {
-      throw 'data is required but was not provided';
-    }
-  }
+  SemanticTokens({this.resultId, required this.data});
   static SemanticTokens fromJson(Map<String, dynamic> json) {
     final resultId = json['resultId'];
     final data = json['data']?.map((item) => item)?.cast<num>()?.toList();
@@ -23942,14 +22847,14 @@
   /// client will include the result id in the next semantic token request. A
   /// server can then instead of computing all semantic tokens again simply send
   /// a delta.
-  final String resultId;
+  final String? resultId;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
     if (resultId != null) {
       __result['resultId'] = resultId;
     }
-    __result['data'] = data ?? (throw 'data is required but was not set');
+    __result['data'] = data;
     return __result;
   }
 
@@ -24018,36 +22923,22 @@
 
   SemanticTokensClientCapabilities(
       {this.dynamicRegistration,
-      @required this.requests,
-      @required this.tokenTypes,
-      @required this.tokenModifiers,
-      @required this.formats,
+      required this.requests,
+      required this.tokenTypes,
+      required this.tokenModifiers,
+      required this.formats,
       this.overlappingTokenSupport,
-      this.multilineTokenSupport}) {
-    if (requests == null) {
-      throw 'requests is required but was not provided';
-    }
-    if (tokenTypes == null) {
-      throw 'tokenTypes is required but was not provided';
-    }
-    if (tokenModifiers == null) {
-      throw 'tokenModifiers is required but was not provided';
-    }
-    if (formats == null) {
-      throw 'formats is required but was not provided';
-    }
-  }
+      this.multilineTokenSupport});
   static SemanticTokensClientCapabilities fromJson(Map<String, dynamic> json) {
     final dynamicRegistration = json['dynamicRegistration'];
-    final requests = json['requests'] != null
-        ? SemanticTokensClientCapabilitiesRequests.fromJson(json['requests'])
-        : null;
+    final requests =
+        SemanticTokensClientCapabilitiesRequests.fromJson(json['requests']);
     final tokenTypes =
         json['tokenTypes']?.map((item) => item)?.cast<String>()?.toList();
     final tokenModifiers =
         json['tokenModifiers']?.map((item) => item)?.cast<String>()?.toList();
     final formats = json['formats']
-        ?.map((item) => item != null ? TokenFormat.fromJson(item) : null)
+        ?.map((item) => TokenFormat.fromJson(item))
         ?.cast<TokenFormat>()
         ?.toList();
     final overlappingTokenSupport = json['overlappingTokenSupport'];
@@ -24066,16 +22957,16 @@
   /// `true` the client supports the new `(TextDocumentRegistrationOptions &
   /// StaticRegistrationOptions)` return value for the corresponding server
   /// capability as well.
-  final bool dynamicRegistration;
+  final bool? dynamicRegistration;
 
   /// The formats the clients supports.
   final List<TokenFormat> formats;
 
   /// Whether the client supports tokens that can span multiple lines.
-  final bool multilineTokenSupport;
+  final bool? multilineTokenSupport;
 
   /// Whether the client supports tokens that can overlap each other.
-  final bool overlappingTokenSupport;
+  final bool? overlappingTokenSupport;
 
   /// Which requests the client supports and might send to the server depending
   /// on the server's capability. Please note that clients might not show
@@ -24098,14 +22989,10 @@
     if (dynamicRegistration != null) {
       __result['dynamicRegistration'] = dynamicRegistration;
     }
-    __result['requests'] =
-        requests?.toJson() ?? (throw 'requests is required but was not set');
-    __result['tokenTypes'] =
-        tokenTypes ?? (throw 'tokenTypes is required but was not set');
-    __result['tokenModifiers'] =
-        tokenModifiers ?? (throw 'tokenModifiers is required but was not set');
-    __result['formats'] = formats?.map((item) => item.toJson())?.toList() ??
-        (throw 'formats is required but was not set');
+    __result['requests'] = requests.toJson();
+    __result['tokenTypes'] = tokenTypes;
+    __result['tokenModifiers'] = tokenModifiers;
+    __result['formats'] = formats.map((item) => item.toJson()).toList();
     if (overlappingTokenSupport != null) {
       __result['overlappingTokenSupport'] = overlappingTokenSupport;
     }
@@ -24278,7 +23165,7 @@
 
   /// The client will send the `textDocument/semanticTokens/full/delta` request
   /// if the server provides a corresponding handler.
-  final bool delta;
+  final bool? delta;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -24379,40 +23266,37 @@
   SemanticTokensClientCapabilitiesRequests({this.range, this.full});
   static SemanticTokensClientCapabilitiesRequests fromJson(
       Map<String, dynamic> json) {
-    final range = json['range'] is bool
-        ? Either2<bool, SemanticTokensClientCapabilitiesRange>.t1(json['range'])
-        : (SemanticTokensClientCapabilitiesRange.canParse(
-                json['range'], nullLspJsonReporter)
-            ? Either2<bool, SemanticTokensClientCapabilitiesRange>.t2(
-                json['range'] != null
-                    ? SemanticTokensClientCapabilitiesRange.fromJson(
-                        json['range'])
-                    : null)
-            : (json['range'] == null
-                ? null
+    final range = json['range'] == null
+        ? null
+        : (json['range'] is bool
+            ? Either2<bool, SemanticTokensClientCapabilitiesRange>.t1(
+                json['range'])
+            : (SemanticTokensClientCapabilitiesRange.canParse(
+                    json['range'], nullLspJsonReporter)
+                ? Either2<bool, SemanticTokensClientCapabilitiesRange>.t2(
+                    SemanticTokensClientCapabilitiesRange.fromJson(
+                        json['range']))
                 : (throw '''${json['range']} was not one of (bool, SemanticTokensClientCapabilitiesRange)''')));
-    final full = json['full'] is bool
-        ? Either2<bool, SemanticTokensClientCapabilitiesFull>.t1(json['full'])
-        : (SemanticTokensClientCapabilitiesFull.canParse(
-                json['full'], nullLspJsonReporter)
-            ? Either2<bool, SemanticTokensClientCapabilitiesFull>.t2(
-                json['full'] != null
-                    ? SemanticTokensClientCapabilitiesFull.fromJson(
-                        json['full'])
-                    : null)
-            : (json['full'] == null
-                ? null
+    final full = json['full'] == null
+        ? null
+        : (json['full'] is bool
+            ? Either2<bool, SemanticTokensClientCapabilitiesFull>.t1(
+                json['full'])
+            : (SemanticTokensClientCapabilitiesFull.canParse(
+                    json['full'], nullLspJsonReporter)
+                ? Either2<bool, SemanticTokensClientCapabilitiesFull>.t2(
+                    SemanticTokensClientCapabilitiesFull.fromJson(json['full']))
                 : (throw '''${json['full']} was not one of (bool, SemanticTokensClientCapabilitiesFull)''')));
     return SemanticTokensClientCapabilitiesRequests(range: range, full: full);
   }
 
   /// The client will send the `textDocument/semanticTokens/full` request if the
   /// server provides a corresponding handler.
-  final Either2<bool, SemanticTokensClientCapabilitiesFull> full;
+  final Either2<bool, SemanticTokensClientCapabilitiesFull>? full;
 
   /// The client will send the `textDocument/semanticTokens/range` request if
   /// the server provides a corresponding handler.
-  final Either2<bool, SemanticTokensClientCapabilitiesRange> range;
+  final Either2<bool, SemanticTokensClientCapabilitiesRange>? range;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -24486,15 +23370,11 @@
   static const jsonHandler = LspJsonHandler(
       SemanticTokensDelta.canParse, SemanticTokensDelta.fromJson);
 
-  SemanticTokensDelta({this.resultId, @required this.edits}) {
-    if (edits == null) {
-      throw 'edits is required but was not provided';
-    }
-  }
+  SemanticTokensDelta({this.resultId, required this.edits});
   static SemanticTokensDelta fromJson(Map<String, dynamic> json) {
     final resultId = json['resultId'];
     final edits = json['edits']
-        ?.map((item) => item != null ? SemanticTokensEdit.fromJson(item) : null)
+        ?.map((item) => SemanticTokensEdit.fromJson(item))
         ?.cast<SemanticTokensEdit>()
         ?.toList();
     return SemanticTokensDelta(resultId: resultId, edits: edits);
@@ -24502,15 +23382,14 @@
 
   /// The semantic token edits to transform a previous result into a new result.
   final List<SemanticTokensEdit> edits;
-  final String resultId;
+  final String? resultId;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
     if (resultId != null) {
       __result['resultId'] = resultId;
     }
-    __result['edits'] = edits?.map((item) => item.toJson())?.toList() ??
-        (throw 'edits is required but was not set');
+    __result['edits'] = edits.map((item) => item.toJson()).toList();
     return __result;
   }
 
@@ -24581,35 +23460,26 @@
       SemanticTokensDeltaParams.canParse, SemanticTokensDeltaParams.fromJson);
 
   SemanticTokensDeltaParams(
-      {@required this.textDocument,
-      @required this.previousResultId,
+      {required this.textDocument,
+      required this.previousResultId,
       this.workDoneToken,
-      this.partialResultToken}) {
-    if (textDocument == null) {
-      throw 'textDocument is required but was not provided';
-    }
-    if (previousResultId == null) {
-      throw 'previousResultId is required but was not provided';
-    }
-  }
+      this.partialResultToken});
   static SemanticTokensDeltaParams fromJson(Map<String, dynamic> json) {
-    final textDocument = json['textDocument'] != null
-        ? TextDocumentIdentifier.fromJson(json['textDocument'])
-        : null;
+    final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
     final previousResultId = json['previousResultId'];
-    final workDoneToken = json['workDoneToken'] is num
-        ? Either2<num, String>.t1(json['workDoneToken'])
-        : (json['workDoneToken'] is String
-            ? Either2<num, String>.t2(json['workDoneToken'])
-            : (json['workDoneToken'] == null
-                ? null
+    final workDoneToken = json['workDoneToken'] == null
+        ? null
+        : (json['workDoneToken'] is num
+            ? Either2<num, String>.t1(json['workDoneToken'])
+            : (json['workDoneToken'] is String
+                ? Either2<num, String>.t2(json['workDoneToken'])
                 : (throw '''${json['workDoneToken']} was not one of (num, String)''')));
-    final partialResultToken = json['partialResultToken'] is num
-        ? Either2<num, String>.t1(json['partialResultToken'])
-        : (json['partialResultToken'] is String
-            ? Either2<num, String>.t2(json['partialResultToken'])
-            : (json['partialResultToken'] == null
-                ? null
+    final partialResultToken = json['partialResultToken'] == null
+        ? null
+        : (json['partialResultToken'] is num
+            ? Either2<num, String>.t1(json['partialResultToken'])
+            : (json['partialResultToken'] is String
+                ? Either2<num, String>.t2(json['partialResultToken'])
                 : (throw '''${json['partialResultToken']} was not one of (num, String)''')));
     return SemanticTokensDeltaParams(
         textDocument: textDocument,
@@ -24620,7 +23490,7 @@
 
   /// An optional token that a server can use to report partial results (e.g.
   /// streaming) to the client.
-  final Either2<num, String> partialResultToken;
+  final Either2<num, String>? partialResultToken;
 
   /// The result id of a previous response. The result Id can either point to a
   /// full response or a delta response depending on what was received last.
@@ -24630,14 +23500,12 @@
   final TextDocumentIdentifier textDocument;
 
   /// An optional token that a server can use to report work done progress.
-  final Either2<num, String> workDoneToken;
+  final Either2<num, String>? workDoneToken;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['textDocument'] = textDocument?.toJson() ??
-        (throw 'textDocument is required but was not set');
-    __result['previousResultId'] = previousResultId ??
-        (throw 'previousResultId is required but was not set');
+    __result['textDocument'] = textDocument.toJson();
+    __result['previousResultId'] = previousResultId;
     if (workDoneToken != null) {
       __result['workDoneToken'] = workDoneToken;
     }
@@ -24744,14 +23612,10 @@
       SemanticTokensDeltaPartialResult.canParse,
       SemanticTokensDeltaPartialResult.fromJson);
 
-  SemanticTokensDeltaPartialResult({@required this.edits}) {
-    if (edits == null) {
-      throw 'edits is required but was not provided';
-    }
-  }
+  SemanticTokensDeltaPartialResult({required this.edits});
   static SemanticTokensDeltaPartialResult fromJson(Map<String, dynamic> json) {
     final edits = json['edits']
-        ?.map((item) => item != null ? SemanticTokensEdit.fromJson(item) : null)
+        ?.map((item) => SemanticTokensEdit.fromJson(item))
         ?.cast<SemanticTokensEdit>()
         ?.toList();
     return SemanticTokensDeltaPartialResult(edits: edits);
@@ -24761,8 +23625,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['edits'] = edits?.map((item) => item.toJson())?.toList() ??
-        (throw 'edits is required but was not set');
+    __result['edits'] = edits.map((item) => item.toJson()).toList();
     return __result;
   }
 
@@ -24821,14 +23684,7 @@
       LspJsonHandler(SemanticTokensEdit.canParse, SemanticTokensEdit.fromJson);
 
   SemanticTokensEdit(
-      {@required this.start, @required this.deleteCount, this.data}) {
-    if (start == null) {
-      throw 'start is required but was not provided';
-    }
-    if (deleteCount == null) {
-      throw 'deleteCount is required but was not provided';
-    }
-  }
+      {required this.start, required this.deleteCount, this.data});
   static SemanticTokensEdit fromJson(Map<String, dynamic> json) {
     final start = json['start'];
     final deleteCount = json['deleteCount'];
@@ -24838,7 +23694,7 @@
   }
 
   /// The elements to insert.
-  final List<num> data;
+  final List<num>? data;
 
   /// The count of elements to remove.
   final num deleteCount;
@@ -24848,9 +23704,8 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['start'] = start ?? (throw 'start is required but was not set');
-    __result['deleteCount'] =
-        deleteCount ?? (throw 'deleteCount is required but was not set');
+    __result['start'] = start;
+    __result['deleteCount'] = deleteCount;
     if (data != null) {
       __result['data'] = data;
     }
@@ -24941,14 +23796,7 @@
       SemanticTokensLegend.canParse, SemanticTokensLegend.fromJson);
 
   SemanticTokensLegend(
-      {@required this.tokenTypes, @required this.tokenModifiers}) {
-    if (tokenTypes == null) {
-      throw 'tokenTypes is required but was not provided';
-    }
-    if (tokenModifiers == null) {
-      throw 'tokenModifiers is required but was not provided';
-    }
-  }
+      {required this.tokenTypes, required this.tokenModifiers});
   static SemanticTokensLegend fromJson(Map<String, dynamic> json) {
     final tokenTypes =
         json['tokenTypes']?.map((item) => item)?.cast<String>()?.toList();
@@ -24966,10 +23814,8 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['tokenTypes'] =
-        tokenTypes ?? (throw 'tokenTypes is required but was not set');
-    __result['tokenModifiers'] =
-        tokenModifiers ?? (throw 'tokenModifiers is required but was not set');
+    __result['tokenTypes'] = tokenTypes;
+    __result['tokenModifiers'] = tokenModifiers;
     return __result;
   }
 
@@ -25048,36 +23894,29 @@
       SemanticTokensOptions.canParse, SemanticTokensOptions.fromJson);
 
   SemanticTokensOptions(
-      {@required this.legend, this.range, this.full, this.workDoneProgress}) {
-    if (legend == null) {
-      throw 'legend is required but was not provided';
-    }
-  }
+      {required this.legend, this.range, this.full, this.workDoneProgress});
   static SemanticTokensOptions fromJson(Map<String, dynamic> json) {
     if (SemanticTokensRegistrationOptions.canParse(json, nullLspJsonReporter)) {
       return SemanticTokensRegistrationOptions.fromJson(json);
     }
-    final legend = json['legend'] != null
-        ? SemanticTokensLegend.fromJson(json['legend'])
-        : null;
-    final range = json['range'] is bool
-        ? Either2<bool, SemanticTokensOptionsRange>.t1(json['range'])
-        : (SemanticTokensOptionsRange.canParse(
-                json['range'], nullLspJsonReporter)
-            ? Either2<bool, SemanticTokensOptionsRange>.t2(json['range'] != null
-                ? SemanticTokensOptionsRange.fromJson(json['range'])
-                : null)
-            : (json['range'] == null
-                ? null
+    final legend = SemanticTokensLegend.fromJson(json['legend']);
+    final range = json['range'] == null
+        ? null
+        : (json['range'] is bool
+            ? Either2<bool, SemanticTokensOptionsRange>.t1(json['range'])
+            : (SemanticTokensOptionsRange.canParse(
+                    json['range'], nullLspJsonReporter)
+                ? Either2<bool, SemanticTokensOptionsRange>.t2(
+                    SemanticTokensOptionsRange.fromJson(json['range']))
                 : (throw '''${json['range']} was not one of (bool, SemanticTokensOptionsRange)''')));
-    final full = json['full'] is bool
-        ? Either2<bool, SemanticTokensOptionsFull>.t1(json['full'])
-        : (SemanticTokensOptionsFull.canParse(json['full'], nullLspJsonReporter)
-            ? Either2<bool, SemanticTokensOptionsFull>.t2(json['full'] != null
-                ? SemanticTokensOptionsFull.fromJson(json['full'])
-                : null)
-            : (json['full'] == null
-                ? null
+    final full = json['full'] == null
+        ? null
+        : (json['full'] is bool
+            ? Either2<bool, SemanticTokensOptionsFull>.t1(json['full'])
+            : (SemanticTokensOptionsFull.canParse(
+                    json['full'], nullLspJsonReporter)
+                ? Either2<bool, SemanticTokensOptionsFull>.t2(
+                    SemanticTokensOptionsFull.fromJson(json['full']))
                 : (throw '''${json['full']} was not one of (bool, SemanticTokensOptionsFull)''')));
     final workDoneProgress = json['workDoneProgress'];
     return SemanticTokensOptions(
@@ -25088,20 +23927,19 @@
   }
 
   /// Server supports providing semantic tokens for a full document.
-  final Either2<bool, SemanticTokensOptionsFull> full;
+  final Either2<bool, SemanticTokensOptionsFull>? full;
 
   /// The legend used by the server
   final SemanticTokensLegend legend;
 
   /// Server supports providing semantic tokens for a specific range of a
   /// document.
-  final Either2<bool, SemanticTokensOptionsRange> range;
-  final bool workDoneProgress;
+  final Either2<bool, SemanticTokensOptionsRange>? range;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['legend'] =
-        legend?.toJson() ?? (throw 'legend is required but was not set');
+    __result['legend'] = legend.toJson();
     if (range != null) {
       __result['range'] = range;
     }
@@ -25212,7 +24050,7 @@
   }
 
   /// The server supports deltas for full documents.
-  final bool delta;
+  final bool? delta;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -25307,30 +24145,24 @@
       SemanticTokensParams.canParse, SemanticTokensParams.fromJson);
 
   SemanticTokensParams(
-      {@required this.textDocument,
+      {required this.textDocument,
       this.workDoneToken,
-      this.partialResultToken}) {
-    if (textDocument == null) {
-      throw 'textDocument is required but was not provided';
-    }
-  }
+      this.partialResultToken});
   static SemanticTokensParams fromJson(Map<String, dynamic> json) {
-    final textDocument = json['textDocument'] != null
-        ? TextDocumentIdentifier.fromJson(json['textDocument'])
-        : null;
-    final workDoneToken = json['workDoneToken'] is num
-        ? Either2<num, String>.t1(json['workDoneToken'])
-        : (json['workDoneToken'] is String
-            ? Either2<num, String>.t2(json['workDoneToken'])
-            : (json['workDoneToken'] == null
-                ? null
+    final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
+    final workDoneToken = json['workDoneToken'] == null
+        ? null
+        : (json['workDoneToken'] is num
+            ? Either2<num, String>.t1(json['workDoneToken'])
+            : (json['workDoneToken'] is String
+                ? Either2<num, String>.t2(json['workDoneToken'])
                 : (throw '''${json['workDoneToken']} was not one of (num, String)''')));
-    final partialResultToken = json['partialResultToken'] is num
-        ? Either2<num, String>.t1(json['partialResultToken'])
-        : (json['partialResultToken'] is String
-            ? Either2<num, String>.t2(json['partialResultToken'])
-            : (json['partialResultToken'] == null
-                ? null
+    final partialResultToken = json['partialResultToken'] == null
+        ? null
+        : (json['partialResultToken'] is num
+            ? Either2<num, String>.t1(json['partialResultToken'])
+            : (json['partialResultToken'] is String
+                ? Either2<num, String>.t2(json['partialResultToken'])
                 : (throw '''${json['partialResultToken']} was not one of (num, String)''')));
     return SemanticTokensParams(
         textDocument: textDocument,
@@ -25340,18 +24172,17 @@
 
   /// An optional token that a server can use to report partial results (e.g.
   /// streaming) to the client.
-  final Either2<num, String> partialResultToken;
+  final Either2<num, String>? partialResultToken;
 
   /// The text document.
   final TextDocumentIdentifier textDocument;
 
   /// An optional token that a server can use to report work done progress.
-  final Either2<num, String> workDoneToken;
+  final Either2<num, String>? workDoneToken;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['textDocument'] = textDocument?.toJson() ??
-        (throw 'textDocument is required but was not set');
+    __result['textDocument'] = textDocument.toJson();
     if (workDoneToken != null) {
       __result['workDoneToken'] = workDoneToken;
     }
@@ -25439,11 +24270,7 @@
       SemanticTokensPartialResult.canParse,
       SemanticTokensPartialResult.fromJson);
 
-  SemanticTokensPartialResult({@required this.data}) {
-    if (data == null) {
-      throw 'data is required but was not provided';
-    }
-  }
+  SemanticTokensPartialResult({required this.data});
   static SemanticTokensPartialResult fromJson(Map<String, dynamic> json) {
     final data = json['data']?.map((item) => item)?.cast<num>()?.toList();
     return SemanticTokensPartialResult(data: data);
@@ -25453,7 +24280,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['data'] = data ?? (throw 'data is required but was not set');
+    __result['data'] = data;
     return __result;
   }
 
@@ -25510,35 +24337,26 @@
       SemanticTokensRangeParams.canParse, SemanticTokensRangeParams.fromJson);
 
   SemanticTokensRangeParams(
-      {@required this.textDocument,
-      @required this.range,
+      {required this.textDocument,
+      required this.range,
       this.workDoneToken,
-      this.partialResultToken}) {
-    if (textDocument == null) {
-      throw 'textDocument is required but was not provided';
-    }
-    if (range == null) {
-      throw 'range is required but was not provided';
-    }
-  }
+      this.partialResultToken});
   static SemanticTokensRangeParams fromJson(Map<String, dynamic> json) {
-    final textDocument = json['textDocument'] != null
-        ? TextDocumentIdentifier.fromJson(json['textDocument'])
-        : null;
-    final range = json['range'] != null ? Range.fromJson(json['range']) : null;
-    final workDoneToken = json['workDoneToken'] is num
-        ? Either2<num, String>.t1(json['workDoneToken'])
-        : (json['workDoneToken'] is String
-            ? Either2<num, String>.t2(json['workDoneToken'])
-            : (json['workDoneToken'] == null
-                ? null
+    final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
+    final range = Range.fromJson(json['range']);
+    final workDoneToken = json['workDoneToken'] == null
+        ? null
+        : (json['workDoneToken'] is num
+            ? Either2<num, String>.t1(json['workDoneToken'])
+            : (json['workDoneToken'] is String
+                ? Either2<num, String>.t2(json['workDoneToken'])
                 : (throw '''${json['workDoneToken']} was not one of (num, String)''')));
-    final partialResultToken = json['partialResultToken'] is num
-        ? Either2<num, String>.t1(json['partialResultToken'])
-        : (json['partialResultToken'] is String
-            ? Either2<num, String>.t2(json['partialResultToken'])
-            : (json['partialResultToken'] == null
-                ? null
+    final partialResultToken = json['partialResultToken'] == null
+        ? null
+        : (json['partialResultToken'] is num
+            ? Either2<num, String>.t1(json['partialResultToken'])
+            : (json['partialResultToken'] is String
+                ? Either2<num, String>.t2(json['partialResultToken'])
                 : (throw '''${json['partialResultToken']} was not one of (num, String)''')));
     return SemanticTokensRangeParams(
         textDocument: textDocument,
@@ -25549,7 +24367,7 @@
 
   /// An optional token that a server can use to report partial results (e.g.
   /// streaming) to the client.
-  final Either2<num, String> partialResultToken;
+  final Either2<num, String>? partialResultToken;
 
   /// The range the semantic tokens are requested for.
   final Range range;
@@ -25558,14 +24376,12 @@
   final TextDocumentIdentifier textDocument;
 
   /// An optional token that a server can use to report work done progress.
-  final Either2<num, String> workDoneToken;
+  final Either2<num, String>? workDoneToken;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['textDocument'] = textDocument?.toJson() ??
-        (throw 'textDocument is required but was not set');
-    __result['range'] =
-        range?.toJson() ?? (throw 'range is required but was not set');
+    __result['textDocument'] = textDocument.toJson();
+    __result['range'] = range.toJson();
     if (workDoneToken != null) {
       __result['workDoneToken'] = workDoneToken;
     }
@@ -25679,41 +24495,34 @@
 
   SemanticTokensRegistrationOptions(
       {this.documentSelector,
-      @required this.legend,
+      required this.legend,
       this.range,
       this.full,
       this.workDoneProgress,
-      this.id}) {
-    if (legend == null) {
-      throw 'legend is required but was not provided';
-    }
-  }
+      this.id});
   static SemanticTokensRegistrationOptions fromJson(Map<String, dynamic> json) {
     final documentSelector = json['documentSelector']
         ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null)
         ?.cast<DocumentFilter>()
         ?.toList();
-    final legend = json['legend'] != null
-        ? SemanticTokensLegend.fromJson(json['legend'])
-        : null;
-    final range = json['range'] is bool
-        ? Either2<bool, SemanticTokensOptionsRange>.t1(json['range'])
-        : (SemanticTokensOptionsRange.canParse(
-                json['range'], nullLspJsonReporter)
-            ? Either2<bool, SemanticTokensOptionsRange>.t2(json['range'] != null
-                ? SemanticTokensOptionsRange.fromJson(json['range'])
-                : null)
-            : (json['range'] == null
-                ? null
+    final legend = SemanticTokensLegend.fromJson(json['legend']);
+    final range = json['range'] == null
+        ? null
+        : (json['range'] is bool
+            ? Either2<bool, SemanticTokensOptionsRange>.t1(json['range'])
+            : (SemanticTokensOptionsRange.canParse(
+                    json['range'], nullLspJsonReporter)
+                ? Either2<bool, SemanticTokensOptionsRange>.t2(
+                    SemanticTokensOptionsRange.fromJson(json['range']))
                 : (throw '''${json['range']} was not one of (bool, SemanticTokensOptionsRange)''')));
-    final full = json['full'] is bool
-        ? Either2<bool, SemanticTokensOptionsFull>.t1(json['full'])
-        : (SemanticTokensOptionsFull.canParse(json['full'], nullLspJsonReporter)
-            ? Either2<bool, SemanticTokensOptionsFull>.t2(json['full'] != null
-                ? SemanticTokensOptionsFull.fromJson(json['full'])
-                : null)
-            : (json['full'] == null
-                ? null
+    final full = json['full'] == null
+        ? null
+        : (json['full'] is bool
+            ? Either2<bool, SemanticTokensOptionsFull>.t1(json['full'])
+            : (SemanticTokensOptionsFull.canParse(
+                    json['full'], nullLspJsonReporter)
+                ? Either2<bool, SemanticTokensOptionsFull>.t2(
+                    SemanticTokensOptionsFull.fromJson(json['full']))
                 : (throw '''${json['full']} was not one of (bool, SemanticTokensOptionsFull)''')));
     final workDoneProgress = json['workDoneProgress'];
     final id = json['id'];
@@ -25728,28 +24537,27 @@
 
   /// A document selector to identify the scope of the registration. If set to
   /// null the document selector provided on the client side will be used.
-  final List<DocumentFilter> documentSelector;
+  final List<DocumentFilter>? documentSelector;
 
   /// Server supports providing semantic tokens for a full document.
-  final Either2<bool, SemanticTokensOptionsFull> full;
+  final Either2<bool, SemanticTokensOptionsFull>? full;
 
   /// The id used to register the request. The id can be used to deregister the
   /// request again. See also Registration#id.
-  final String id;
+  final String? id;
 
   /// The legend used by the server
   final SemanticTokensLegend legend;
 
   /// Server supports providing semantic tokens for a specific range of a
   /// document.
-  final Either2<bool, SemanticTokensOptionsRange> range;
-  final bool workDoneProgress;
+  final Either2<bool, SemanticTokensOptionsRange>? range;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
     __result['documentSelector'] = documentSelector;
-    __result['legend'] =
-        legend?.toJson() ?? (throw 'legend is required but was not set');
+    __result['legend'] = legend.toJson();
     if (range != null) {
       __result['range'] = range;
     }
@@ -25902,7 +24710,7 @@
   /// semantic tokens currently shown. It should be used with absolute care and
   /// is useful for situation where a server for example detect a project wide
   /// change that requires such a calculation.
-  final bool refreshSupport;
+  final bool? refreshSupport;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -25986,149 +24794,126 @@
       this.workspace,
       this.experimental});
   static ServerCapabilities fromJson(Map<String, dynamic> json) {
-    final textDocumentSync = TextDocumentSyncOptions.canParse(
-            json['textDocumentSync'], nullLspJsonReporter)
-        ? Either2<TextDocumentSyncOptions, TextDocumentSyncKind>.t1(
-            json['textDocumentSync'] != null
-                ? TextDocumentSyncOptions.fromJson(json['textDocumentSync'])
-                : null)
-        : (TextDocumentSyncKind.canParse(
+    final textDocumentSync = json['textDocumentSync'] == null
+        ? null
+        : (TextDocumentSyncOptions.canParse(
                 json['textDocumentSync'], nullLspJsonReporter)
-            ? Either2<TextDocumentSyncOptions, TextDocumentSyncKind>.t2(
-                json['textDocumentSync'] != null
-                    ? TextDocumentSyncKind.fromJson(json['textDocumentSync'])
-                    : null)
-            : (json['textDocumentSync'] == null
-                ? null
+            ? Either2<TextDocumentSyncOptions, TextDocumentSyncKind>.t1(
+                TextDocumentSyncOptions.fromJson(json['textDocumentSync']))
+            : (TextDocumentSyncKind.canParse(
+                    json['textDocumentSync'], nullLspJsonReporter)
+                ? Either2<TextDocumentSyncOptions, TextDocumentSyncKind>.t2(
+                    TextDocumentSyncKind.fromJson(json['textDocumentSync']))
                 : (throw '''${json['textDocumentSync']} was not one of (TextDocumentSyncOptions, TextDocumentSyncKind)''')));
     final completionProvider = json['completionProvider'] != null
         ? CompletionOptions.fromJson(json['completionProvider'])
         : null;
-    final hoverProvider = json['hoverProvider'] is bool
-        ? Either2<bool, HoverOptions>.t1(json['hoverProvider'])
-        : (HoverOptions.canParse(json['hoverProvider'], nullLspJsonReporter)
-            ? Either2<bool, HoverOptions>.t2(json['hoverProvider'] != null
-                ? HoverOptions.fromJson(json['hoverProvider'])
-                : null)
-            : (json['hoverProvider'] == null
-                ? null
+    final hoverProvider = json['hoverProvider'] == null
+        ? null
+        : (json['hoverProvider'] is bool
+            ? Either2<bool, HoverOptions>.t1(json['hoverProvider'])
+            : (HoverOptions.canParse(json['hoverProvider'], nullLspJsonReporter)
+                ? Either2<bool, HoverOptions>.t2(
+                    HoverOptions.fromJson(json['hoverProvider']))
                 : (throw '''${json['hoverProvider']} was not one of (bool, HoverOptions)''')));
     final signatureHelpProvider = json['signatureHelpProvider'] != null
         ? SignatureHelpOptions.fromJson(json['signatureHelpProvider'])
         : null;
-    final declarationProvider = json['declarationProvider'] is bool
-        ? Either3<bool, DeclarationOptions, DeclarationRegistrationOptions>.t1(
-            json['declarationProvider'])
-        : (DeclarationOptions.canParse(
-                json['declarationProvider'], nullLspJsonReporter)
-            ? Either3<bool, DeclarationOptions, DeclarationRegistrationOptions>.t2(
-                json['declarationProvider'] != null
-                    ? DeclarationOptions.fromJson(json['declarationProvider'])
-                    : null)
-            : (DeclarationRegistrationOptions.canParse(
+    final declarationProvider = json['declarationProvider'] == null
+        ? null
+        : (json['declarationProvider'] is bool
+            ? Either3<bool, DeclarationOptions,
+                DeclarationRegistrationOptions>.t1(json['declarationProvider'])
+            : (DeclarationOptions.canParse(
                     json['declarationProvider'], nullLspJsonReporter)
-                ? Either3<bool, DeclarationOptions, DeclarationRegistrationOptions>.t3(
-                    json['declarationProvider'] != null
-                        ? DeclarationRegistrationOptions.fromJson(
-                            json['declarationProvider'])
-                        : null)
-                : (json['declarationProvider'] == null
-                    ? null
+                ? Either3<bool, DeclarationOptions, DeclarationRegistrationOptions>.t2(
+                    DeclarationOptions.fromJson(json['declarationProvider']))
+                : (DeclarationRegistrationOptions.canParse(
+                        json['declarationProvider'], nullLspJsonReporter)
+                    ? Either3<bool, DeclarationOptions, DeclarationRegistrationOptions>.t3(
+                        DeclarationRegistrationOptions.fromJson(
+                            json['declarationProvider']))
                     : (throw '''${json['declarationProvider']} was not one of (bool, DeclarationOptions, DeclarationRegistrationOptions)'''))));
-    final definitionProvider = json['definitionProvider'] is bool
-        ? Either2<bool, DefinitionOptions>.t1(json['definitionProvider'])
-        : (DefinitionOptions.canParse(
-                json['definitionProvider'], nullLspJsonReporter)
-            ? Either2<bool, DefinitionOptions>.t2(
-                json['definitionProvider'] != null
-                    ? DefinitionOptions.fromJson(json['definitionProvider'])
-                    : null)
-            : (json['definitionProvider'] == null
-                ? null
+    final definitionProvider = json['definitionProvider'] == null
+        ? null
+        : (json['definitionProvider'] is bool
+            ? Either2<bool, DefinitionOptions>.t1(json['definitionProvider'])
+            : (DefinitionOptions.canParse(
+                    json['definitionProvider'], nullLspJsonReporter)
+                ? Either2<bool, DefinitionOptions>.t2(
+                    DefinitionOptions.fromJson(json['definitionProvider']))
                 : (throw '''${json['definitionProvider']} was not one of (bool, DefinitionOptions)''')));
-    final typeDefinitionProvider = json['typeDefinitionProvider'] is bool
-        ? Either3<bool, TypeDefinitionOptions, TypeDefinitionRegistrationOptions>.t1(
-            json['typeDefinitionProvider'])
-        : (TypeDefinitionOptions.canParse(
-                json['typeDefinitionProvider'], nullLspJsonReporter)
-            ? Either3<bool, TypeDefinitionOptions, TypeDefinitionRegistrationOptions>.t2(json['typeDefinitionProvider'] != null
-                ? TypeDefinitionOptions.fromJson(json['typeDefinitionProvider'])
-                : null)
-            : (TypeDefinitionRegistrationOptions.canParse(
+    final typeDefinitionProvider = json['typeDefinitionProvider'] == null
+        ? null
+        : (json['typeDefinitionProvider'] is bool
+            ? Either3<bool, TypeDefinitionOptions, TypeDefinitionRegistrationOptions>.t1(
+                json['typeDefinitionProvider'])
+            : (TypeDefinitionOptions.canParse(
                     json['typeDefinitionProvider'], nullLspJsonReporter)
-                ? Either3<bool, TypeDefinitionOptions, TypeDefinitionRegistrationOptions>.t3(
-                    json['typeDefinitionProvider'] != null
-                        ? TypeDefinitionRegistrationOptions.fromJson(
-                            json['typeDefinitionProvider'])
-                        : null)
-                : (json['typeDefinitionProvider'] == null
-                    ? null
+                ? Either3<bool, TypeDefinitionOptions, TypeDefinitionRegistrationOptions>.t2(
+                    TypeDefinitionOptions.fromJson(
+                        json['typeDefinitionProvider']))
+                : (TypeDefinitionRegistrationOptions.canParse(
+                        json['typeDefinitionProvider'], nullLspJsonReporter)
+                    ? Either3<bool, TypeDefinitionOptions, TypeDefinitionRegistrationOptions>.t3(
+                        TypeDefinitionRegistrationOptions.fromJson(
+                            json['typeDefinitionProvider']))
                     : (throw '''${json['typeDefinitionProvider']} was not one of (bool, TypeDefinitionOptions, TypeDefinitionRegistrationOptions)'''))));
-    final implementationProvider = json['implementationProvider'] is bool
-        ? Either3<bool, ImplementationOptions, ImplementationRegistrationOptions>.t1(
-            json['implementationProvider'])
-        : (ImplementationOptions.canParse(
-                json['implementationProvider'], nullLspJsonReporter)
-            ? Either3<bool, ImplementationOptions, ImplementationRegistrationOptions>.t2(json['implementationProvider'] != null
-                ? ImplementationOptions.fromJson(json['implementationProvider'])
-                : null)
-            : (ImplementationRegistrationOptions.canParse(
+    final implementationProvider = json['implementationProvider'] == null
+        ? null
+        : (json['implementationProvider'] is bool
+            ? Either3<bool, ImplementationOptions, ImplementationRegistrationOptions>.t1(
+                json['implementationProvider'])
+            : (ImplementationOptions.canParse(
                     json['implementationProvider'], nullLspJsonReporter)
-                ? Either3<bool, ImplementationOptions, ImplementationRegistrationOptions>.t3(
-                    json['implementationProvider'] != null
-                        ? ImplementationRegistrationOptions.fromJson(
-                            json['implementationProvider'])
-                        : null)
-                : (json['implementationProvider'] == null
-                    ? null
+                ? Either3<bool, ImplementationOptions, ImplementationRegistrationOptions>.t2(
+                    ImplementationOptions.fromJson(
+                        json['implementationProvider']))
+                : (ImplementationRegistrationOptions.canParse(
+                        json['implementationProvider'], nullLspJsonReporter)
+                    ? Either3<bool, ImplementationOptions, ImplementationRegistrationOptions>.t3(
+                        ImplementationRegistrationOptions.fromJson(
+                            json['implementationProvider']))
                     : (throw '''${json['implementationProvider']} was not one of (bool, ImplementationOptions, ImplementationRegistrationOptions)'''))));
-    final referencesProvider = json['referencesProvider'] is bool
-        ? Either2<bool, ReferenceOptions>.t1(json['referencesProvider'])
-        : (ReferenceOptions.canParse(
-                json['referencesProvider'], nullLspJsonReporter)
-            ? Either2<bool, ReferenceOptions>.t2(
-                json['referencesProvider'] != null
-                    ? ReferenceOptions.fromJson(json['referencesProvider'])
-                    : null)
-            : (json['referencesProvider'] == null
-                ? null
+    final referencesProvider = json['referencesProvider'] == null
+        ? null
+        : (json['referencesProvider'] is bool
+            ? Either2<bool, ReferenceOptions>.t1(json['referencesProvider'])
+            : (ReferenceOptions.canParse(
+                    json['referencesProvider'], nullLspJsonReporter)
+                ? Either2<bool, ReferenceOptions>.t2(
+                    ReferenceOptions.fromJson(json['referencesProvider']))
                 : (throw '''${json['referencesProvider']} was not one of (bool, ReferenceOptions)''')));
-    final documentHighlightProvider = json['documentHighlightProvider'] is bool
-        ? Either2<bool, DocumentHighlightOptions>.t1(
-            json['documentHighlightProvider'])
-        : (DocumentHighlightOptions.canParse(
-                json['documentHighlightProvider'], nullLspJsonReporter)
-            ? Either2<bool, DocumentHighlightOptions>.t2(
-                json['documentHighlightProvider'] != null
-                    ? DocumentHighlightOptions.fromJson(
-                        json['documentHighlightProvider'])
-                    : null)
-            : (json['documentHighlightProvider'] == null
-                ? null
+    final documentHighlightProvider = json['documentHighlightProvider'] == null
+        ? null
+        : (json['documentHighlightProvider'] is bool
+            ? Either2<bool, DocumentHighlightOptions>.t1(
+                json['documentHighlightProvider'])
+            : (DocumentHighlightOptions.canParse(
+                    json['documentHighlightProvider'], nullLspJsonReporter)
+                ? Either2<bool, DocumentHighlightOptions>.t2(
+                    DocumentHighlightOptions.fromJson(
+                        json['documentHighlightProvider']))
                 : (throw '''${json['documentHighlightProvider']} was not one of (bool, DocumentHighlightOptions)''')));
-    final documentSymbolProvider = json['documentSymbolProvider'] is bool
-        ? Either2<bool, DocumentSymbolOptions>.t1(
-            json['documentSymbolProvider'])
-        : (DocumentSymbolOptions.canParse(
-                json['documentSymbolProvider'], nullLspJsonReporter)
-            ? Either2<bool, DocumentSymbolOptions>.t2(
-                json['documentSymbolProvider'] != null
-                    ? DocumentSymbolOptions.fromJson(
-                        json['documentSymbolProvider'])
-                    : null)
-            : (json['documentSymbolProvider'] == null
-                ? null
+    final documentSymbolProvider = json['documentSymbolProvider'] == null
+        ? null
+        : (json['documentSymbolProvider'] is bool
+            ? Either2<bool, DocumentSymbolOptions>.t1(
+                json['documentSymbolProvider'])
+            : (DocumentSymbolOptions.canParse(
+                    json['documentSymbolProvider'], nullLspJsonReporter)
+                ? Either2<bool, DocumentSymbolOptions>.t2(
+                    DocumentSymbolOptions.fromJson(
+                        json['documentSymbolProvider']))
                 : (throw '''${json['documentSymbolProvider']} was not one of (bool, DocumentSymbolOptions)''')));
-    final codeActionProvider = json['codeActionProvider'] is bool
-        ? Either2<bool, CodeActionOptions>.t1(json['codeActionProvider'])
-        : (CodeActionOptions.canParse(
-                json['codeActionProvider'], nullLspJsonReporter)
-            ? Either2<bool, CodeActionOptions>.t2(
-                json['codeActionProvider'] != null
-                    ? CodeActionOptions.fromJson(json['codeActionProvider'])
-                    : null)
-            : (json['codeActionProvider'] == null
-                ? null
+    final codeActionProvider = json['codeActionProvider'] == null
+        ? null
+        : (json['codeActionProvider'] is bool
+            ? Either2<bool, CodeActionOptions>.t1(json['codeActionProvider'])
+            : (CodeActionOptions.canParse(
+                    json['codeActionProvider'], nullLspJsonReporter)
+                ? Either2<bool, CodeActionOptions>.t2(
+                    CodeActionOptions.fromJson(json['codeActionProvider']))
                 : (throw '''${json['codeActionProvider']} was not one of (bool, CodeActionOptions)''')));
     final codeLensProvider = json['codeLensProvider'] != null
         ? CodeLensOptions.fromJson(json['codeLensProvider'])
@@ -26136,190 +24921,166 @@
     final documentLinkProvider = json['documentLinkProvider'] != null
         ? DocumentLinkOptions.fromJson(json['documentLinkProvider'])
         : null;
-    final colorProvider = json['colorProvider'] is bool
-        ? Either3<bool, DocumentColorOptions, DocumentColorRegistrationOptions>.t1(
-            json['colorProvider'])
-        : (DocumentColorOptions.canParse(
-                json['colorProvider'], nullLspJsonReporter)
-            ? Either3<bool, DocumentColorOptions, DocumentColorRegistrationOptions>.t2(
-                json['colorProvider'] != null
-                    ? DocumentColorOptions.fromJson(json['colorProvider'])
-                    : null)
-            : (DocumentColorRegistrationOptions.canParse(
-                    json['colorProvider'], nullLspJsonReporter)
-                ? Either3<bool, DocumentColorOptions, DocumentColorRegistrationOptions>.t3(
-                    json['colorProvider'] != null
-                        ? DocumentColorRegistrationOptions.fromJson(
-                            json['colorProvider'])
-                        : null)
-                : (json['colorProvider'] == null
-                    ? null
+    final colorProvider = json['colorProvider'] == null
+        ? null
+        : (json['colorProvider'] is bool
+            ? Either3<bool, DocumentColorOptions, DocumentColorRegistrationOptions>.t1(
+                json['colorProvider'])
+            : (DocumentColorOptions.canParse(json['colorProvider'], nullLspJsonReporter)
+                ? Either3<bool, DocumentColorOptions, DocumentColorRegistrationOptions>.t2(
+                    DocumentColorOptions.fromJson(json['colorProvider']))
+                : (DocumentColorRegistrationOptions.canParse(
+                        json['colorProvider'], nullLspJsonReporter)
+                    ? Either3<bool, DocumentColorOptions,
+                            DocumentColorRegistrationOptions>.t3(
+                        DocumentColorRegistrationOptions.fromJson(
+                            json['colorProvider']))
                     : (throw '''${json['colorProvider']} was not one of (bool, DocumentColorOptions, DocumentColorRegistrationOptions)'''))));
-    final documentFormattingProvider = json['documentFormattingProvider']
-            is bool
-        ? Either2<bool, DocumentFormattingOptions>.t1(
-            json['documentFormattingProvider'])
-        : (DocumentFormattingOptions.canParse(
-                json['documentFormattingProvider'], nullLspJsonReporter)
-            ? Either2<bool, DocumentFormattingOptions>.t2(
-                json['documentFormattingProvider'] != null
-                    ? DocumentFormattingOptions.fromJson(
-                        json['documentFormattingProvider'])
-                    : null)
-            : (json['documentFormattingProvider'] == null
-                ? null
+    final documentFormattingProvider = json['documentFormattingProvider'] ==
+            null
+        ? null
+        : (json['documentFormattingProvider'] is bool
+            ? Either2<bool, DocumentFormattingOptions>.t1(
+                json['documentFormattingProvider'])
+            : (DocumentFormattingOptions.canParse(
+                    json['documentFormattingProvider'], nullLspJsonReporter)
+                ? Either2<bool, DocumentFormattingOptions>.t2(
+                    DocumentFormattingOptions.fromJson(
+                        json['documentFormattingProvider']))
                 : (throw '''${json['documentFormattingProvider']} was not one of (bool, DocumentFormattingOptions)''')));
     final documentRangeFormattingProvider = json[
-            'documentRangeFormattingProvider'] is bool
-        ? Either2<bool, DocumentRangeFormattingOptions>.t1(
-            json['documentRangeFormattingProvider'])
-        : (DocumentRangeFormattingOptions.canParse(
-                json['documentRangeFormattingProvider'], nullLspJsonReporter)
-            ? Either2<bool, DocumentRangeFormattingOptions>.t2(
-                json['documentRangeFormattingProvider'] != null
-                    ? DocumentRangeFormattingOptions.fromJson(
-                        json['documentRangeFormattingProvider'])
-                    : null)
-            : (json['documentRangeFormattingProvider'] == null
-                ? null
+                'documentRangeFormattingProvider'] ==
+            null
+        ? null
+        : (json['documentRangeFormattingProvider'] is bool
+            ? Either2<bool, DocumentRangeFormattingOptions>.t1(
+                json['documentRangeFormattingProvider'])
+            : (DocumentRangeFormattingOptions.canParse(
+                    json['documentRangeFormattingProvider'],
+                    nullLspJsonReporter)
+                ? Either2<bool, DocumentRangeFormattingOptions>.t2(
+                    DocumentRangeFormattingOptions.fromJson(
+                        json['documentRangeFormattingProvider']))
                 : (throw '''${json['documentRangeFormattingProvider']} was not one of (bool, DocumentRangeFormattingOptions)''')));
     final documentOnTypeFormattingProvider =
         json['documentOnTypeFormattingProvider'] != null
             ? DocumentOnTypeFormattingOptions.fromJson(
                 json['documentOnTypeFormattingProvider'])
             : null;
-    final renameProvider = json['renameProvider'] is bool
-        ? Either2<bool, RenameOptions>.t1(json['renameProvider'])
-        : (RenameOptions.canParse(json['renameProvider'], nullLspJsonReporter)
-            ? Either2<bool, RenameOptions>.t2(json['renameProvider'] != null
-                ? RenameOptions.fromJson(json['renameProvider'])
-                : null)
-            : (json['renameProvider'] == null
-                ? null
+    final renameProvider = json['renameProvider'] == null
+        ? null
+        : (json['renameProvider'] is bool
+            ? Either2<bool, RenameOptions>.t1(json['renameProvider'])
+            : (RenameOptions.canParse(
+                    json['renameProvider'], nullLspJsonReporter)
+                ? Either2<bool, RenameOptions>.t2(
+                    RenameOptions.fromJson(json['renameProvider']))
                 : (throw '''${json['renameProvider']} was not one of (bool, RenameOptions)''')));
-    final foldingRangeProvider = json['foldingRangeProvider'] is bool
-        ? Either3<bool, FoldingRangeOptions, FoldingRangeRegistrationOptions>.t1(
-            json['foldingRangeProvider'])
-        : (FoldingRangeOptions.canParse(
-                json['foldingRangeProvider'], nullLspJsonReporter)
-            ? Either3<bool, FoldingRangeOptions, FoldingRangeRegistrationOptions>.t2(
-                json['foldingRangeProvider'] != null
-                    ? FoldingRangeOptions.fromJson(json['foldingRangeProvider'])
-                    : null)
-            : (FoldingRangeRegistrationOptions.canParse(
+    final foldingRangeProvider = json['foldingRangeProvider'] == null
+        ? null
+        : (json['foldingRangeProvider'] is bool
+            ? Either3<bool, FoldingRangeOptions, FoldingRangeRegistrationOptions>.t1(
+                json['foldingRangeProvider'])
+            : (FoldingRangeOptions.canParse(
                     json['foldingRangeProvider'], nullLspJsonReporter)
-                ? Either3<bool, FoldingRangeOptions, FoldingRangeRegistrationOptions>.t3(
-                    json['foldingRangeProvider'] != null
-                        ? FoldingRangeRegistrationOptions.fromJson(
-                            json['foldingRangeProvider'])
-                        : null)
-                : (json['foldingRangeProvider'] == null
-                    ? null
+                ? Either3<bool, FoldingRangeOptions, FoldingRangeRegistrationOptions>.t2(
+                    FoldingRangeOptions.fromJson(json['foldingRangeProvider']))
+                : (FoldingRangeRegistrationOptions.canParse(
+                        json['foldingRangeProvider'], nullLspJsonReporter)
+                    ? Either3<bool, FoldingRangeOptions, FoldingRangeRegistrationOptions>.t3(
+                        FoldingRangeRegistrationOptions.fromJson(
+                            json['foldingRangeProvider']))
                     : (throw '''${json['foldingRangeProvider']} was not one of (bool, FoldingRangeOptions, FoldingRangeRegistrationOptions)'''))));
     final executeCommandProvider = json['executeCommandProvider'] != null
         ? ExecuteCommandOptions.fromJson(json['executeCommandProvider'])
         : null;
-    final selectionRangeProvider = json['selectionRangeProvider'] is bool
-        ? Either3<bool, SelectionRangeOptions, SelectionRangeRegistrationOptions>.t1(
-            json['selectionRangeProvider'])
-        : (SelectionRangeOptions.canParse(
-                json['selectionRangeProvider'], nullLspJsonReporter)
-            ? Either3<bool, SelectionRangeOptions, SelectionRangeRegistrationOptions>.t2(json['selectionRangeProvider'] != null
-                ? SelectionRangeOptions.fromJson(json['selectionRangeProvider'])
-                : null)
-            : (SelectionRangeRegistrationOptions.canParse(
+    final selectionRangeProvider = json['selectionRangeProvider'] == null
+        ? null
+        : (json['selectionRangeProvider'] is bool
+            ? Either3<bool, SelectionRangeOptions, SelectionRangeRegistrationOptions>.t1(
+                json['selectionRangeProvider'])
+            : (SelectionRangeOptions.canParse(
                     json['selectionRangeProvider'], nullLspJsonReporter)
-                ? Either3<bool, SelectionRangeOptions, SelectionRangeRegistrationOptions>.t3(
-                    json['selectionRangeProvider'] != null
-                        ? SelectionRangeRegistrationOptions.fromJson(
-                            json['selectionRangeProvider'])
-                        : null)
-                : (json['selectionRangeProvider'] == null
-                    ? null
+                ? Either3<bool, SelectionRangeOptions, SelectionRangeRegistrationOptions>.t2(
+                    SelectionRangeOptions.fromJson(
+                        json['selectionRangeProvider']))
+                : (SelectionRangeRegistrationOptions.canParse(
+                        json['selectionRangeProvider'], nullLspJsonReporter)
+                    ? Either3<bool, SelectionRangeOptions, SelectionRangeRegistrationOptions>.t3(
+                        SelectionRangeRegistrationOptions.fromJson(
+                            json['selectionRangeProvider']))
                     : (throw '''${json['selectionRangeProvider']} was not one of (bool, SelectionRangeOptions, SelectionRangeRegistrationOptions)'''))));
-    final linkedEditingRangeProvider = json['linkedEditingRangeProvider']
-            is bool
-        ? Either3<bool, LinkedEditingRangeOptions, LinkedEditingRangeRegistrationOptions>.t1(
-            json['linkedEditingRangeProvider'])
-        : (LinkedEditingRangeOptions.canParse(json['linkedEditingRangeProvider'], nullLspJsonReporter)
-            ? Either3<bool, LinkedEditingRangeOptions, LinkedEditingRangeRegistrationOptions>.t2(
-                json['linkedEditingRangeProvider'] != null
-                    ? LinkedEditingRangeOptions.fromJson(
-                        json['linkedEditingRangeProvider'])
-                    : null)
-            : (LinkedEditingRangeRegistrationOptions.canParse(json['linkedEditingRangeProvider'], nullLspJsonReporter)
-                ? Either3<bool, LinkedEditingRangeOptions, LinkedEditingRangeRegistrationOptions>.t3(
-                    json['linkedEditingRangeProvider'] != null
-                        ? LinkedEditingRangeRegistrationOptions.fromJson(
-                            json['linkedEditingRangeProvider'])
-                        : null)
-                : (json['linkedEditingRangeProvider'] == null
-                    ? null
+    final linkedEditingRangeProvider = json['linkedEditingRangeProvider'] == null
+        ? null
+        : (json['linkedEditingRangeProvider'] is bool
+            ? Either3<bool, LinkedEditingRangeOptions, LinkedEditingRangeRegistrationOptions>.t1(
+                json['linkedEditingRangeProvider'])
+            : (LinkedEditingRangeOptions.canParse(
+                    json['linkedEditingRangeProvider'], nullLspJsonReporter)
+                ? Either3<bool, LinkedEditingRangeOptions, LinkedEditingRangeRegistrationOptions>.t2(
+                    LinkedEditingRangeOptions.fromJson(
+                        json['linkedEditingRangeProvider']))
+                : (LinkedEditingRangeRegistrationOptions.canParse(
+                        json['linkedEditingRangeProvider'], nullLspJsonReporter)
+                    ? Either3<bool, LinkedEditingRangeOptions, LinkedEditingRangeRegistrationOptions>.t3(
+                        LinkedEditingRangeRegistrationOptions.fromJson(
+                            json['linkedEditingRangeProvider']))
                     : (throw '''${json['linkedEditingRangeProvider']} was not one of (bool, LinkedEditingRangeOptions, LinkedEditingRangeRegistrationOptions)'''))));
-    final callHierarchyProvider = json['callHierarchyProvider'] is bool
-        ? Either3<bool, CallHierarchyOptions, CallHierarchyRegistrationOptions>.t1(
-            json['callHierarchyProvider'])
-        : (CallHierarchyOptions.canParse(
-                json['callHierarchyProvider'], nullLspJsonReporter)
-            ? Either3<bool, CallHierarchyOptions, CallHierarchyRegistrationOptions>.t2(json['callHierarchyProvider'] != null
-                ? CallHierarchyOptions.fromJson(json['callHierarchyProvider'])
-                : null)
-            : (CallHierarchyRegistrationOptions.canParse(
+    final callHierarchyProvider = json['callHierarchyProvider'] == null
+        ? null
+        : (json['callHierarchyProvider'] is bool
+            ? Either3<bool, CallHierarchyOptions, CallHierarchyRegistrationOptions>.t1(
+                json['callHierarchyProvider'])
+            : (CallHierarchyOptions.canParse(
                     json['callHierarchyProvider'], nullLspJsonReporter)
-                ? Either3<bool, CallHierarchyOptions, CallHierarchyRegistrationOptions>.t3(
-                    json['callHierarchyProvider'] != null
-                        ? CallHierarchyRegistrationOptions.fromJson(
-                            json['callHierarchyProvider'])
-                        : null)
-                : (json['callHierarchyProvider'] == null
-                    ? null
+                ? Either3<bool, CallHierarchyOptions, CallHierarchyRegistrationOptions>.t2(
+                    CallHierarchyOptions.fromJson(
+                        json['callHierarchyProvider']))
+                : (CallHierarchyRegistrationOptions.canParse(
+                        json['callHierarchyProvider'], nullLspJsonReporter)
+                    ? Either3<bool, CallHierarchyOptions, CallHierarchyRegistrationOptions>.t3(
+                        CallHierarchyRegistrationOptions.fromJson(
+                            json['callHierarchyProvider']))
                     : (throw '''${json['callHierarchyProvider']} was not one of (bool, CallHierarchyOptions, CallHierarchyRegistrationOptions)'''))));
-    final semanticTokensProvider = SemanticTokensOptions.canParse(
-            json['semanticTokensProvider'], nullLspJsonReporter)
-        ? Either2<SemanticTokensOptions, SemanticTokensRegistrationOptions>.t1(
-            json['semanticTokensProvider'] != null
-                ? SemanticTokensOptions.fromJson(json['semanticTokensProvider'])
-                : null)
-        : (SemanticTokensRegistrationOptions.canParse(
+    final semanticTokensProvider = json['semanticTokensProvider'] == null
+        ? null
+        : (SemanticTokensOptions.canParse(
                 json['semanticTokensProvider'], nullLspJsonReporter)
-            ? Either2<SemanticTokensOptions, SemanticTokensRegistrationOptions>.t2(
-                json['semanticTokensProvider'] != null
-                    ? SemanticTokensRegistrationOptions.fromJson(
-                        json['semanticTokensProvider'])
-                    : null)
-            : (json['semanticTokensProvider'] == null
-                ? null
+            ? Either2<SemanticTokensOptions, SemanticTokensRegistrationOptions>.t1(
+                SemanticTokensOptions.fromJson(json['semanticTokensProvider']))
+            : (SemanticTokensRegistrationOptions.canParse(
+                    json['semanticTokensProvider'], nullLspJsonReporter)
+                ? Either2<SemanticTokensOptions,
+                        SemanticTokensRegistrationOptions>.t2(
+                    SemanticTokensRegistrationOptions.fromJson(
+                        json['semanticTokensProvider']))
                 : (throw '''${json['semanticTokensProvider']} was not one of (SemanticTokensOptions, SemanticTokensRegistrationOptions)''')));
-    final monikerProvider = json['monikerProvider'] is bool
-        ? Either3<bool, MonikerOptions, MonikerRegistrationOptions>.t1(
-            json['monikerProvider'])
-        : (MonikerOptions.canParse(json['monikerProvider'], nullLspJsonReporter)
-            ? Either3<bool, MonikerOptions, MonikerRegistrationOptions>.t2(
-                json['monikerProvider'] != null
-                    ? MonikerOptions.fromJson(json['monikerProvider'])
-                    : null)
-            : (MonikerRegistrationOptions.canParse(
+    final monikerProvider = json['monikerProvider'] == null
+        ? null
+        : (json['monikerProvider'] is bool
+            ? Either3<bool, MonikerOptions, MonikerRegistrationOptions>.t1(
+                json['monikerProvider'])
+            : (MonikerOptions.canParse(
                     json['monikerProvider'], nullLspJsonReporter)
-                ? Either3<bool, MonikerOptions, MonikerRegistrationOptions>.t3(
-                    json['monikerProvider'] != null
-                        ? MonikerRegistrationOptions.fromJson(
-                            json['monikerProvider'])
-                        : null)
-                : (json['monikerProvider'] == null
-                    ? null
+                ? Either3<bool, MonikerOptions, MonikerRegistrationOptions>.t2(
+                    MonikerOptions.fromJson(json['monikerProvider']))
+                : (MonikerRegistrationOptions.canParse(
+                        json['monikerProvider'], nullLspJsonReporter)
+                    ? Either3<bool, MonikerOptions,
+                            MonikerRegistrationOptions>.t3(
+                        MonikerRegistrationOptions.fromJson(
+                            json['monikerProvider']))
                     : (throw '''${json['monikerProvider']} was not one of (bool, MonikerOptions, MonikerRegistrationOptions)'''))));
-    final workspaceSymbolProvider = json['workspaceSymbolProvider'] is bool
-        ? Either2<bool, WorkspaceSymbolOptions>.t1(
-            json['workspaceSymbolProvider'])
-        : (WorkspaceSymbolOptions.canParse(
-                json['workspaceSymbolProvider'], nullLspJsonReporter)
-            ? Either2<bool, WorkspaceSymbolOptions>.t2(
-                json['workspaceSymbolProvider'] != null
-                    ? WorkspaceSymbolOptions.fromJson(
-                        json['workspaceSymbolProvider'])
-                    : null)
-            : (json['workspaceSymbolProvider'] == null
-                ? null
+    final workspaceSymbolProvider = json['workspaceSymbolProvider'] == null
+        ? null
+        : (json['workspaceSymbolProvider'] is bool
+            ? Either2<bool, WorkspaceSymbolOptions>.t1(
+                json['workspaceSymbolProvider'])
+            : (WorkspaceSymbolOptions.canParse(
+                    json['workspaceSymbolProvider'], nullLspJsonReporter)
+                ? Either2<bool, WorkspaceSymbolOptions>.t2(
+                    WorkspaceSymbolOptions.fromJson(
+                        json['workspaceSymbolProvider']))
                 : (throw '''${json['workspaceSymbolProvider']} was not one of (bool, WorkspaceSymbolOptions)''')));
     final workspace = json['workspace'] != null
         ? ServerCapabilitiesWorkspace.fromJson(json['workspace'])
@@ -26359,118 +25120,119 @@
 
   /// The server provides call hierarchy support.
   ///  @since 3.16.0
-  final Either3<bool, CallHierarchyOptions, CallHierarchyRegistrationOptions>
+  final Either3<bool, CallHierarchyOptions, CallHierarchyRegistrationOptions>?
       callHierarchyProvider;
 
   /// The server provides code actions. The `CodeActionOptions` return type is
   /// only valid if the client signals code action literal support via the
   /// property `textDocument.codeAction.codeActionLiteralSupport`.
-  final Either2<bool, CodeActionOptions> codeActionProvider;
+  final Either2<bool, CodeActionOptions>? codeActionProvider;
 
   /// The server provides code lens.
-  final CodeLensOptions codeLensProvider;
+  final CodeLensOptions? codeLensProvider;
 
   /// The server provides color provider support.
   ///  @since 3.6.0
-  final Either3<bool, DocumentColorOptions, DocumentColorRegistrationOptions>
+  final Either3<bool, DocumentColorOptions, DocumentColorRegistrationOptions>?
       colorProvider;
 
   /// The server provides completion support.
-  final CompletionOptions completionProvider;
+  final CompletionOptions? completionProvider;
 
   /// The server provides go to declaration support.
   ///  @since 3.14.0
-  final Either3<bool, DeclarationOptions, DeclarationRegistrationOptions>
+  final Either3<bool, DeclarationOptions, DeclarationRegistrationOptions>?
       declarationProvider;
 
   /// The server provides goto definition support.
-  final Either2<bool, DefinitionOptions> definitionProvider;
+  final Either2<bool, DefinitionOptions>? definitionProvider;
 
   /// The server provides document formatting.
-  final Either2<bool, DocumentFormattingOptions> documentFormattingProvider;
+  final Either2<bool, DocumentFormattingOptions>? documentFormattingProvider;
 
   /// The server provides document highlight support.
-  final Either2<bool, DocumentHighlightOptions> documentHighlightProvider;
+  final Either2<bool, DocumentHighlightOptions>? documentHighlightProvider;
 
   /// The server provides document link support.
-  final DocumentLinkOptions documentLinkProvider;
+  final DocumentLinkOptions? documentLinkProvider;
 
   /// The server provides document formatting on typing.
-  final DocumentOnTypeFormattingOptions documentOnTypeFormattingProvider;
+  final DocumentOnTypeFormattingOptions? documentOnTypeFormattingProvider;
 
   /// The server provides document range formatting.
-  final Either2<bool, DocumentRangeFormattingOptions>
+  final Either2<bool, DocumentRangeFormattingOptions>?
       documentRangeFormattingProvider;
 
   /// The server provides document symbol support.
-  final Either2<bool, DocumentSymbolOptions> documentSymbolProvider;
+  final Either2<bool, DocumentSymbolOptions>? documentSymbolProvider;
 
   /// The server provides execute command support.
-  final ExecuteCommandOptions executeCommandProvider;
+  final ExecuteCommandOptions? executeCommandProvider;
 
   /// Experimental server capabilities.
   final dynamic experimental;
 
   /// The server provides folding provider support.
   ///  @since 3.10.0
-  final Either3<bool, FoldingRangeOptions, FoldingRangeRegistrationOptions>
+  final Either3<bool, FoldingRangeOptions, FoldingRangeRegistrationOptions>?
       foldingRangeProvider;
 
   /// The server provides hover support.
-  final Either2<bool, HoverOptions> hoverProvider;
+  final Either2<bool, HoverOptions>? hoverProvider;
 
   /// The server provides goto implementation support.
   ///  @since 3.6.0
-  final Either3<bool, ImplementationOptions, ImplementationRegistrationOptions>
+  final Either3<bool, ImplementationOptions, ImplementationRegistrationOptions>?
       implementationProvider;
 
   /// The server provides linked editing range support.
   ///  @since 3.16.0
   final Either3<bool, LinkedEditingRangeOptions,
-      LinkedEditingRangeRegistrationOptions> linkedEditingRangeProvider;
+      LinkedEditingRangeRegistrationOptions>? linkedEditingRangeProvider;
 
   /// Whether server provides moniker support.
   ///  @since 3.16.0
-  final Either3<bool, MonikerOptions, MonikerRegistrationOptions>
+  final Either3<bool, MonikerOptions, MonikerRegistrationOptions>?
       monikerProvider;
 
   /// The server provides find references support.
-  final Either2<bool, ReferenceOptions> referencesProvider;
+  final Either2<bool, ReferenceOptions>? referencesProvider;
 
   /// The server provides rename support. RenameOptions may only be specified if
   /// the client states that it supports `prepareSupport` in its initial
   /// `initialize` request.
-  final Either2<bool, RenameOptions> renameProvider;
+  final Either2<bool, RenameOptions>? renameProvider;
 
   /// The server provides selection range support.
   ///  @since 3.15.0
-  final Either3<bool, SelectionRangeOptions, SelectionRangeRegistrationOptions>
+  final Either3<bool, SelectionRangeOptions, SelectionRangeRegistrationOptions>?
       selectionRangeProvider;
 
   /// The server provides semantic tokens support.
   ///  @since 3.16.0
-  final Either2<SemanticTokensOptions, SemanticTokensRegistrationOptions>
+  final Either2<SemanticTokensOptions, SemanticTokensRegistrationOptions>?
       semanticTokensProvider;
 
   /// The server provides signature help support.
-  final SignatureHelpOptions signatureHelpProvider;
+  final SignatureHelpOptions? signatureHelpProvider;
 
   /// Defines how text documents are synced. Is either a detailed structure
   /// defining each notification or for backwards compatibility the
   /// TextDocumentSyncKind number. If omitted it defaults to
   /// `TextDocumentSyncKind.None`.
-  final Either2<TextDocumentSyncOptions, TextDocumentSyncKind> textDocumentSync;
+  final Either2<TextDocumentSyncOptions, TextDocumentSyncKind>?
+      textDocumentSync;
 
   /// The server provides goto type definition support.
   ///  @since 3.6.0
-  final Either3<bool, TypeDefinitionOptions, TypeDefinitionRegistrationOptions>
+  final Either3<bool, TypeDefinitionOptions, TypeDefinitionRegistrationOptions>?
       typeDefinitionProvider;
 
   /// Workspace specific server capabilities
-  final ServerCapabilitiesWorkspace workspace;
+  final ServerCapabilitiesWorkspace? workspace;
 
   /// The server provides workspace symbol support.
-  final Either2<bool, WorkspaceSymbolOptions> workspaceSymbolProvider;
+  final Either2<bool, WorkspaceSymbolOptions>? workspaceSymbolProvider;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -26478,13 +25240,13 @@
       __result['textDocumentSync'] = textDocumentSync;
     }
     if (completionProvider != null) {
-      __result['completionProvider'] = completionProvider.toJson();
+      __result['completionProvider'] = completionProvider?.toJson();
     }
     if (hoverProvider != null) {
       __result['hoverProvider'] = hoverProvider;
     }
     if (signatureHelpProvider != null) {
-      __result['signatureHelpProvider'] = signatureHelpProvider.toJson();
+      __result['signatureHelpProvider'] = signatureHelpProvider?.toJson();
     }
     if (declarationProvider != null) {
       __result['declarationProvider'] = declarationProvider;
@@ -26511,10 +25273,10 @@
       __result['codeActionProvider'] = codeActionProvider;
     }
     if (codeLensProvider != null) {
-      __result['codeLensProvider'] = codeLensProvider.toJson();
+      __result['codeLensProvider'] = codeLensProvider?.toJson();
     }
     if (documentLinkProvider != null) {
-      __result['documentLinkProvider'] = documentLinkProvider.toJson();
+      __result['documentLinkProvider'] = documentLinkProvider?.toJson();
     }
     if (colorProvider != null) {
       __result['colorProvider'] = colorProvider;
@@ -26528,7 +25290,7 @@
     }
     if (documentOnTypeFormattingProvider != null) {
       __result['documentOnTypeFormattingProvider'] =
-          documentOnTypeFormattingProvider.toJson();
+          documentOnTypeFormattingProvider?.toJson();
     }
     if (renameProvider != null) {
       __result['renameProvider'] = renameProvider;
@@ -26537,7 +25299,7 @@
       __result['foldingRangeProvider'] = foldingRangeProvider;
     }
     if (executeCommandProvider != null) {
-      __result['executeCommandProvider'] = executeCommandProvider.toJson();
+      __result['executeCommandProvider'] = executeCommandProvider?.toJson();
     }
     if (selectionRangeProvider != null) {
       __result['selectionRangeProvider'] = selectionRangeProvider;
@@ -26558,7 +25320,7 @@
       __result['workspaceSymbolProvider'] = workspaceSymbolProvider;
     }
     if (workspace != null) {
-      __result['workspace'] = workspace.toJson();
+      __result['workspace'] = workspace?.toJson();
     }
     if (experimental != null) {
       __result['experimental'] = experimental;
@@ -26932,15 +25694,6 @@
       } finally {
         reporter.pop();
       }
-      reporter.push('experimental');
-      try {
-        if (obj['experimental'] != null && !(true)) {
-          reporter.reportError('must be of type dynamic');
-          return false;
-        }
-      } finally {
-        reporter.pop();
-      }
       return true;
     } else {
       reporter.reportError('must be of type ServerCapabilities');
@@ -27070,42 +25823,42 @@
   }
 
   /// The server is interested in receiving didCreateFiles notifications.
-  final FileOperationRegistrationOptions didCreate;
+  final FileOperationRegistrationOptions? didCreate;
 
   /// The server is interested in receiving didDeleteFiles file notifications.
-  final FileOperationRegistrationOptions didDelete;
+  final FileOperationRegistrationOptions? didDelete;
 
   /// The server is interested in receiving didRenameFiles notifications.
-  final FileOperationRegistrationOptions didRename;
+  final FileOperationRegistrationOptions? didRename;
 
   /// The server is interested in receiving willCreateFiles requests.
-  final FileOperationRegistrationOptions willCreate;
+  final FileOperationRegistrationOptions? willCreate;
 
   /// The server is interested in receiving willDeleteFiles file requests.
-  final FileOperationRegistrationOptions willDelete;
+  final FileOperationRegistrationOptions? willDelete;
 
   /// The server is interested in receiving willRenameFiles requests.
-  final FileOperationRegistrationOptions willRename;
+  final FileOperationRegistrationOptions? willRename;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
     if (didCreate != null) {
-      __result['didCreate'] = didCreate.toJson();
+      __result['didCreate'] = didCreate?.toJson();
     }
     if (willCreate != null) {
-      __result['willCreate'] = willCreate.toJson();
+      __result['willCreate'] = willCreate?.toJson();
     }
     if (didRename != null) {
-      __result['didRename'] = didRename.toJson();
+      __result['didRename'] = didRename?.toJson();
     }
     if (willRename != null) {
-      __result['willRename'] = willRename.toJson();
+      __result['willRename'] = willRename?.toJson();
     }
     if (didDelete != null) {
-      __result['didDelete'] = didDelete.toJson();
+      __result['didDelete'] = didDelete?.toJson();
     }
     if (willDelete != null) {
-      __result['willDelete'] = willDelete.toJson();
+      __result['willDelete'] = willDelete?.toJson();
     }
     return __result;
   }
@@ -27241,19 +25994,19 @@
 
   /// The server is interested in file notifications/requests.
   ///  @since 3.16.0
-  final ServerCapabilitiesFileOperations fileOperations;
+  final ServerCapabilitiesFileOperations? fileOperations;
 
   /// The server supports workspace folder.
   ///  @since 3.6.0
-  final WorkspaceFoldersServerCapabilities workspaceFolders;
+  final WorkspaceFoldersServerCapabilities? workspaceFolders;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
     if (workspaceFolders != null) {
-      __result['workspaceFolders'] = workspaceFolders.toJson();
+      __result['workspaceFolders'] = workspaceFolders?.toJson();
     }
     if (fileOperations != null) {
-      __result['fileOperations'] = fileOperations.toJson();
+      __result['fileOperations'] = fileOperations?.toJson();
     }
     return __result;
   }
@@ -27318,11 +26071,7 @@
   static const jsonHandler =
       LspJsonHandler(SetTraceParams.canParse, SetTraceParams.fromJson);
 
-  SetTraceParams({@required this.value}) {
-    if (value == null) {
-      throw 'value is required but was not provided';
-    }
-  }
+  SetTraceParams({required this.value});
   static SetTraceParams fromJson(Map<String, dynamic> json) {
     final value = const {'off', 'message', 'verbose'}.contains(json['value'])
         ? json['value']
@@ -27335,7 +26084,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['value'] = value ?? (throw 'value is required but was not set');
+    __result['value'] = value;
     return __result;
   }
 
@@ -27393,11 +26142,7 @@
       ShowDocumentClientCapabilities.canParse,
       ShowDocumentClientCapabilities.fromJson);
 
-  ShowDocumentClientCapabilities({@required this.support}) {
-    if (support == null) {
-      throw 'support is required but was not provided';
-    }
-  }
+  ShowDocumentClientCapabilities({required this.support});
   static ShowDocumentClientCapabilities fromJson(Map<String, dynamic> json) {
     final support = json['support'];
     return ShowDocumentClientCapabilities(support: support);
@@ -27408,8 +26153,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['support'] =
-        support ?? (throw 'support is required but was not set');
+    __result['support'] = support;
     return __result;
   }
 
@@ -27466,11 +26210,7 @@
       LspJsonHandler(ShowDocumentParams.canParse, ShowDocumentParams.fromJson);
 
   ShowDocumentParams(
-      {@required this.uri, this.external, this.takeFocus, this.selection}) {
-    if (uri == null) {
-      throw 'uri is required but was not provided';
-    }
-  }
+      {required this.uri, this.external, this.takeFocus, this.selection});
   static ShowDocumentParams fromJson(Map<String, dynamic> json) {
     final uri = json['uri'];
     final external = json['external'];
@@ -27487,24 +26227,24 @@
   /// Indicates to show the resource in an external program. To show for example
   /// `https://code.visualstudio.com/` in the default WEB browser set `external`
   /// to `true`.
-  final bool external;
+  final bool? external;
 
   /// An optional selection range if the document is a text document. Clients
   /// might ignore the property if an external program is started or the file is
   /// not a text file.
-  final Range selection;
+  final Range? selection;
 
   /// An optional property to indicate whether the editor showing the document
   /// should take focus or not. Clients might ignore this property if an
   /// external program is started.
-  final bool takeFocus;
+  final bool? takeFocus;
 
   /// The document uri to show.
   final String uri;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['uri'] = uri ?? (throw 'uri is required but was not set');
+    __result['uri'] = uri;
     if (external != null) {
       __result['external'] = external;
     }
@@ -27512,7 +26252,7 @@
       __result['takeFocus'] = takeFocus;
     }
     if (selection != null) {
-      __result['selection'] = selection.toJson();
+      __result['selection'] = selection?.toJson();
     }
     return __result;
   }
@@ -27604,11 +26344,7 @@
   static const jsonHandler =
       LspJsonHandler(ShowDocumentResult.canParse, ShowDocumentResult.fromJson);
 
-  ShowDocumentResult({@required this.success}) {
-    if (success == null) {
-      throw 'success is required but was not provided';
-    }
-  }
+  ShowDocumentResult({required this.success});
   static ShowDocumentResult fromJson(Map<String, dynamic> json) {
     final success = json['success'];
     return ShowDocumentResult(success: success);
@@ -27619,8 +26355,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['success'] =
-        success ?? (throw 'success is required but was not set');
+    __result['success'] = success;
     return __result;
   }
 
@@ -27674,17 +26409,9 @@
   static const jsonHandler =
       LspJsonHandler(ShowMessageParams.canParse, ShowMessageParams.fromJson);
 
-  ShowMessageParams({@required this.type, @required this.message}) {
-    if (type == null) {
-      throw 'type is required but was not provided';
-    }
-    if (message == null) {
-      throw 'message is required but was not provided';
-    }
-  }
+  ShowMessageParams({required this.type, required this.message});
   static ShowMessageParams fromJson(Map<String, dynamic> json) {
-    final type =
-        json['type'] != null ? MessageType.fromJson(json['type']) : null;
+    final type = MessageType.fromJson(json['type']);
     final message = json['message'];
     return ShowMessageParams(type: type, message: message);
   }
@@ -27697,10 +26424,8 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['type'] =
-        type?.toJson() ?? (throw 'type is required but was not set');
-    __result['message'] =
-        message ?? (throw 'message is required but was not set');
+    __result['type'] = type.toJson();
+    __result['message'] = message;
     return __result;
   }
 
@@ -27785,12 +26510,13 @@
   }
 
   /// Capabilities specific to the `MessageActionItem` type.
-  final ShowMessageRequestClientCapabilitiesMessageActionItem messageActionItem;
+  final ShowMessageRequestClientCapabilitiesMessageActionItem?
+      messageActionItem;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
     if (messageActionItem != null) {
-      __result['messageActionItem'] = messageActionItem.toJson();
+      __result['messageActionItem'] = messageActionItem?.toJson();
     }
     return __result;
   }
@@ -27854,7 +26580,7 @@
 
   /// Whether the client supports additional attributes which are preserved and
   /// sent back to the server in the request's response.
-  final bool additionalPropertiesSupport;
+  final bool? additionalPropertiesSupport;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -27911,17 +26637,9 @@
       ShowMessageRequestParams.canParse, ShowMessageRequestParams.fromJson);
 
   ShowMessageRequestParams(
-      {@required this.type, @required this.message, this.actions}) {
-    if (type == null) {
-      throw 'type is required but was not provided';
-    }
-    if (message == null) {
-      throw 'message is required but was not provided';
-    }
-  }
+      {required this.type, required this.message, this.actions});
   static ShowMessageRequestParams fromJson(Map<String, dynamic> json) {
-    final type =
-        json['type'] != null ? MessageType.fromJson(json['type']) : null;
+    final type = MessageType.fromJson(json['type']);
     final message = json['message'];
     final actions = json['actions']
         ?.map((item) => item != null ? MessageActionItem.fromJson(item) : null)
@@ -27932,7 +26650,7 @@
   }
 
   /// The message action items to present.
-  final List<MessageActionItem> actions;
+  final List<MessageActionItem>? actions;
 
   /// The actual message
   final String message;
@@ -27942,12 +26660,10 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['type'] =
-        type?.toJson() ?? (throw 'type is required but was not set');
-    __result['message'] =
-        message ?? (throw 'message is required but was not set');
+    __result['type'] = type.toJson();
+    __result['message'] = message;
     if (actions != null) {
-      __result['actions'] = actions.map((item) => item.toJson()).toList();
+      __result['actions'] = actions?.map((item) => item.toJson()).toList();
     }
     return __result;
   }
@@ -28040,15 +26756,10 @@
       LspJsonHandler(SignatureHelp.canParse, SignatureHelp.fromJson);
 
   SignatureHelp(
-      {@required this.signatures, this.activeSignature, this.activeParameter}) {
-    if (signatures == null) {
-      throw 'signatures is required but was not provided';
-    }
-  }
+      {required this.signatures, this.activeSignature, this.activeParameter});
   static SignatureHelp fromJson(Map<String, dynamic> json) {
     final signatures = json['signatures']
-        ?.map(
-            (item) => item != null ? SignatureInformation.fromJson(item) : null)
+        ?.map((item) => SignatureInformation.fromJson(item))
         ?.cast<SignatureInformation>()
         ?.toList();
     final activeSignature = json['activeSignature'];
@@ -28065,7 +26776,7 @@
   /// parameters it is ignored. In future version of the protocol this property
   /// might become mandatory to better express the active parameter if the
   /// active signature does have any.
-  final num activeParameter;
+  final num? activeParameter;
 
   /// The active signature. If omitted or the value lies outside the range of
   /// `signatures` the value defaults to zero or is ignore if the
@@ -28076,7 +26787,7 @@
   ///
   /// In future version of the protocol this property might become mandatory to
   /// better express this.
-  final num activeSignature;
+  final num? activeSignature;
 
   /// One or more signatures. If no signatures are available the signature help
   /// request should return `null`.
@@ -28084,9 +26795,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['signatures'] =
-        signatures?.map((item) => item.toJson())?.toList() ??
-            (throw 'signatures is required but was not set');
+    __result['signatures'] = signatures.map((item) => item.toJson()).toList();
     if (activeSignature != null) {
       __result['activeSignature'] = activeSignature;
     }
@@ -28196,14 +26905,14 @@
   /// contextSupport will also support the `retriggerCharacters` on
   /// `SignatureHelpOptions`.
   ///  @since 3.15.0
-  final bool contextSupport;
+  final bool? contextSupport;
 
   /// Whether signature help supports dynamic registration.
-  final bool dynamicRegistration;
+  final bool? dynamicRegistration;
 
   /// The client supports the following `SignatureInformation` specific
   /// properties.
-  final SignatureHelpClientCapabilitiesSignatureInformation
+  final SignatureHelpClientCapabilitiesSignatureInformation?
       signatureInformation;
 
   Map<String, dynamic> toJson() {
@@ -28212,7 +26921,7 @@
       __result['dynamicRegistration'] = dynamicRegistration;
     }
     if (signatureInformation != null) {
-      __result['signatureInformation'] = signatureInformation.toJson();
+      __result['signatureInformation'] = signatureInformation?.toJson();
     }
     if (contextSupport != null) {
       __result['contextSupport'] = contextSupport;
@@ -28303,7 +27012,7 @@
   /// The client supports processing label offsets instead of a simple label
   /// string.
   ///  @since 3.14.0
-  final bool labelOffsetSupport;
+  final bool? labelOffsetSupport;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -28384,24 +27093,24 @@
   /// The client supports the `activeParameter` property on
   /// `SignatureInformation` literal.
   ///  @since 3.16.0
-  final bool activeParameterSupport;
+  final bool? activeParameterSupport;
 
   /// Client supports the follow content formats for the documentation property.
   /// The order describes the preferred format of the client.
-  final List<MarkupKind> documentationFormat;
+  final List<MarkupKind>? documentationFormat;
 
   /// Client capabilities specific to parameter information.
-  final SignatureHelpClientCapabilitiesParameterInformation
+  final SignatureHelpClientCapabilitiesParameterInformation?
       parameterInformation;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
     if (documentationFormat != null) {
       __result['documentationFormat'] =
-          documentationFormat.map((item) => item.toJson()).toList();
+          documentationFormat?.map((item) => item.toJson()).toList();
     }
     if (parameterInformation != null) {
-      __result['parameterInformation'] = parameterInformation.toJson();
+      __result['parameterInformation'] = parameterInformation?.toJson();
     }
     if (activeParameterSupport != null) {
       __result['activeParameterSupport'] = activeParameterSupport;
@@ -28488,21 +27197,12 @@
       SignatureHelpContext.canParse, SignatureHelpContext.fromJson);
 
   SignatureHelpContext(
-      {@required this.triggerKind,
+      {required this.triggerKind,
       this.triggerCharacter,
-      @required this.isRetrigger,
-      this.activeSignatureHelp}) {
-    if (triggerKind == null) {
-      throw 'triggerKind is required but was not provided';
-    }
-    if (isRetrigger == null) {
-      throw 'isRetrigger is required but was not provided';
-    }
-  }
+      required this.isRetrigger,
+      this.activeSignatureHelp});
   static SignatureHelpContext fromJson(Map<String, dynamic> json) {
-    final triggerKind = json['triggerKind'] != null
-        ? SignatureHelpTriggerKind.fromJson(json['triggerKind'])
-        : null;
+    final triggerKind = SignatureHelpTriggerKind.fromJson(json['triggerKind']);
     final triggerCharacter = json['triggerCharacter'];
     final isRetrigger = json['isRetrigger'];
     final activeSignatureHelp = json['activeSignatureHelp'] != null
@@ -28519,7 +27219,7 @@
   ///
   /// The `activeSignatureHelp` has its `SignatureHelp.activeSignature` field
   /// updated based on the user navigating through available signatures.
-  final SignatureHelp activeSignatureHelp;
+  final SignatureHelp? activeSignatureHelp;
 
   /// `true` if signature help was already showing when it was triggered.
   ///
@@ -28532,22 +27232,20 @@
   ///
   /// This is undefined when triggerKind !==
   /// SignatureHelpTriggerKind.TriggerCharacter
-  final String triggerCharacter;
+  final String? triggerCharacter;
 
   /// Action that caused signature help to be triggered.
   final SignatureHelpTriggerKind triggerKind;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['triggerKind'] = triggerKind?.toJson() ??
-        (throw 'triggerKind is required but was not set');
+    __result['triggerKind'] = triggerKind.toJson();
     if (triggerCharacter != null) {
       __result['triggerCharacter'] = triggerCharacter;
     }
-    __result['isRetrigger'] =
-        isRetrigger ?? (throw 'isRetrigger is required but was not set');
+    __result['isRetrigger'] = isRetrigger;
     if (activeSignatureHelp != null) {
-      __result['activeSignatureHelp'] = activeSignatureHelp.toJson();
+      __result['activeSignatureHelp'] = activeSignatureHelp?.toJson();
     }
     return __result;
   }
@@ -28675,11 +27373,11 @@
   /// These trigger characters are only active when signature help is already
   /// showing. All trigger characters are also counted as re-trigger characters.
   ///  @since 3.15.0
-  final List<String> retriggerCharacters;
+  final List<String>? retriggerCharacters;
 
   /// The characters that trigger signature help automatically.
-  final List<String> triggerCharacters;
-  final bool workDoneProgress;
+  final List<String>? triggerCharacters;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -28771,31 +27469,21 @@
 
   SignatureHelpParams(
       {this.context,
-      @required this.textDocument,
-      @required this.position,
-      this.workDoneToken}) {
-    if (textDocument == null) {
-      throw 'textDocument is required but was not provided';
-    }
-    if (position == null) {
-      throw 'position is required but was not provided';
-    }
-  }
+      required this.textDocument,
+      required this.position,
+      this.workDoneToken});
   static SignatureHelpParams fromJson(Map<String, dynamic> json) {
     final context = json['context'] != null
         ? SignatureHelpContext.fromJson(json['context'])
         : null;
-    final textDocument = json['textDocument'] != null
-        ? TextDocumentIdentifier.fromJson(json['textDocument'])
-        : null;
-    final position =
-        json['position'] != null ? Position.fromJson(json['position']) : null;
-    final workDoneToken = json['workDoneToken'] is num
-        ? Either2<num, String>.t1(json['workDoneToken'])
-        : (json['workDoneToken'] is String
-            ? Either2<num, String>.t2(json['workDoneToken'])
-            : (json['workDoneToken'] == null
-                ? null
+    final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
+    final position = Position.fromJson(json['position']);
+    final workDoneToken = json['workDoneToken'] == null
+        ? null
+        : (json['workDoneToken'] is num
+            ? Either2<num, String>.t1(json['workDoneToken'])
+            : (json['workDoneToken'] is String
+                ? Either2<num, String>.t2(json['workDoneToken'])
                 : (throw '''${json['workDoneToken']} was not one of (num, String)''')));
     return SignatureHelpParams(
         context: context,
@@ -28808,7 +27496,7 @@
   /// to send this using the client capability
   /// `textDocument.signatureHelp.contextSupport === true`
   ///  @since 3.15.0
-  final SignatureHelpContext context;
+  final SignatureHelpContext? context;
 
   /// The position inside the text document.
   final Position position;
@@ -28817,17 +27505,15 @@
   final TextDocumentIdentifier textDocument;
 
   /// An optional token that a server can use to report work done progress.
-  final Either2<num, String> workDoneToken;
+  final Either2<num, String>? workDoneToken;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
     if (context != null) {
-      __result['context'] = context.toJson();
+      __result['context'] = context?.toJson();
     }
-    __result['textDocument'] = textDocument?.toJson() ??
-        (throw 'textDocument is required but was not set');
-    __result['position'] =
-        position?.toJson() ?? (throw 'position is required but was not set');
+    __result['textDocument'] = textDocument.toJson();
+    __result['position'] = position.toJson();
     if (workDoneToken != null) {
       __result['workDoneToken'] = workDoneToken;
     }
@@ -28962,18 +27648,18 @@
 
   /// A document selector to identify the scope of the registration. If set to
   /// null the document selector provided on the client side will be used.
-  final List<DocumentFilter> documentSelector;
+  final List<DocumentFilter>? documentSelector;
 
   /// List of characters that re-trigger signature help.
   ///
   /// These trigger characters are only active when signature help is already
   /// showing. All trigger characters are also counted as re-trigger characters.
   ///  @since 3.15.0
-  final List<String> retriggerCharacters;
+  final List<String>? retriggerCharacters;
 
   /// The characters that trigger signature help automatically.
-  final List<String> triggerCharacters;
-  final bool workDoneProgress;
+  final List<String>? triggerCharacters;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -29119,24 +27805,20 @@
       SignatureInformation.canParse, SignatureInformation.fromJson);
 
   SignatureInformation(
-      {@required this.label,
+      {required this.label,
       this.documentation,
       this.parameters,
-      this.activeParameter}) {
-    if (label == null) {
-      throw 'label is required but was not provided';
-    }
-  }
+      this.activeParameter});
   static SignatureInformation fromJson(Map<String, dynamic> json) {
     final label = json['label'];
-    final documentation = json['documentation'] is String
-        ? Either2<String, MarkupContent>.t1(json['documentation'])
-        : (MarkupContent.canParse(json['documentation'], nullLspJsonReporter)
-            ? Either2<String, MarkupContent>.t2(json['documentation'] != null
-                ? MarkupContent.fromJson(json['documentation'])
-                : null)
-            : (json['documentation'] == null
-                ? null
+    final documentation = json['documentation'] == null
+        ? null
+        : (json['documentation'] is String
+            ? Either2<String, MarkupContent>.t1(json['documentation'])
+            : (MarkupContent.canParse(
+                    json['documentation'], nullLspJsonReporter)
+                ? Either2<String, MarkupContent>.t2(
+                    MarkupContent.fromJson(json['documentation']))
                 : (throw '''${json['documentation']} was not one of (String, MarkupContent)''')));
     final parameters = json['parameters']
         ?.map(
@@ -29155,26 +27837,27 @@
   ///
   /// If provided, this is used in place of `SignatureHelp.activeParameter`.
   ///  @since 3.16.0
-  final num activeParameter;
+  final num? activeParameter;
 
   /// The human-readable doc-comment of this signature. Will be shown in the UI
   /// but can be omitted.
-  final Either2<String, MarkupContent> documentation;
+  final Either2<String, MarkupContent>? documentation;
 
   /// The label of this signature. Will be shown in the UI.
   final String label;
 
   /// The parameters of this signature.
-  final List<ParameterInformation> parameters;
+  final List<ParameterInformation>? parameters;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['label'] = label ?? (throw 'label is required but was not set');
+    __result['label'] = label;
     if (documentation != null) {
       __result['documentation'] = documentation;
     }
     if (parameters != null) {
-      __result['parameters'] = parameters.map((item) => item.toJson()).toList();
+      __result['parameters'] =
+          parameters?.map((item) => item.toJson()).toList();
     }
     if (activeParameter != null) {
       __result['activeParameter'] = activeParameter;
@@ -29311,7 +27994,7 @@
 
   /// The id used to register the request. The id can be used to deregister the
   /// request again. See also Registration#id.
-  final String id;
+  final String? id;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -29366,33 +28049,21 @@
       LspJsonHandler(SymbolInformation.canParse, SymbolInformation.fromJson);
 
   SymbolInformation(
-      {@required this.name,
-      @required this.kind,
+      {required this.name,
+      required this.kind,
       this.tags,
       this.deprecated,
-      @required this.location,
-      this.containerName}) {
-    if (name == null) {
-      throw 'name is required but was not provided';
-    }
-    if (kind == null) {
-      throw 'kind is required but was not provided';
-    }
-    if (location == null) {
-      throw 'location is required but was not provided';
-    }
-  }
+      required this.location,
+      this.containerName});
   static SymbolInformation fromJson(Map<String, dynamic> json) {
     final name = json['name'];
-    final kind =
-        json['kind'] != null ? SymbolKind.fromJson(json['kind']) : null;
+    final kind = SymbolKind.fromJson(json['kind']);
     final tags = json['tags']
         ?.map((item) => item != null ? SymbolTag.fromJson(item) : null)
         ?.cast<SymbolTag>()
         ?.toList();
     final deprecated = json['deprecated'];
-    final location =
-        json['location'] != null ? Location.fromJson(json['location']) : null;
+    final location = Location.fromJson(json['location']);
     final containerName = json['containerName'];
     return SymbolInformation(
         name: name,
@@ -29407,11 +28078,11 @@
   /// user interface purposes (e.g. to render a qualifier in the user interface
   /// if necessary). It can't be used to re-infer a hierarchy for the document
   /// symbols.
-  final String containerName;
+  final String? containerName;
 
   /// Indicates if this symbol is deprecated.
   ///  @deprecated Use tags instead
-  final bool deprecated;
+  final bool? deprecated;
 
   /// The kind of this symbol.
   final SymbolKind kind;
@@ -29432,21 +28103,19 @@
 
   /// Tags for this completion item.
   ///  @since 3.16.0
-  final List<SymbolTag> tags;
+  final List<SymbolTag>? tags;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['name'] = name ?? (throw 'name is required but was not set');
-    __result['kind'] =
-        kind?.toJson() ?? (throw 'kind is required but was not set');
+    __result['name'] = name;
+    __result['kind'] = kind.toJson();
     if (tags != null) {
-      __result['tags'] = tags.map((item) => item.toJson()).toList();
+      __result['tags'] = tags?.map((item) => item.toJson()).toList();
     }
     if (deprecated != null) {
       __result['deprecated'] = deprecated;
     }
-    __result['location'] =
-        location?.toJson() ?? (throw 'location is required but was not set');
+    __result['location'] = location.toJson();
     if (containerName != null) {
       __result['containerName'] = containerName;
     }
@@ -29657,16 +28326,10 @@
       TextDocumentChangeRegistrationOptions.fromJson);
 
   TextDocumentChangeRegistrationOptions(
-      {@required this.syncKind, this.documentSelector}) {
-    if (syncKind == null) {
-      throw 'syncKind is required but was not provided';
-    }
-  }
+      {required this.syncKind, this.documentSelector});
   static TextDocumentChangeRegistrationOptions fromJson(
       Map<String, dynamic> json) {
-    final syncKind = json['syncKind'] != null
-        ? TextDocumentSyncKind.fromJson(json['syncKind'])
-        : null;
+    final syncKind = TextDocumentSyncKind.fromJson(json['syncKind']);
     final documentSelector = json['documentSelector']
         ?.map((item) => item != null ? DocumentFilter.fromJson(item) : null)
         ?.cast<DocumentFilter>()
@@ -29677,7 +28340,7 @@
 
   /// A document selector to identify the scope of the registration. If set to
   /// null the document selector provided on the client side will be used.
-  final List<DocumentFilter> documentSelector;
+  final List<DocumentFilter>? documentSelector;
 
   /// How documents are synced to the server. See TextDocumentSyncKind.Full and
   /// TextDocumentSyncKind.Incremental.
@@ -29685,8 +28348,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['syncKind'] =
-        syncKind?.toJson() ?? (throw 'syncKind is required but was not set');
+    __result['syncKind'] = syncKind.toJson();
     __result['documentSelector'] = documentSelector;
     return __result;
   }
@@ -29906,172 +28568,172 @@
 
   /// Capabilities specific to the various call hierarchy requests.
   ///  @since 3.16.0
-  final CallHierarchyClientCapabilities callHierarchy;
+  final CallHierarchyClientCapabilities? callHierarchy;
 
   /// Capabilities specific to the `textDocument/codeAction` request.
-  final CodeActionClientCapabilities codeAction;
+  final CodeActionClientCapabilities? codeAction;
 
   /// Capabilities specific to the `textDocument/codeLens` request.
-  final CodeLensClientCapabilities codeLens;
+  final CodeLensClientCapabilities? codeLens;
 
   /// Capabilities specific to the `textDocument/documentColor` and the
   /// `textDocument/colorPresentation` request.
   ///  @since 3.6.0
-  final DocumentColorClientCapabilities colorProvider;
+  final DocumentColorClientCapabilities? colorProvider;
 
   /// Capabilities specific to the `textDocument/completion` request.
-  final CompletionClientCapabilities completion;
+  final CompletionClientCapabilities? completion;
 
   /// Capabilities specific to the `textDocument/declaration` request.
   ///  @since 3.14.0
-  final DeclarationClientCapabilities declaration;
+  final DeclarationClientCapabilities? declaration;
 
   /// Capabilities specific to the `textDocument/definition` request.
-  final DefinitionClientCapabilities definition;
+  final DefinitionClientCapabilities? definition;
 
   /// Capabilities specific to the `textDocument/documentHighlight` request.
-  final DocumentHighlightClientCapabilities documentHighlight;
+  final DocumentHighlightClientCapabilities? documentHighlight;
 
   /// Capabilities specific to the `textDocument/documentLink` request.
-  final DocumentLinkClientCapabilities documentLink;
+  final DocumentLinkClientCapabilities? documentLink;
 
   /// Capabilities specific to the `textDocument/documentSymbol` request.
-  final DocumentSymbolClientCapabilities documentSymbol;
+  final DocumentSymbolClientCapabilities? documentSymbol;
 
   /// Capabilities specific to the `textDocument/foldingRange` request.
   ///  @since 3.10.0
-  final FoldingRangeClientCapabilities foldingRange;
+  final FoldingRangeClientCapabilities? foldingRange;
 
   /// Capabilities specific to the `textDocument/formatting` request.
-  final DocumentFormattingClientCapabilities formatting;
+  final DocumentFormattingClientCapabilities? formatting;
 
   /// Capabilities specific to the `textDocument/hover` request.
-  final HoverClientCapabilities hover;
+  final HoverClientCapabilities? hover;
 
   /// Capabilities specific to the `textDocument/implementation` request.
   ///  @since 3.6.0
-  final ImplementationClientCapabilities implementation;
+  final ImplementationClientCapabilities? implementation;
 
   /// Capabilities specific to the `textDocument/linkedEditingRange` request.
   ///  @since 3.16.0
-  final LinkedEditingRangeClientCapabilities linkedEditingRange;
+  final LinkedEditingRangeClientCapabilities? linkedEditingRange;
 
   /// Capabilities specific to the `textDocument/moniker` request.
   ///  @since 3.16.0
-  final MonikerClientCapabilities moniker;
+  final MonikerClientCapabilities? moniker;
 
   /// request. Capabilities specific to the `textDocument/onTypeFormatting`
   /// request.
-  final DocumentOnTypeFormattingClientCapabilities onTypeFormatting;
+  final DocumentOnTypeFormattingClientCapabilities? onTypeFormatting;
 
   /// Capabilities specific to the `textDocument/publishDiagnostics`
   /// notification.
-  final PublishDiagnosticsClientCapabilities publishDiagnostics;
+  final PublishDiagnosticsClientCapabilities? publishDiagnostics;
 
   /// Capabilities specific to the `textDocument/rangeFormatting` request.
-  final DocumentRangeFormattingClientCapabilities rangeFormatting;
+  final DocumentRangeFormattingClientCapabilities? rangeFormatting;
 
   /// Capabilities specific to the `textDocument/references` request.
-  final ReferenceClientCapabilities references;
+  final ReferenceClientCapabilities? references;
 
   /// Capabilities specific to the `textDocument/rename` request.
-  final RenameClientCapabilities rename;
+  final RenameClientCapabilities? rename;
 
   /// Capabilities specific to the `textDocument/selectionRange` request.
   ///  @since 3.15.0
-  final SelectionRangeClientCapabilities selectionRange;
+  final SelectionRangeClientCapabilities? selectionRange;
 
   /// Capabilities specific to the various semantic token requests.
   ///  @since 3.16.0
-  final SemanticTokensClientCapabilities semanticTokens;
+  final SemanticTokensClientCapabilities? semanticTokens;
 
   /// Capabilities specific to the `textDocument/signatureHelp` request.
-  final SignatureHelpClientCapabilities signatureHelp;
-  final TextDocumentSyncClientCapabilities synchronization;
+  final SignatureHelpClientCapabilities? signatureHelp;
+  final TextDocumentSyncClientCapabilities? synchronization;
 
   /// Capabilities specific to the `textDocument/typeDefinition` request.
   ///  @since 3.6.0
-  final TypeDefinitionClientCapabilities typeDefinition;
+  final TypeDefinitionClientCapabilities? typeDefinition;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
     if (synchronization != null) {
-      __result['synchronization'] = synchronization.toJson();
+      __result['synchronization'] = synchronization?.toJson();
     }
     if (completion != null) {
-      __result['completion'] = completion.toJson();
+      __result['completion'] = completion?.toJson();
     }
     if (hover != null) {
-      __result['hover'] = hover.toJson();
+      __result['hover'] = hover?.toJson();
     }
     if (signatureHelp != null) {
-      __result['signatureHelp'] = signatureHelp.toJson();
+      __result['signatureHelp'] = signatureHelp?.toJson();
     }
     if (declaration != null) {
-      __result['declaration'] = declaration.toJson();
+      __result['declaration'] = declaration?.toJson();
     }
     if (definition != null) {
-      __result['definition'] = definition.toJson();
+      __result['definition'] = definition?.toJson();
     }
     if (typeDefinition != null) {
-      __result['typeDefinition'] = typeDefinition.toJson();
+      __result['typeDefinition'] = typeDefinition?.toJson();
     }
     if (implementation != null) {
-      __result['implementation'] = implementation.toJson();
+      __result['implementation'] = implementation?.toJson();
     }
     if (references != null) {
-      __result['references'] = references.toJson();
+      __result['references'] = references?.toJson();
     }
     if (documentHighlight != null) {
-      __result['documentHighlight'] = documentHighlight.toJson();
+      __result['documentHighlight'] = documentHighlight?.toJson();
     }
     if (documentSymbol != null) {
-      __result['documentSymbol'] = documentSymbol.toJson();
+      __result['documentSymbol'] = documentSymbol?.toJson();
     }
     if (codeAction != null) {
-      __result['codeAction'] = codeAction.toJson();
+      __result['codeAction'] = codeAction?.toJson();
     }
     if (codeLens != null) {
-      __result['codeLens'] = codeLens.toJson();
+      __result['codeLens'] = codeLens?.toJson();
     }
     if (documentLink != null) {
-      __result['documentLink'] = documentLink.toJson();
+      __result['documentLink'] = documentLink?.toJson();
     }
     if (colorProvider != null) {
-      __result['colorProvider'] = colorProvider.toJson();
+      __result['colorProvider'] = colorProvider?.toJson();
     }
     if (formatting != null) {
-      __result['formatting'] = formatting.toJson();
+      __result['formatting'] = formatting?.toJson();
     }
     if (rangeFormatting != null) {
-      __result['rangeFormatting'] = rangeFormatting.toJson();
+      __result['rangeFormatting'] = rangeFormatting?.toJson();
     }
     if (onTypeFormatting != null) {
-      __result['onTypeFormatting'] = onTypeFormatting.toJson();
+      __result['onTypeFormatting'] = onTypeFormatting?.toJson();
     }
     if (rename != null) {
-      __result['rename'] = rename.toJson();
+      __result['rename'] = rename?.toJson();
     }
     if (publishDiagnostics != null) {
-      __result['publishDiagnostics'] = publishDiagnostics.toJson();
+      __result['publishDiagnostics'] = publishDiagnostics?.toJson();
     }
     if (foldingRange != null) {
-      __result['foldingRange'] = foldingRange.toJson();
+      __result['foldingRange'] = foldingRange?.toJson();
     }
     if (selectionRange != null) {
-      __result['selectionRange'] = selectionRange.toJson();
+      __result['selectionRange'] = selectionRange?.toJson();
     }
     if (linkedEditingRange != null) {
-      __result['linkedEditingRange'] = linkedEditingRange.toJson();
+      __result['linkedEditingRange'] = linkedEditingRange?.toJson();
     }
     if (callHierarchy != null) {
-      __result['callHierarchy'] = callHierarchy.toJson();
+      __result['callHierarchy'] = callHierarchy?.toJson();
     }
     if (semanticTokens != null) {
-      __result['semanticTokens'] = semanticTokens.toJson();
+      __result['semanticTokens'] = semanticTokens?.toJson();
     }
     if (moniker != null) {
-      __result['moniker'] = moniker.toJson();
+      __result['moniker'] = moniker?.toJson();
     }
     return __result;
   }
@@ -30461,16 +29123,9 @@
       TextDocumentContentChangeEvent1.fromJson);
 
   TextDocumentContentChangeEvent1(
-      {@required this.range, this.rangeLength, @required this.text}) {
-    if (range == null) {
-      throw 'range is required but was not provided';
-    }
-    if (text == null) {
-      throw 'text is required but was not provided';
-    }
-  }
+      {required this.range, this.rangeLength, required this.text});
   static TextDocumentContentChangeEvent1 fromJson(Map<String, dynamic> json) {
-    final range = json['range'] != null ? Range.fromJson(json['range']) : null;
+    final range = Range.fromJson(json['range']);
     final rangeLength = json['rangeLength'];
     final text = json['text'];
     return TextDocumentContentChangeEvent1(
@@ -30482,19 +29137,18 @@
 
   /// The optional length of the range that got replaced.
   ///  @deprecated use range instead.
-  final num rangeLength;
+  final num? rangeLength;
 
   /// The new text for the provided range.
   final String text;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['range'] =
-        range?.toJson() ?? (throw 'range is required but was not set');
+    __result['range'] = range.toJson();
     if (rangeLength != null) {
       __result['rangeLength'] = rangeLength;
     }
-    __result['text'] = text ?? (throw 'text is required but was not set');
+    __result['text'] = text;
     return __result;
   }
 
@@ -30580,11 +29234,7 @@
       TextDocumentContentChangeEvent2.canParse,
       TextDocumentContentChangeEvent2.fromJson);
 
-  TextDocumentContentChangeEvent2({@required this.text}) {
-    if (text == null) {
-      throw 'text is required but was not provided';
-    }
-  }
+  TextDocumentContentChangeEvent2({required this.text});
   static TextDocumentContentChangeEvent2 fromJson(Map<String, dynamic> json) {
     final text = json['text'];
     return TextDocumentContentChangeEvent2(text: text);
@@ -30595,7 +29245,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['text'] = text ?? (throw 'text is required but was not set');
+    __result['text'] = text;
     return __result;
   }
 
@@ -30649,28 +29299,20 @@
   static const jsonHandler =
       LspJsonHandler(TextDocumentEdit.canParse, TextDocumentEdit.fromJson);
 
-  TextDocumentEdit({@required this.textDocument, @required this.edits}) {
-    if (textDocument == null) {
-      throw 'textDocument is required but was not provided';
-    }
-    if (edits == null) {
-      throw 'edits is required but was not provided';
-    }
-  }
+  TextDocumentEdit({required this.textDocument, required this.edits});
   static TextDocumentEdit fromJson(Map<String, dynamic> json) {
-    final textDocument = json['textDocument'] != null
-        ? OptionalVersionedTextDocumentIdentifier.fromJson(json['textDocument'])
-        : null;
+    final textDocument =
+        OptionalVersionedTextDocumentIdentifier.fromJson(json['textDocument']);
     final edits = json['edits']
         ?.map((item) => SnippetTextEdit.canParse(item, nullLspJsonReporter)
             ? Either3<SnippetTextEdit, AnnotatedTextEdit, TextEdit>.t1(
-                item != null ? SnippetTextEdit.fromJson(item) : null)
+                SnippetTextEdit.fromJson(item))
             : (AnnotatedTextEdit.canParse(item, nullLspJsonReporter)
                 ? Either3<SnippetTextEdit, AnnotatedTextEdit, TextEdit>.t2(
-                    item != null ? AnnotatedTextEdit.fromJson(item) : null)
+                    AnnotatedTextEdit.fromJson(item))
                 : (TextEdit.canParse(item, nullLspJsonReporter)
                     ? Either3<SnippetTextEdit, AnnotatedTextEdit, TextEdit>.t3(
-                        item != null ? TextEdit.fromJson(item) : null)
+                        TextEdit.fromJson(item))
                     : (throw '''$item was not one of (SnippetTextEdit, AnnotatedTextEdit, TextEdit)'''))))
         ?.cast<Either3<SnippetTextEdit, AnnotatedTextEdit, TextEdit>>()
         ?.toList();
@@ -30687,9 +29329,8 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['textDocument'] = textDocument?.toJson() ??
-        (throw 'textDocument is required but was not set');
-    __result['edits'] = edits ?? (throw 'edits is required but was not set');
+    __result['textDocument'] = textDocument.toJson();
+    __result['edits'] = edits;
     return __result;
   }
 
@@ -30775,11 +29416,7 @@
   static const jsonHandler = LspJsonHandler(
       TextDocumentIdentifier.canParse, TextDocumentIdentifier.fromJson);
 
-  TextDocumentIdentifier({@required this.uri}) {
-    if (uri == null) {
-      throw 'uri is required but was not provided';
-    }
-  }
+  TextDocumentIdentifier({required this.uri});
   static TextDocumentIdentifier fromJson(Map<String, dynamic> json) {
     if (VersionedTextDocumentIdentifier.canParse(json, nullLspJsonReporter)) {
       return VersionedTextDocumentIdentifier.fromJson(json);
@@ -30797,7 +29434,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['uri'] = uri ?? (throw 'uri is required but was not set');
+    __result['uri'] = uri;
     return __result;
   }
 
@@ -30852,23 +29489,10 @@
       LspJsonHandler(TextDocumentItem.canParse, TextDocumentItem.fromJson);
 
   TextDocumentItem(
-      {@required this.uri,
-      @required this.languageId,
-      @required this.version,
-      @required this.text}) {
-    if (uri == null) {
-      throw 'uri is required but was not provided';
-    }
-    if (languageId == null) {
-      throw 'languageId is required but was not provided';
-    }
-    if (version == null) {
-      throw 'version is required but was not provided';
-    }
-    if (text == null) {
-      throw 'text is required but was not provided';
-    }
-  }
+      {required this.uri,
+      required this.languageId,
+      required this.version,
+      required this.text});
   static TextDocumentItem fromJson(Map<String, dynamic> json) {
     final uri = json['uri'];
     final languageId = json['languageId'];
@@ -30893,12 +29517,10 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['uri'] = uri ?? (throw 'uri is required but was not set');
-    __result['languageId'] =
-        languageId ?? (throw 'languageId is required but was not set');
-    __result['version'] =
-        version ?? (throw 'version is required but was not set');
-    __result['text'] = text ?? (throw 'text is required but was not set');
+    __result['uri'] = uri;
+    __result['languageId'] = languageId;
+    __result['version'] = version;
+    __result['text'] = text;
     return __result;
   }
 
@@ -31010,14 +29632,7 @@
       TextDocumentPositionParams.canParse, TextDocumentPositionParams.fromJson);
 
   TextDocumentPositionParams(
-      {@required this.textDocument, @required this.position}) {
-    if (textDocument == null) {
-      throw 'textDocument is required but was not provided';
-    }
-    if (position == null) {
-      throw 'position is required but was not provided';
-    }
-  }
+      {required this.textDocument, required this.position});
   static TextDocumentPositionParams fromJson(Map<String, dynamic> json) {
     if (CompletionParams.canParse(json, nullLspJsonReporter)) {
       return CompletionParams.fromJson(json);
@@ -31064,11 +29679,8 @@
     if (MonikerParams.canParse(json, nullLspJsonReporter)) {
       return MonikerParams.fromJson(json);
     }
-    final textDocument = json['textDocument'] != null
-        ? TextDocumentIdentifier.fromJson(json['textDocument'])
-        : null;
-    final position =
-        json['position'] != null ? Position.fromJson(json['position']) : null;
+    final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
+    final position = Position.fromJson(json['position']);
     return TextDocumentPositionParams(
         textDocument: textDocument, position: position);
   }
@@ -31081,10 +29693,8 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['textDocument'] = textDocument?.toJson() ??
-        (throw 'textDocument is required but was not set');
-    __result['position'] =
-        position?.toJson() ?? (throw 'position is required but was not set');
+    __result['textDocument'] = textDocument.toJson();
+    __result['position'] = position.toJson();
     return __result;
   }
 
@@ -31256,7 +29866,7 @@
 
   /// A document selector to identify the scope of the registration. If set to
   /// null the document selector provided on the client side will be used.
-  final List<DocumentFilter> documentSelector;
+  final List<DocumentFilter>? documentSelector;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -31365,10 +29975,10 @@
 
   /// A document selector to identify the scope of the registration. If set to
   /// null the document selector provided on the client side will be used.
-  final List<DocumentFilter> documentSelector;
+  final List<DocumentFilter>? documentSelector;
 
   /// The client is supposed to include the content on save.
-  final bool includeText;
+  final bool? includeText;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -31462,18 +30072,18 @@
   }
 
   /// The client supports did save notifications.
-  final bool didSave;
+  final bool? didSave;
 
   /// Whether text document synchronization supports dynamic registration.
-  final bool dynamicRegistration;
+  final bool? dynamicRegistration;
 
   /// The client supports sending will save notifications.
-  final bool willSave;
+  final bool? willSave;
 
   /// The client supports sending a will save request and waits for a response
   /// providing text edits which will be applied to the document before it is
   /// saved.
-  final bool willSaveWaitUntil;
+  final bool? willSaveWaitUntil;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -31617,14 +30227,13 @@
         : null;
     final willSave = json['willSave'];
     final willSaveWaitUntil = json['willSaveWaitUntil'];
-    final save = json['save'] is bool
-        ? Either2<bool, SaveOptions>.t1(json['save'])
-        : (SaveOptions.canParse(json['save'], nullLspJsonReporter)
-            ? Either2<bool, SaveOptions>.t2(json['save'] != null
-                ? SaveOptions.fromJson(json['save'])
-                : null)
-            : (json['save'] == null
-                ? null
+    final save = json['save'] == null
+        ? null
+        : (json['save'] is bool
+            ? Either2<bool, SaveOptions>.t1(json['save'])
+            : (SaveOptions.canParse(json['save'], nullLspJsonReporter)
+                ? Either2<bool, SaveOptions>.t2(
+                    SaveOptions.fromJson(json['save']))
                 : (throw '''${json['save']} was not one of (bool, SaveOptions)''')));
     return TextDocumentSyncOptions(
         openClose: openClose,
@@ -31638,23 +30247,23 @@
   /// TextDocumentSyncKind.None, TextDocumentSyncKind.Full and
   /// TextDocumentSyncKind.Incremental. If omitted it defaults to
   /// TextDocumentSyncKind.None.
-  final TextDocumentSyncKind change;
+  final TextDocumentSyncKind? change;
 
   /// Open and close notifications are sent to the server. If omitted open close
   /// notification should not be sent.
-  final bool openClose;
+  final bool? openClose;
 
   /// If present save notifications are sent to the server. If omitted the
   /// notification should not be sent.
-  final Either2<bool, SaveOptions> save;
+  final Either2<bool, SaveOptions>? save;
 
   /// If present will save notifications are sent to the server. If omitted the
   /// notification should not be sent.
-  final bool willSave;
+  final bool? willSave;
 
   /// If present will save wait until requests are sent to the server. If
   /// omitted the request should not be sent.
-  final bool willSaveWaitUntil;
+  final bool? willSaveWaitUntil;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -31662,7 +30271,7 @@
       __result['openClose'] = openClose;
     }
     if (change != null) {
-      __result['change'] = change.toJson();
+      __result['change'] = change?.toJson();
     }
     if (willSave != null) {
       __result['willSave'] = willSave;
@@ -31767,14 +30376,7 @@
   static const jsonHandler =
       LspJsonHandler(TextEdit.canParse, TextEdit.fromJson);
 
-  TextEdit({@required this.range, @required this.newText}) {
-    if (range == null) {
-      throw 'range is required but was not provided';
-    }
-    if (newText == null) {
-      throw 'newText is required but was not provided';
-    }
-  }
+  TextEdit({required this.range, required this.newText});
   static TextEdit fromJson(Map<String, dynamic> json) {
     if (AnnotatedTextEdit.canParse(json, nullLspJsonReporter)) {
       return AnnotatedTextEdit.fromJson(json);
@@ -31782,7 +30384,7 @@
     if (SnippetTextEdit.canParse(json, nullLspJsonReporter)) {
       return SnippetTextEdit.fromJson(json);
     }
-    final range = json['range'] != null ? Range.fromJson(json['range']) : null;
+    final range = Range.fromJson(json['range']);
     final newText = json['newText'];
     return TextEdit(range: range, newText: newText);
   }
@@ -31796,10 +30398,8 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['range'] =
-        range?.toJson() ?? (throw 'range is required but was not set');
-    __result['newText'] =
-        newText ?? (throw 'newText is required but was not set');
+    __result['range'] = range.toJson();
+    __result['newText'] = newText;
     return __result;
   }
 
@@ -31906,11 +30506,11 @@
   /// Whether implementation supports dynamic registration. If this is set to
   /// `true` the client supports the new `TypeDefinitionRegistrationOptions`
   /// return value for the corresponding server capability as well.
-  final bool dynamicRegistration;
+  final bool? dynamicRegistration;
 
   /// The client supports additional metadata in the form of definition links.
   ///  @since 3.14.0
-  final bool linkSupport;
+  final bool? linkSupport;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -31987,7 +30587,7 @@
     return TypeDefinitionOptions(workDoneProgress: workDoneProgress);
   }
 
-  final bool workDoneProgress;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -32046,36 +30646,26 @@
       TypeDefinitionParams.canParse, TypeDefinitionParams.fromJson);
 
   TypeDefinitionParams(
-      {@required this.textDocument,
-      @required this.position,
+      {required this.textDocument,
+      required this.position,
       this.workDoneToken,
-      this.partialResultToken}) {
-    if (textDocument == null) {
-      throw 'textDocument is required but was not provided';
-    }
-    if (position == null) {
-      throw 'position is required but was not provided';
-    }
-  }
+      this.partialResultToken});
   static TypeDefinitionParams fromJson(Map<String, dynamic> json) {
-    final textDocument = json['textDocument'] != null
-        ? TextDocumentIdentifier.fromJson(json['textDocument'])
-        : null;
-    final position =
-        json['position'] != null ? Position.fromJson(json['position']) : null;
-    final workDoneToken = json['workDoneToken'] is num
-        ? Either2<num, String>.t1(json['workDoneToken'])
-        : (json['workDoneToken'] is String
-            ? Either2<num, String>.t2(json['workDoneToken'])
-            : (json['workDoneToken'] == null
-                ? null
+    final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
+    final position = Position.fromJson(json['position']);
+    final workDoneToken = json['workDoneToken'] == null
+        ? null
+        : (json['workDoneToken'] is num
+            ? Either2<num, String>.t1(json['workDoneToken'])
+            : (json['workDoneToken'] is String
+                ? Either2<num, String>.t2(json['workDoneToken'])
                 : (throw '''${json['workDoneToken']} was not one of (num, String)''')));
-    final partialResultToken = json['partialResultToken'] is num
-        ? Either2<num, String>.t1(json['partialResultToken'])
-        : (json['partialResultToken'] is String
-            ? Either2<num, String>.t2(json['partialResultToken'])
-            : (json['partialResultToken'] == null
-                ? null
+    final partialResultToken = json['partialResultToken'] == null
+        ? null
+        : (json['partialResultToken'] is num
+            ? Either2<num, String>.t1(json['partialResultToken'])
+            : (json['partialResultToken'] is String
+                ? Either2<num, String>.t2(json['partialResultToken'])
                 : (throw '''${json['partialResultToken']} was not one of (num, String)''')));
     return TypeDefinitionParams(
         textDocument: textDocument,
@@ -32086,7 +30676,7 @@
 
   /// An optional token that a server can use to report partial results (e.g.
   /// streaming) to the client.
-  final Either2<num, String> partialResultToken;
+  final Either2<num, String>? partialResultToken;
 
   /// The position inside the text document.
   final Position position;
@@ -32095,14 +30685,12 @@
   final TextDocumentIdentifier textDocument;
 
   /// An optional token that a server can use to report work done progress.
-  final Either2<num, String> workDoneToken;
+  final Either2<num, String>? workDoneToken;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['textDocument'] = textDocument?.toJson() ??
-        (throw 'textDocument is required but was not set');
-    __result['position'] =
-        position?.toJson() ?? (throw 'position is required but was not set');
+    __result['textDocument'] = textDocument.toJson();
+    __result['position'] = position.toJson();
     if (workDoneToken != null) {
       __result['workDoneToken'] = workDoneToken;
     }
@@ -32231,12 +30819,12 @@
 
   /// A document selector to identify the scope of the registration. If set to
   /// null the document selector provided on the client side will be used.
-  final List<DocumentFilter> documentSelector;
+  final List<DocumentFilter>? documentSelector;
 
   /// The id used to register the request. The id can be used to deregister the
   /// request again. See also Registration#id.
-  final String id;
-  final bool workDoneProgress;
+  final String? id;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -32362,14 +30950,7 @@
   static const jsonHandler =
       LspJsonHandler(Unregistration.canParse, Unregistration.fromJson);
 
-  Unregistration({@required this.id, @required this.method}) {
-    if (id == null) {
-      throw 'id is required but was not provided';
-    }
-    if (method == null) {
-      throw 'method is required but was not provided';
-    }
-  }
+  Unregistration({required this.id, required this.method});
   static Unregistration fromJson(Map<String, dynamic> json) {
     final id = json['id'];
     final method = json['method'];
@@ -32385,8 +30966,8 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['id'] = id ?? (throw 'id is required but was not set');
-    __result['method'] = method ?? (throw 'method is required but was not set');
+    __result['id'] = id;
+    __result['method'] = method;
     return __result;
   }
 
@@ -32457,14 +31038,10 @@
   static const jsonHandler = LspJsonHandler(
       UnregistrationParams.canParse, UnregistrationParams.fromJson);
 
-  UnregistrationParams({@required this.unregisterations}) {
-    if (unregisterations == null) {
-      throw 'unregisterations is required but was not provided';
-    }
-  }
+  UnregistrationParams({required this.unregisterations});
   static UnregistrationParams fromJson(Map<String, dynamic> json) {
     final unregisterations = json['unregisterations']
-        ?.map((item) => item != null ? Unregistration.fromJson(item) : null)
+        ?.map((item) => Unregistration.fromJson(item))
         ?.cast<Unregistration>()
         ?.toList();
     return UnregistrationParams(unregisterations: unregisterations);
@@ -32478,8 +31055,7 @@
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
     __result['unregisterations'] =
-        unregisterations?.map((item) => item.toJson())?.toList() ??
-            (throw 'unregisterations is required but was not set');
+        unregisterations.map((item) => item.toJson()).toList();
     return __result;
   }
 
@@ -32539,15 +31115,7 @@
       VersionedTextDocumentIdentifier.canParse,
       VersionedTextDocumentIdentifier.fromJson);
 
-  VersionedTextDocumentIdentifier(
-      {@required this.version, @required this.uri}) {
-    if (version == null) {
-      throw 'version is required but was not provided';
-    }
-    if (uri == null) {
-      throw 'uri is required but was not provided';
-    }
-  }
+  VersionedTextDocumentIdentifier({required this.version, required this.uri});
   static VersionedTextDocumentIdentifier fromJson(Map<String, dynamic> json) {
     final version = json['version'];
     final uri = json['uri'];
@@ -32565,9 +31133,8 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['version'] =
-        version ?? (throw 'version is required but was not set');
-    __result['uri'] = uri ?? (throw 'uri is required but was not set');
+    __result['version'] = version;
+    __result['uri'] = uri;
     return __result;
   }
 
@@ -32671,21 +31238,10 @@
       WillSaveTextDocumentParams.canParse, WillSaveTextDocumentParams.fromJson);
 
   WillSaveTextDocumentParams(
-      {@required this.textDocument, @required this.reason}) {
-    if (textDocument == null) {
-      throw 'textDocument is required but was not provided';
-    }
-    if (reason == null) {
-      throw 'reason is required but was not provided';
-    }
-  }
+      {required this.textDocument, required this.reason});
   static WillSaveTextDocumentParams fromJson(Map<String, dynamic> json) {
-    final textDocument = json['textDocument'] != null
-        ? TextDocumentIdentifier.fromJson(json['textDocument'])
-        : null;
-    final reason = json['reason'] != null
-        ? TextDocumentSaveReason.fromJson(json['reason'])
-        : null;
+    final textDocument = TextDocumentIdentifier.fromJson(json['textDocument']);
+    final reason = TextDocumentSaveReason.fromJson(json['reason']);
     return WillSaveTextDocumentParams(
         textDocument: textDocument, reason: reason);
   }
@@ -32698,10 +31254,8 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['textDocument'] = textDocument?.toJson() ??
-        (throw 'textDocument is required but was not set');
-    __result['reason'] =
-        reason?.toJson() ?? (throw 'reason is required but was not set');
+    __result['textDocument'] = textDocument.toJson();
+    __result['reason'] = reason.toJson();
     return __result;
   }
 
@@ -32777,16 +31331,13 @@
 
   WorkDoneProgressBegin(
       {this.kind = 'begin',
-      @required this.title,
+      required this.title,
       this.cancellable,
       this.message,
       this.percentage}) {
     if (kind != 'begin') {
       throw 'kind may only be the literal \'begin\'';
     }
-    if (title == null) {
-      throw 'title is required but was not provided';
-    }
   }
   static WorkDoneProgressBegin fromJson(Map<String, dynamic> json) {
     final kind = json['kind'];
@@ -32805,7 +31356,7 @@
   /// Controls if a cancel button should show to allow the user to cancel the
   /// long running operation. Clients that don't support cancellation are
   /// allowed to ignore the setting.
-  final bool cancellable;
+  final bool? cancellable;
   final String kind;
 
   /// Optional, more detailed associated progress message. Contains
@@ -32813,7 +31364,7 @@
   ///
   /// Examples: "3/25 files", "project/src/module2", "node_modules/some_dep". If
   /// unset, the previous progress message (if any) is still valid.
-  final String message;
+  final String? message;
 
   /// Optional progress percentage to display (value 100 is considered 100%). If
   /// not provided infinite progress is assumed and clients are allowed to
@@ -32821,7 +31372,7 @@
   ///
   /// The value should be steadily rising. Clients are free to ignore values
   /// that are not following this rule. The value range is [0, 100]
-  final num percentage;
+  final num? percentage;
 
   /// Mandatory title of the progress operation. Used to briefly inform about
   /// the kind of operation being performed.
@@ -32831,8 +31382,8 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['kind'] = kind ?? (throw 'kind is required but was not set');
-    __result['title'] = title ?? (throw 'title is required but was not set');
+    __result['kind'] = kind;
+    __result['title'] = title;
     if (cancellable != null) {
       __result['cancellable'] = cancellable;
     }
@@ -32949,11 +31500,7 @@
       WorkDoneProgressCancelParams.canParse,
       WorkDoneProgressCancelParams.fromJson);
 
-  WorkDoneProgressCancelParams({@required this.token}) {
-    if (token == null) {
-      throw 'token is required but was not provided';
-    }
-  }
+  WorkDoneProgressCancelParams({required this.token});
   static WorkDoneProgressCancelParams fromJson(Map<String, dynamic> json) {
     final token = json['token'] is num
         ? Either2<num, String>.t1(json['token'])
@@ -32968,7 +31515,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['token'] = token ?? (throw 'token is required but was not set');
+    __result['token'] = token;
     return __result;
   }
 
@@ -33023,11 +31570,7 @@
       WorkDoneProgressCreateParams.canParse,
       WorkDoneProgressCreateParams.fromJson);
 
-  WorkDoneProgressCreateParams({@required this.token}) {
-    if (token == null) {
-      throw 'token is required but was not provided';
-    }
-  }
+  WorkDoneProgressCreateParams({required this.token});
   static WorkDoneProgressCreateParams fromJson(Map<String, dynamic> json) {
     final token = json['token'] is num
         ? Either2<num, String>.t1(json['token'])
@@ -33042,7 +31585,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['token'] = token ?? (throw 'token is required but was not set');
+    __result['token'] = token;
     return __result;
   }
 
@@ -33111,11 +31654,11 @@
 
   /// Optional, a final message indicating to for example indicate the outcome
   /// of the operation.
-  final String message;
+  final String? message;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['kind'] = kind ?? (throw 'kind is required but was not set');
+    __result['kind'] = kind;
     if (message != null) {
       __result['message'] = message;
     }
@@ -33263,7 +31806,7 @@
     return WorkDoneProgressOptions(workDoneProgress: workDoneProgress);
   }
 
-  final bool workDoneProgress;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -33411,18 +31954,18 @@
     if (MonikerParams.canParse(json, nullLspJsonReporter)) {
       return MonikerParams.fromJson(json);
     }
-    final workDoneToken = json['workDoneToken'] is num
-        ? Either2<num, String>.t1(json['workDoneToken'])
-        : (json['workDoneToken'] is String
-            ? Either2<num, String>.t2(json['workDoneToken'])
-            : (json['workDoneToken'] == null
-                ? null
+    final workDoneToken = json['workDoneToken'] == null
+        ? null
+        : (json['workDoneToken'] is num
+            ? Either2<num, String>.t1(json['workDoneToken'])
+            : (json['workDoneToken'] is String
+                ? Either2<num, String>.t2(json['workDoneToken'])
                 : (throw '''${json['workDoneToken']} was not one of (num, String)''')));
     return WorkDoneProgressParams(workDoneToken: workDoneToken);
   }
 
   /// An optional token that a server can use to report work done progress.
-  final Either2<num, String> workDoneToken;
+  final Either2<num, String>? workDoneToken;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -33500,7 +32043,7 @@
   ///
   /// Clients that don't support cancellation or don't support control the
   /// button's enablement state are allowed to ignore the setting.
-  final bool cancellable;
+  final bool? cancellable;
   final String kind;
 
   /// Optional, more detailed associated progress message. Contains
@@ -33508,7 +32051,7 @@
   ///
   /// Examples: "3/25 files", "project/src/module2", "node_modules/some_dep". If
   /// unset, the previous progress message (if any) is still valid.
-  final String message;
+  final String? message;
 
   /// Optional progress percentage to display (value 100 is considered 100%). If
   /// not provided infinite progress is assumed and clients are allowed to
@@ -33516,11 +32059,11 @@
   ///
   /// The value should be steadily rising. Clients are free to ignore values
   /// that are not following this rule. The value range is [0, 100]
-  final num percentage;
+  final num? percentage;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['kind'] = kind ?? (throw 'kind is required but was not set');
+    __result['kind'] = kind;
     if (cancellable != null) {
       __result['cancellable'] = cancellable;
     }
@@ -33627,24 +32170,25 @@
                 ?.cast<TextEdit>()
                 ?.toList()))
         ?.cast<String, List<TextEdit>>();
-    final documentChanges = (json['documentChanges'] is List && (json['documentChanges'].every((item) => TextDocumentEdit.canParse(item, nullLspJsonReporter))))
-        ? Either2<List<TextDocumentEdit>, List<Either4<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>>>.t1(
-            json['documentChanges']
-                ?.map((item) =>
-                    item != null ? TextDocumentEdit.fromJson(item) : null)
+    final documentChanges = json['documentChanges'] == null
+        ? null
+        : ((json['documentChanges'] is List && (json['documentChanges'].every((item) => TextDocumentEdit.canParse(item, nullLspJsonReporter))))
+            ? Either2<List<TextDocumentEdit>, List<Either4<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>>>.t1(json['documentChanges']
+                ?.map((item) => TextDocumentEdit.fromJson(item))
                 ?.cast<TextDocumentEdit>()
                 ?.toList())
-        : ((json['documentChanges'] is List && (json['documentChanges'].every((item) => (TextDocumentEdit.canParse(item, nullLspJsonReporter) || CreateFile.canParse(item, nullLspJsonReporter) || RenameFile.canParse(item, nullLspJsonReporter) || DeleteFile.canParse(item, nullLspJsonReporter)))))
-            ? Either2<List<TextDocumentEdit>, List<Either4<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>>>.t2(json['documentChanges']
-                ?.map((item) => TextDocumentEdit.canParse(item, nullLspJsonReporter)
-                    ? Either4<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>.t1(
-                        item != null ? TextDocumentEdit.fromJson(item) : null)
-                    : (CreateFile.canParse(item, nullLspJsonReporter)
-                        ? Either4<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>.t2(item != null ? CreateFile.fromJson(item) : null)
-                        : (RenameFile.canParse(item, nullLspJsonReporter) ? Either4<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>.t3(item != null ? RenameFile.fromJson(item) : null) : (DeleteFile.canParse(item, nullLspJsonReporter) ? Either4<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>.t4(item != null ? DeleteFile.fromJson(item) : null) : (item == null ? null : (throw '''$item was not one of (TextDocumentEdit, CreateFile, RenameFile, DeleteFile)'''))))))
-                ?.cast<Either4<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>>()
-                ?.toList())
-            : (json['documentChanges'] == null ? null : (throw '''${json['documentChanges']} was not one of (List<TextDocumentEdit>, List<Either4<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>>)''')));
+            : ((json['documentChanges'] is List &&
+                    (json['documentChanges'].every((item) => (TextDocumentEdit.canParse(item, nullLspJsonReporter) ||
+                        CreateFile.canParse(item, nullLspJsonReporter) ||
+                        RenameFile.canParse(item, nullLspJsonReporter) ||
+                        DeleteFile.canParse(item, nullLspJsonReporter)))))
+                ? Either2<List<TextDocumentEdit>, List<Either4<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>>>.t2(json['documentChanges']
+                    ?.map((item) => TextDocumentEdit.canParse(item, nullLspJsonReporter)
+                        ? Either4<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>.t1(TextDocumentEdit.fromJson(item))
+                        : (CreateFile.canParse(item, nullLspJsonReporter) ? Either4<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>.t2(CreateFile.fromJson(item)) : (RenameFile.canParse(item, nullLspJsonReporter) ? Either4<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>.t3(RenameFile.fromJson(item)) : (DeleteFile.canParse(item, nullLspJsonReporter) ? Either4<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>.t4(DeleteFile.fromJson(item)) : (throw '''$item was not one of (TextDocumentEdit, CreateFile, RenameFile, DeleteFile)''')))))
+                    ?.cast<Either4<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>>()
+                    ?.toList())
+                : (throw '''${json['documentChanges']} was not one of (List<TextDocumentEdit>, List<Either4<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>>)''')));
     final changeAnnotations = json['changeAnnotations']
         ?.map((key, value) => MapEntry(
             key, value != null ? ChangeAnnotation.fromJson(value) : null))
@@ -33661,10 +32205,10 @@
   /// Whether clients honor this property depends on the client capability
   /// `workspace.changeAnnotationSupport`.
   ///  @since 3.16.0
-  final Map<String, ChangeAnnotation> changeAnnotations;
+  final Map<String, ChangeAnnotation>? changeAnnotations;
 
   /// Holds changes to existing resources.
-  final Map<String, List<TextEdit>> changes;
+  final Map<String, List<TextEdit>>? changes;
 
   /// Depending on the client capability
   /// `workspace.workspaceEdit.resourceOperations` document changes are either
@@ -33680,7 +32224,7 @@
   /// `workspace.workspaceEdit.resourceOperations` then only plain `TextEdit`s
   /// using the `changes` property are supported.
   final Either2<List<TextDocumentEdit>,
-          List<Either4<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>>>
+          List<Either4<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>>>?
       documentChanges;
 
   Map<String, dynamic> toJson() {
@@ -33820,27 +32364,27 @@
   /// Whether the client in general supports change annotations on text edits,
   /// create file, rename file and delete file changes.
   ///  @since 3.16.0
-  final WorkspaceEditClientCapabilitiesChangeAnnotationSupport
+  final WorkspaceEditClientCapabilitiesChangeAnnotationSupport?
       changeAnnotationSupport;
 
   /// The client supports versioned document changes in `WorkspaceEdit`s
-  final bool documentChanges;
+  final bool? documentChanges;
 
   /// The failure handling strategy of a client if applying the workspace edit
   /// fails.
   ///  @since 3.13.0
-  final FailureHandlingKind failureHandling;
+  final FailureHandlingKind? failureHandling;
 
   /// Whether the client normalizes line endings to the client specific setting.
   /// If set to `true` the client will normalize line ending characters in a
   /// workspace edit to the client specific new line character(s).
   ///  @since 3.16.0
-  final bool normalizesLineEndings;
+  final bool? normalizesLineEndings;
 
   /// The resource operations the client supports. Clients should at least
   /// support 'create', 'rename' and 'delete' files and folders.
   ///  @since 3.13.0
-  final List<ResourceOperationKind> resourceOperations;
+  final List<ResourceOperationKind>? resourceOperations;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -33849,16 +32393,16 @@
     }
     if (resourceOperations != null) {
       __result['resourceOperations'] =
-          resourceOperations.map((item) => item.toJson()).toList();
+          resourceOperations?.map((item) => item.toJson()).toList();
     }
     if (failureHandling != null) {
-      __result['failureHandling'] = failureHandling.toJson();
+      __result['failureHandling'] = failureHandling?.toJson();
     }
     if (normalizesLineEndings != null) {
       __result['normalizesLineEndings'] = normalizesLineEndings;
     }
     if (changeAnnotationSupport != null) {
-      __result['changeAnnotationSupport'] = changeAnnotationSupport.toJson();
+      __result['changeAnnotationSupport'] = changeAnnotationSupport?.toJson();
     }
     return __result;
   }
@@ -33973,7 +32517,7 @@
   /// Whether the client groups edits with equal labels into tree nodes, for
   /// instance all edits labelled with "Changes in Strings" would be a tree
   /// node.
-  final bool groupsOnLabel;
+  final bool? groupsOnLabel;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -34027,14 +32571,7 @@
   static const jsonHandler =
       LspJsonHandler(WorkspaceFolder.canParse, WorkspaceFolder.fromJson);
 
-  WorkspaceFolder({@required this.uri, @required this.name}) {
-    if (uri == null) {
-      throw 'uri is required but was not provided';
-    }
-    if (name == null) {
-      throw 'name is required but was not provided';
-    }
-  }
+  WorkspaceFolder({required this.uri, required this.name});
   static WorkspaceFolder fromJson(Map<String, dynamic> json) {
     final uri = json['uri'];
     final name = json['name'];
@@ -34050,8 +32587,8 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['uri'] = uri ?? (throw 'uri is required but was not set');
-    __result['name'] = name ?? (throw 'name is required but was not set');
+    __result['uri'] = uri;
+    __result['name'] = name;
     return __result;
   }
 
@@ -34124,21 +32661,14 @@
       WorkspaceFoldersChangeEvent.canParse,
       WorkspaceFoldersChangeEvent.fromJson);
 
-  WorkspaceFoldersChangeEvent({@required this.added, @required this.removed}) {
-    if (added == null) {
-      throw 'added is required but was not provided';
-    }
-    if (removed == null) {
-      throw 'removed is required but was not provided';
-    }
-  }
+  WorkspaceFoldersChangeEvent({required this.added, required this.removed});
   static WorkspaceFoldersChangeEvent fromJson(Map<String, dynamic> json) {
     final added = json['added']
-        ?.map((item) => item != null ? WorkspaceFolder.fromJson(item) : null)
+        ?.map((item) => WorkspaceFolder.fromJson(item))
         ?.cast<WorkspaceFolder>()
         ?.toList();
     final removed = json['removed']
-        ?.map((item) => item != null ? WorkspaceFolder.fromJson(item) : null)
+        ?.map((item) => WorkspaceFolder.fromJson(item))
         ?.cast<WorkspaceFolder>()
         ?.toList();
     return WorkspaceFoldersChangeEvent(added: added, removed: removed);
@@ -34152,10 +32682,8 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['added'] = added?.map((item) => item.toJson())?.toList() ??
-        (throw 'added is required but was not set');
-    __result['removed'] = removed?.map((item) => item.toJson())?.toList() ??
-        (throw 'removed is required but was not set');
+    __result['added'] = added.map((item) => item.toJson()).toList();
+    __result['removed'] = removed.map((item) => item.toJson()).toList();
     return __result;
   }
 
@@ -34241,12 +32769,12 @@
   static WorkspaceFoldersServerCapabilities fromJson(
       Map<String, dynamic> json) {
     final supported = json['supported'];
-    final changeNotifications = json['changeNotifications'] is String
-        ? Either2<String, bool>.t1(json['changeNotifications'])
-        : (json['changeNotifications'] is bool
-            ? Either2<String, bool>.t2(json['changeNotifications'])
-            : (json['changeNotifications'] == null
-                ? null
+    final changeNotifications = json['changeNotifications'] == null
+        ? null
+        : (json['changeNotifications'] is String
+            ? Either2<String, bool>.t1(json['changeNotifications'])
+            : (json['changeNotifications'] is bool
+                ? Either2<String, bool>.t2(json['changeNotifications'])
                 : (throw '''${json['changeNotifications']} was not one of (String, bool)''')));
     return WorkspaceFoldersServerCapabilities(
         supported: supported, changeNotifications: changeNotifications);
@@ -34258,10 +32786,10 @@
   /// notification is registered on the client side. The ID can be used to
   /// unregister for these events using the `client/unregisterCapability`
   /// request.
-  final Either2<String, bool> changeNotifications;
+  final Either2<String, bool>? changeNotifications;
 
   /// The server has support for workspace folders
-  final bool supported;
+  final bool? supported;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -34351,16 +32879,16 @@
   }
 
   /// Symbol request supports dynamic registration.
-  final bool dynamicRegistration;
+  final bool? dynamicRegistration;
 
   /// Specific capabilities for the `SymbolKind` in the `workspace/symbol`
   /// request.
-  final WorkspaceSymbolClientCapabilitiesSymbolKind symbolKind;
+  final WorkspaceSymbolClientCapabilitiesSymbolKind? symbolKind;
 
   /// The client supports tags on `SymbolInformation`. Clients supporting tags
   /// have to handle unknown tags gracefully.
   ///  @since 3.16.0
-  final WorkspaceSymbolClientCapabilitiesTagSupport tagSupport;
+  final WorkspaceSymbolClientCapabilitiesTagSupport? tagSupport;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -34368,10 +32896,10 @@
       __result['dynamicRegistration'] = dynamicRegistration;
     }
     if (symbolKind != null) {
-      __result['symbolKind'] = symbolKind.toJson();
+      __result['symbolKind'] = symbolKind?.toJson();
     }
     if (tagSupport != null) {
-      __result['tagSupport'] = tagSupport.toJson();
+      __result['tagSupport'] = tagSupport?.toJson();
     }
     return __result;
   }
@@ -34465,12 +32993,12 @@
   ///
   /// If this property is not present the client only supports the symbol kinds
   /// from `File` to `Array` as defined in the initial version of the protocol.
-  final List<SymbolKind> valueSet;
+  final List<SymbolKind>? valueSet;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
     if (valueSet != null) {
-      __result['valueSet'] = valueSet.map((item) => item.toJson()).toList();
+      __result['valueSet'] = valueSet?.map((item) => item.toJson()).toList();
     }
     return __result;
   }
@@ -34524,15 +33052,11 @@
       WorkspaceSymbolClientCapabilitiesTagSupport.canParse,
       WorkspaceSymbolClientCapabilitiesTagSupport.fromJson);
 
-  WorkspaceSymbolClientCapabilitiesTagSupport({@required this.valueSet}) {
-    if (valueSet == null) {
-      throw 'valueSet is required but was not provided';
-    }
-  }
+  WorkspaceSymbolClientCapabilitiesTagSupport({required this.valueSet});
   static WorkspaceSymbolClientCapabilitiesTagSupport fromJson(
       Map<String, dynamic> json) {
     final valueSet = json['valueSet']
-        ?.map((item) => item != null ? SymbolTag.fromJson(item) : null)
+        ?.map((item) => SymbolTag.fromJson(item))
         ?.cast<SymbolTag>()
         ?.toList();
     return WorkspaceSymbolClientCapabilitiesTagSupport(valueSet: valueSet);
@@ -34543,8 +33067,7 @@
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['valueSet'] = valueSet?.map((item) => item.toJson())?.toList() ??
-        (throw 'valueSet is required but was not set');
+    __result['valueSet'] = valueSet.map((item) => item.toJson()).toList();
     return __result;
   }
 
@@ -34613,7 +33136,7 @@
     return WorkspaceSymbolOptions(workDoneProgress: workDoneProgress);
   }
 
-  final bool workDoneProgress;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
@@ -34669,26 +33192,22 @@
       WorkspaceSymbolParams.canParse, WorkspaceSymbolParams.fromJson);
 
   WorkspaceSymbolParams(
-      {@required this.query, this.workDoneToken, this.partialResultToken}) {
-    if (query == null) {
-      throw 'query is required but was not provided';
-    }
-  }
+      {required this.query, this.workDoneToken, this.partialResultToken});
   static WorkspaceSymbolParams fromJson(Map<String, dynamic> json) {
     final query = json['query'];
-    final workDoneToken = json['workDoneToken'] is num
-        ? Either2<num, String>.t1(json['workDoneToken'])
-        : (json['workDoneToken'] is String
-            ? Either2<num, String>.t2(json['workDoneToken'])
-            : (json['workDoneToken'] == null
-                ? null
+    final workDoneToken = json['workDoneToken'] == null
+        ? null
+        : (json['workDoneToken'] is num
+            ? Either2<num, String>.t1(json['workDoneToken'])
+            : (json['workDoneToken'] is String
+                ? Either2<num, String>.t2(json['workDoneToken'])
                 : (throw '''${json['workDoneToken']} was not one of (num, String)''')));
-    final partialResultToken = json['partialResultToken'] is num
-        ? Either2<num, String>.t1(json['partialResultToken'])
-        : (json['partialResultToken'] is String
-            ? Either2<num, String>.t2(json['partialResultToken'])
-            : (json['partialResultToken'] == null
-                ? null
+    final partialResultToken = json['partialResultToken'] == null
+        ? null
+        : (json['partialResultToken'] is num
+            ? Either2<num, String>.t1(json['partialResultToken'])
+            : (json['partialResultToken'] is String
+                ? Either2<num, String>.t2(json['partialResultToken'])
                 : (throw '''${json['partialResultToken']} was not one of (num, String)''')));
     return WorkspaceSymbolParams(
         query: query,
@@ -34698,18 +33217,18 @@
 
   /// An optional token that a server can use to report partial results (e.g.
   /// streaming) to the client.
-  final Either2<num, String> partialResultToken;
+  final Either2<num, String>? partialResultToken;
 
   /// A query string to filter symbols by. Clients may send an empty string here
   /// to request all symbols.
   final String query;
 
   /// An optional token that a server can use to report work done progress.
-  final Either2<num, String> workDoneToken;
+  final Either2<num, String>? workDoneToken;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
-    __result['query'] = query ?? (throw 'query is required but was not set');
+    __result['query'] = query;
     if (workDoneToken != null) {
       __result['workDoneToken'] = workDoneToken;
     }
@@ -34806,7 +33325,7 @@
         workDoneProgress: workDoneProgress);
   }
 
-  final bool workDoneProgress;
+  final bool? workDoneProgress;
 
   Map<String, dynamic> toJson() {
     var __result = <String, dynamic>{};
diff --git a/pkg/analysis_server/lib/lsp_protocol/protocol_special.dart b/pkg/analysis_server/lib/lsp_protocol/protocol_special.dart
index e1f4838..9ee8f63 100644
--- a/pkg/analysis_server/lib/lsp_protocol/protocol_special.dart
+++ b/pkg/analysis_server/lib/lsp_protocol/protocol_special.dart
@@ -2,8 +2,6 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-// @dart = 2.9
-
 import 'dart:async';
 
 import 'package:analysis_server/lsp_protocol/protocol_generated.dart';
@@ -15,10 +13,10 @@
 
 const NullJsonHandler = LspJsonHandler<Null>(_alwaysTrue, _alwaysNull);
 
-ErrorOr<R> cancelled<R>([R t]) =>
+ErrorOr<R> cancelled<R>() =>
     error(ErrorCodes.RequestCancelled, 'Request was cancelled', null);
 
-ErrorOr<R> error<R>(ErrorCodes code, String message, [String data]) =>
+ErrorOr<R> error<R>(ErrorCodes code, String message, [String? data]) =>
     ErrorOr<R>.error(ResponseError(code: code, message: message, data: data));
 
 ErrorOr<R> failure<R>(ErrorOr<dynamic> error) => ErrorOr<R>.error(error.error);
@@ -54,7 +52,7 @@
   return JenkinsSmiHash.finish(hash);
 }
 
-Object specToJson(Object obj) {
+Object? specToJson(Object? obj) {
   if (obj is ToJsonable) {
     return obj.toJson();
   } else {
@@ -62,7 +60,7 @@
   }
 }
 
-ErrorOr<R> success<R>([R t]) => ErrorOr<R>.success(t);
+ErrorOr<R> success<R>(R t) => ErrorOr<R>.success(t);
 
 Null _alwaysNull(_, [__]) => null;
 
@@ -70,13 +68,13 @@
 
 class Either2<T1, T2> {
   final int _which;
-  final T1 _t1;
-  final T2 _t2;
+  final T1? _t1;
+  final T2? _t2;
 
-  Either2.t1(this._t1)
+  Either2.t1(T1 this._t1)
       : _t2 = null,
         _which = 1;
-  Either2.t2(this._t2)
+  Either2.t2(T2 this._t2)
       : _t1 = null,
         _which = 2;
 
@@ -88,10 +86,10 @@
       o is Either2<T1, T2> && lspEquals(o._t1, _t1) && lspEquals(o._t2, _t2);
 
   T map<T>(T Function(T1) f1, T Function(T2) f2) {
-    return _which == 1 ? f1(_t1) : f2(_t2);
+    return _which == 1 ? f1(_t1 as T1) : f2(_t2 as T2);
   }
 
-  Object toJson() => map(specToJson, specToJson);
+  Object? toJson() => map(specToJson, specToJson);
 
   @override
   String toString() => map((t) => t.toString(), (t) => t.toString());
@@ -102,9 +100,9 @@
 
 class Either3<T1, T2, T3> {
   final int _which;
-  final T1 _t1;
-  final T2 _t2;
-  final T3 _t3;
+  final T1? _t1;
+  final T2? _t2;
+  final T3? _t3;
 
   Either3.t1(this._t1)
       : _t2 = null,
@@ -132,17 +130,17 @@
   T map<T>(T Function(T1) f1, T Function(T2) f2, T Function(T3) f3) {
     switch (_which) {
       case 1:
-        return f1(_t1);
+        return f1(_t1 as T1);
       case 2:
-        return f2(_t2);
+        return f2(_t2 as T2);
       case 3:
-        return f3(_t3);
+        return f3(_t3 as T3);
       default:
         throw 'Invalid state.';
     }
   }
 
-  Object toJson() => map(specToJson, specToJson, specToJson);
+  Object? toJson() => map(specToJson, specToJson, specToJson);
 
   @override
   String toString() => map(
@@ -157,10 +155,10 @@
 
 class Either4<T1, T2, T3, T4> {
   final int _which;
-  final T1 _t1;
-  final T2 _t2;
-  final T3 _t3;
-  final T4 _t4;
+  final T1? _t1;
+  final T2? _t2;
+  final T3? _t3;
+  final T4? _t4;
 
   Either4.t1(this._t1)
       : _t2 = null,
@@ -198,19 +196,19 @@
       T Function(T4) f4) {
     switch (_which) {
       case 1:
-        return f1(_t1);
+        return f1(_t1 as T1);
       case 2:
-        return f2(_t2);
+        return f2(_t2 as T2);
       case 3:
-        return f3(_t3);
+        return f3(_t3 as T3);
       case 4:
-        return f4(_t4);
+        return f4(_t4 as T4);
       default:
         throw 'Invalid state.';
     }
   }
 
-  Object toJson() => map(specToJson, specToJson, specToJson, specToJson);
+  Object? toJson() => map(specToJson, specToJson, specToJson, specToJson);
 
   @override
   String toString() => map(
@@ -227,12 +225,12 @@
 
 class ErrorOr<T> extends Either2<ResponseError, T> {
   ErrorOr.error(ResponseError error) : super.t1(error);
-  ErrorOr.success([T result]) : super.t2(result);
+  ErrorOr.success(T result) : super.t2(result);
 
   /// Returns the error or throws if object is not an error. Check [isError]
   /// before accessing [error].
   ResponseError get error {
-    return _which == 1 ? _t1 : (throw 'Value is not an error');
+    return _which == 1 ? _t1 as ResponseError : (throw 'Value is not an error');
   }
 
   /// Returns true if this object is an error, false if it is a result. Prefer
@@ -244,7 +242,7 @@
   /// before accessing [result]. It is valid for this to return null is the
   /// object does not represent an error but the resulting value was null.
   T get result {
-    return _which == 2 ? _t2 : (throw 'Value is not a result');
+    return _which == 2 ? _t2 as T : (throw 'Value is not a result');
   }
 
   /// If this object is a result, maps [result] through [f], otherwise returns
diff --git a/pkg/analysis_server/lib/src/context_manager.dart b/pkg/analysis_server/lib/src/context_manager.dart
index b44ab93..7b6cb5f 100644
--- a/pkg/analysis_server/lib/src/context_manager.dart
+++ b/pkg/analysis_server/lib/src/context_manager.dart
@@ -2,8 +2,6 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-// @dart = 2.9
-
 import 'dart:async';
 import 'dart:collection';
 import 'dart:core';
@@ -31,7 +29,6 @@
 import 'package:analyzer/src/workspace/bazel_watcher.dart';
 import 'package:analyzer_plugin/protocol/protocol_common.dart' as protocol;
 import 'package:analyzer_plugin/utilities/analyzer_converter.dart';
-import 'package:meta/meta.dart';
 import 'package:path/path.dart' as path;
 import 'package:watcher/watcher.dart';
 import 'package:yaml/yaml.dart';
@@ -49,18 +46,6 @@
 /// Class that maintains a mapping from included/excluded paths to a set of
 /// folders that should correspond to analysis contexts.
 abstract class ContextManager {
-  // TODO(brianwilkerson) Support:
-  //   setting the default analysis options
-  //   setting the default content cache
-  //   setting the default SDK
-  //   telling server when a context has been added or removed
-  //       (see onContextsChanged)
-  //   telling server when a context needs to be re-analyzed
-  //   notifying the client when results should be flushed
-  //   using analyzeFileFunctions to determine which files to analyze
-  //
-  // TODO(brianwilkerson) Move this class to a public library.
-
   /// Get the callback interface used to create, destroy, and update contexts.
   ContextManagerCallbacks get callbacks;
 
@@ -81,7 +66,7 @@
   /// Return the existing analysis context that should be used to analyze the
   /// given [path], or `null` if the [path] is not analyzed in any of the
   /// created analysis contexts.
-  DriverBasedAnalysisContext getContextFor(String path);
+  DriverBasedAnalysisContext? getContextFor(String path);
 
   /// Return the [AnalysisDriver] for the "innermost" context whose associated
   /// folder is or contains the given path.  ("innermost" refers to the nesting
@@ -90,7 +75,7 @@
   /// the context for /foo/bar.)
   ///
   /// If no driver contains the given path, `null` is returned.
-  AnalysisDriver getDriverFor(String path);
+  AnalysisDriver? getDriverFor(String path);
 
   /// Return `true` if the file or directory with the given [path] will be
   /// analyzed in one of the analysis contexts.
@@ -159,8 +144,9 @@
   /// The scheduler used to create analysis contexts, and report status.
   final AnalysisDriverScheduler _scheduler;
 
-  /// The current set of analysis contexts.
-  AnalysisContextCollectionImpl _collection;
+  /// The current set of analysis contexts, or `null` if the context roots have
+  /// not yet been set.
+  AnalysisContextCollectionImpl? _collection;
 
   /// The context used to work with file system paths.
   path.Context pathContext;
@@ -179,7 +165,7 @@
   final InstrumentationService _instrumentationService;
 
   @override
-  ContextManagerCallbacks callbacks;
+  ContextManagerCallbacks callbacks = NoopContextManagerCallbacks();
 
   @override
   final Map<Folder, AnalysisDriver> driverMap =
@@ -199,12 +185,12 @@
   /// to files generated by Bazel.
   ///
   /// Might be `null` if watching Bazel files is not enabled.
-  BazelFileWatcherService bazelWatcherService;
+  BazelFileWatcherService? bazelWatcherService;
 
   /// The subscription to changes in the files watched by [bazelWatcherService].
   ///
   /// Might be `null` if watching Bazel files is not enabled.
-  StreamSubscription<List<WatchEvent>> bazelWatcherSubscription;
+  StreamSubscription<List<WatchEvent>>? bazelWatcherSubscription;
 
   /// For each [Folder] store which files are being watched. This allows us to
   /// clean up when we destroy a context.
@@ -212,17 +198,17 @@
 
   ContextManagerImpl(this.resourceProvider, this.sdkManager, this._byteStore,
       this._performanceLog, this._scheduler, this._instrumentationService,
-      {@required enableBazelWatcher}) {
-    pathContext = resourceProvider.pathContext;
+      {required enableBazelWatcher})
+      : pathContext = resourceProvider.pathContext {
     if (enableBazelWatcher) {
       bazelWatcherService = BazelFileWatcherService(_instrumentationService);
-      bazelWatcherSubscription = bazelWatcherService.events
+      bazelWatcherSubscription = bazelWatcherService!.events
           .listen((events) => _handleBazelWatchEvents(events));
     }
   }
 
   @override
-  DriverBasedAnalysisContext getContextFor(String path) {
+  DriverBasedAnalysisContext? getContextFor(String path) {
     try {
       return _collection?.contextFor(path);
     } on StateError {
@@ -231,7 +217,7 @@
   }
 
   @override
-  AnalysisDriver getDriverFor(String path) {
+  AnalysisDriver? getDriverFor(String path) {
     return getContextFor(path)?.driver;
   }
 
@@ -368,7 +354,6 @@
               pubspecAst.accept(entry.value);
             }
             if (listener.errors.isNotEmpty) {
-              convertedErrors ??= <protocol.AnalysisError>[];
               convertedErrors.addAll(converter.convertAnalysisErrors(
                   listener.errors,
                   lineInfo: lineInfo,
@@ -411,7 +396,7 @@
   void _createAnalysisContexts() {
     _destroyAnalysisContexts();
 
-    _collection = AnalysisContextCollectionImpl(
+    var collection = _collection = AnalysisContextCollectionImpl(
       includedPaths: includedPaths,
       excludedPaths: excludedPaths,
       byteStore: _byteStore,
@@ -423,7 +408,7 @@
       sdkPath: sdkManager.defaultSdkDirectory,
     );
 
-    for (var analysisContext in _collection.contexts) {
+    for (var analysisContext in collection.contexts) {
       var driver = analysisContext.driver;
 
       callbacks.listenAnalysisDriver(driver);
@@ -473,15 +458,16 @@
     var watched = bazelWatchedPathsPerFolder.remove(rootFolder);
     if (watched != null) {
       for (var path in watched.paths) {
-        bazelWatcherService.stopWatching(watched.workspace, path);
+        bazelWatcherService!.stopWatching(watched.workspace, path);
       }
     }
     driverMap.remove(rootFolder);
   }
 
   void _destroyAnalysisContexts() {
-    if (_collection != null) {
-      for (var analysisContext in _collection.contexts) {
+    var collection = _collection;
+    if (collection != null) {
+      for (var analysisContext in collection.contexts) {
         _destroyAnalysisContext(analysisContext);
       }
       callbacks.afterContextsDestroyed();
@@ -550,8 +536,9 @@
       return;
     }
 
-    if (file_paths.isDart(pathContext, path)) {
-      for (var analysisContext in _collection.contexts) {
+    var collection = _collection;
+    if (collection != null && file_paths.isDart(pathContext, path)) {
+      for (var analysisContext in collection.contexts) {
         switch (type) {
           case ChangeType.ADD:
             if (analysisContext.contextRoot.isAnalyzed(path)) {
@@ -620,7 +607,7 @@
   /// Does nothing if the [driver] is not in a Bazel workspace.
   void _watchBazelFilesIfNeeded(Folder folder, AnalysisDriver analysisDriver) {
     if (!experimentalEnableBazelWatching) return;
-    var workspace = analysisDriver.analysisContext.contextRoot.workspace;
+    var workspace = analysisDriver.analysisContext?.contextRoot.workspace;
     if (workspace is BazelWorkspace &&
         !bazelSearchSubscriptions.containsKey(folder)) {
       var searchSubscription = workspace.bazelCandidateFiles.listen(
@@ -631,6 +618,29 @@
   }
 }
 
+class NoopContextManagerCallbacks implements ContextManagerCallbacks {
+  @override
+  void afterContextsCreated() {}
+
+  @override
+  void afterContextsDestroyed() {}
+
+  @override
+  void afterWatchEvent(WatchEvent event) {}
+
+  @override
+  void applyFileRemoved(String file) {}
+
+  @override
+  void broadcastWatchEvent(WatchEvent event) {}
+
+  @override
+  void listenAnalysisDriver(AnalysisDriver driver) {}
+
+  @override
+  void recordAnalysisErrors(String path, List<protocol.AnalysisError> errors) {}
+}
+
 class _BazelWatchedFiles {
   final String workspace;
   final paths = <String>{};
diff --git a/pkg/analysis_server/lib/src/lsp/client_capabilities.dart b/pkg/analysis_server/lib/src/lsp/client_capabilities.dart
index 2a2039a..2d7bc42 100644
--- a/pkg/analysis_server/lib/src/lsp/client_capabilities.dart
+++ b/pkg/analysis_server/lib/src/lsp/client_capabilities.dart
@@ -2,8 +2,6 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-// @dart = 2.9
-
 import 'package:analysis_server/lsp_protocol/protocol_generated.dart';
 
 /// Wraps the client (editor) capabilities to improve performance.
@@ -73,9 +71,9 @@
   final Set<CodeActionKind> codeActionKinds;
   final Set<CompletionItemTag> completionItemTags;
   final Set<DiagnosticTag> diagnosticTags;
-  final Set<MarkupKind> completionDocumentationFormats;
-  final Set<MarkupKind> signatureHelpDocumentationFormats;
-  final Set<MarkupKind> hoverContentFormats;
+  final Set<MarkupKind>? completionDocumentationFormats;
+  final Set<MarkupKind>? signatureHelpDocumentationFormats;
+  final Set<MarkupKind>? hoverContentFormats;
   final Set<SymbolKind> documentSymbolKinds;
   final Set<SymbolKind> workspaceSymbolKinds;
   final Set<CompletionItemKind> completionItemKinds;
@@ -83,9 +81,9 @@
   final bool experimentalSnippetTextEdit;
 
   LspClientCapabilities(this.raw)
-      : applyEdit = raw?.workspace?.applyEdit ?? false,
-        codeActionKinds = _listToSet(raw?.textDocument?.codeAction
-            ?.codeActionLiteralSupport?.codeActionKind?.valueSet),
+      : applyEdit = raw.workspace?.applyEdit ?? false,
+        codeActionKinds = _listToSet(raw.textDocument?.codeAction
+            ?.codeActionLiteralSupport?.codeActionKind.valueSet),
         completionDeprecatedFlag =
             raw.textDocument?.completion?.completionItem?.deprecatedSupport ??
                 false,
@@ -93,74 +91,76 @@
         completionInsertTextModes = _listToSet(raw.textDocument?.completion
             ?.completionItem?.insertTextModeSupport?.valueSet),
         completionItemKinds = _listToSet(
-            raw?.textDocument?.completion?.completionItemKind?.valueSet,
+            raw.textDocument?.completion?.completionItemKind?.valueSet,
             defaults: defaultSupportedCompletionKinds),
         completionSnippets =
             raw.textDocument?.completion?.completionItem?.snippetSupport ??
                 false,
-        configuration = raw?.workspace?.configuration ?? false,
+        configuration = raw.workspace?.configuration ?? false,
         createResourceOperations = raw
-                ?.workspace?.workspaceEdit?.resourceOperations
+                .workspace?.workspaceEdit?.resourceOperations
                 ?.contains(ResourceOperationKind.Create) ??
             false,
         definitionLocationLink =
-            raw?.textDocument?.definition?.linkSupport ?? false,
-        completionItemTags = _listToSet(raw
-            ?.textDocument?.completion?.completionItem?.tagSupport?.valueSet),
+            raw.textDocument?.definition?.linkSupport ?? false,
+        completionItemTags = _listToSet(
+            raw.textDocument?.completion?.completionItem?.tagSupport?.valueSet),
         diagnosticTags = _listToSet(
-            raw?.textDocument?.publishDiagnostics?.tagSupport?.valueSet),
+            raw.textDocument?.publishDiagnostics?.tagSupport?.valueSet),
         documentChanges =
-            raw?.workspace?.workspaceEdit?.documentChanges ?? false,
+            raw.workspace?.workspaceEdit?.documentChanges ?? false,
         documentSymbolKinds = _listToSet(
-            raw?.textDocument?.documentSymbol?.symbolKind?.valueSet,
+            raw.textDocument?.documentSymbol?.symbolKind?.valueSet,
             defaults: defaultSupportedSymbolKinds),
-        hierarchicalSymbols = raw?.textDocument?.documentSymbol
+        hierarchicalSymbols = raw.textDocument?.documentSymbol
                 ?.hierarchicalDocumentSymbolSupport ??
             false,
         hoverContentFormats = _hoverContentFormats(raw),
-        insertReplaceCompletionRanges = raw?.textDocument?.completion
+        insertReplaceCompletionRanges = raw.textDocument?.completion
                 ?.completionItem?.insertReplaceSupport ??
             false,
         literalCodeActions =
-            raw?.textDocument?.codeAction?.codeActionLiteralSupport != null,
+            raw.textDocument?.codeAction?.codeActionLiteralSupport != null,
         renameValidation = raw.textDocument?.rename?.prepareSupport ?? false,
         signatureHelpDocumentationFormats = _sigHelpDocumentationFormats(raw),
         workDoneProgress = raw.window?.workDoneProgress ?? false,
         workspaceSymbolKinds = _listToSet(
-            raw?.workspace?.symbol?.symbolKind?.valueSet,
+            raw.workspace?.symbol?.symbolKind?.valueSet,
             defaults: defaultSupportedSymbolKinds),
         experimentalSnippetTextEdit =
             raw.experimental is Map<String, dynamic> &&
                 raw.experimental['snippetTextEdit'] == true;
 
-  static Set<MarkupKind> _completionDocumentationFormats(
+  static Set<MarkupKind>? _completionDocumentationFormats(
       ClientCapabilities raw) {
     // For formats, null is valid (which means only raw strings are supported,
-    // not [MarkupContent]), so use null as default.
-    return _listToSet(
-        raw?.textDocument?.completion?.completionItem?.documentationFormat,
-        defaults: null);
+    // not [MarkupContent]).
+    return _listToNullableSet(
+        raw.textDocument?.completion?.completionItem?.documentationFormat);
   }
 
-  static Set<MarkupKind> _hoverContentFormats(ClientCapabilities raw) {
+  static Set<MarkupKind>? _hoverContentFormats(ClientCapabilities raw) {
     // For formats, null is valid (which means only raw strings are supported,
     // not [MarkupContent]), so use null as default.
-    return _listToSet(raw?.textDocument?.hover?.contentFormat, defaults: null);
+    return _listToNullableSet(raw.textDocument?.hover?.contentFormat);
+  }
+
+  /// Converts a list to a `Set`, returning null if the list is null.
+  static Set<T>? _listToNullableSet<T>(List<T>? items) {
+    return items != null ? {...items} : null;
   }
 
   /// Converts a list to a `Set`, returning [defaults] if the list is null.
   ///
   /// If [defaults] is not supplied, will return an empty set.
-  static Set<T> _listToSet<T>(List<T> items, {Set<T> defaults = const {}}) {
+  static Set<T> _listToSet<T>(List<T>? items, {Set<T> defaults = const {}}) {
     return items != null ? {...items} : defaults;
   }
 
-  static Set<MarkupKind> _sigHelpDocumentationFormats(ClientCapabilities raw) {
+  static Set<MarkupKind>? _sigHelpDocumentationFormats(ClientCapabilities raw) {
     // For formats, null is valid (which means only raw strings are supported,
     // not [MarkupContent]), so use null as default.
-    return _listToSet(
-        raw?.textDocument?.signatureHelp?.signatureInformation
-            ?.documentationFormat,
-        defaults: null);
+    return _listToNullableSet(raw.textDocument?.signatureHelp
+        ?.signatureInformation?.documentationFormat);
   }
 }
diff --git a/pkg/analysis_server/lib/src/lsp/constants.dart b/pkg/analysis_server/lib/src/lsp/constants.dart
index d04c276..952a5c5 100644
--- a/pkg/analysis_server/lib/src/lsp/constants.dart
+++ b/pkg/analysis_server/lib/src/lsp/constants.dart
@@ -2,8 +2,6 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-// @dart = 2.9
-
 import 'package:analysis_server/lsp_protocol/protocol_generated.dart';
 import 'package:analysis_server/lsp_protocol/protocol_special.dart';
 
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/commands/organize_imports.dart b/pkg/analysis_server/lib/src/lsp/handlers/commands/organize_imports.dart
index 998a39e..459a0f3 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/commands/organize_imports.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/commands/organize_imports.dart
@@ -53,7 +53,7 @@
         // LSP requests return errors).
         server.instrumentationService.logInfo(
             'Unable to $commandName because the file contains parse errors');
-        return success();
+        return success(null);
       }
 
       final organizer = ImportOrganizer(code, unit, result.errors);
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/commands/simple_edit_handler.dart b/pkg/analysis_server/lib/src/lsp/handlers/commands/simple_edit_handler.dart
index 0b3a4ef..5494e3e 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/commands/simple_edit_handler.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/commands/simple_edit_handler.dart
@@ -36,7 +36,7 @@
     // If there are no edits to apply, just complete the command without going
     // back to the client.
     if (edits.isEmpty) {
-      return success();
+      return success(null);
     }
 
     final workspaceEdit = toWorkspaceEdit(
@@ -70,7 +70,7 @@
     final editResponseResult =
         ApplyWorkspaceEditResponse.fromJson(editResponse.result);
     if (editResponseResult.applied) {
-      return success();
+      return success(null);
     } else {
       return error(
         ServerErrorCodes.ClientFailedToApplyEdit,
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_reanalyze.dart b/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_reanalyze.dart
index cd62bcc..ed8824fc 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_reanalyze.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_reanalyze.dart
@@ -21,6 +21,6 @@
   @override
   Future<ErrorOr<void>> handle(void _, CancellationToken token) async {
     server.reanalyze();
-    return success();
+    return success(null);
   }
 }
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_cancel_request.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_cancel_request.dart
index 1bdc3db..46c0e60 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/handler_cancel_request.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_cancel_request.dart
@@ -36,6 +36,6 @@
     // cancellation that we processed after already starting to send the response
     // and cleared the token.
     _tokens[params.id.toString()]?.cancel();
-    return success();
+    return success(null);
   }
 }
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_change_workspace_folders.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_change_workspace_folders.dart
index cf360d1..9b7df1e 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/handler_change_workspace_folders.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_change_workspace_folders.dart
@@ -29,7 +29,7 @@
       DidChangeWorkspaceFoldersParams params, CancellationToken token) {
     // Don't do anything if our analysis roots are not based on open workspaces.
     if (!updateAnalysisRoots) {
-      return success();
+      return success(null);
     }
 
     final added = params?.event?.added
@@ -42,6 +42,6 @@
 
     server.updateWorkspaceFolders(added, removed);
 
-    return success();
+    return success(null);
   }
 }
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_exit.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_exit.dart
index bb33c81..89a4776 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/handler_exit.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_exit.dart
@@ -36,6 +36,6 @@
     Future(() {
       exit(clientDidCallShutdown ? 0 : 1);
     });
-    return success();
+    return success(null);
   }
 }
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_format_on_type.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_format_on_type.dart
index cc07266..2c3b193 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/handler_format_on_type.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_format_on_type.dart
@@ -31,7 +31,7 @@
 
     final result = server.getParsedUnit(path);
     if (result.state != ResultState.VALID || result.errors.isNotEmpty) {
-      return success();
+      return success(null);
     }
 
     return generateEditsForFormatting(
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_format_range.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_format_range.dart
index bc83804..934cd2a 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/handler_format_range.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_format_range.dart
@@ -31,7 +31,7 @@
 
     final result = server.getParsedUnit(path);
     if (result.state != ResultState.VALID || result.errors.isNotEmpty) {
-      return success();
+      return success(null);
     }
 
     return generateEditsForFormatting(
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_formatting.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_formatting.dart
index eefcd07..e2cf8e1 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/handler_formatting.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_formatting.dart
@@ -31,7 +31,7 @@
 
     final result = server.getParsedUnit(path);
     if (result.state != ResultState.VALID || result.errors.isNotEmpty) {
-      return success();
+      return success(null);
     }
 
     return generateEditsForFormatting(
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_initialized.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_initialized.dart
index 98922d8..114216b 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/handler_initialized.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_initialized.dart
@@ -36,6 +36,6 @@
       server.updateWorkspaceFolders(openWorkspacePaths, const []);
     }
 
-    return success();
+    return success(null);
   }
 }
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_references.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_references.dart
index 31f5872..bfd1405 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/handler_references.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_references.dart
@@ -67,7 +67,7 @@
       element = (element as PropertyAccessorElement).variable;
     }
     if (element == null) {
-      return success();
+      return success(null);
     }
 
     final computer = ElementReferencesComputer(server.searchEngine);
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_shutdown.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_shutdown.dart
index 9746f3a..a94c410 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/handler_shutdown.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_shutdown.dart
@@ -27,6 +27,6 @@
     // We can clean up and shut down here, but we cannot terminate the server
     // because that must be done after the exit notification.
 
-    return success();
+    return success(null);
   }
 }
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_signature_help.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_signature_help.dart
index 5d97030..3dd708c 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/handler_signature_help.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_signature_help.dart
@@ -52,11 +52,11 @@
           unit.result.unit,
           offset);
       if (!computer.offsetIsValid) {
-        return success(); // No error, just no valid hover.
+        return success(null); // No error, just no valid hover.
       }
       final signature = computer.compute();
       if (signature == null) {
-        return success(); // No error, just no valid hover.
+        return success(null); // No error, just no valid hover.
       }
 
       // Skip results if this was an auto-trigger but not from the start of the
@@ -66,7 +66,7 @@
       if (autoTriggered &&
           computer.argumentList != null &&
           offset != computer.argumentList.offset + 1) {
-        return success();
+        return success(null);
       }
 
       final formats =
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_states.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_states.dart
index d1194ee..27041af 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/handler_states.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_states.dart
@@ -131,7 +131,7 @@
     if (message is! RequestMessage) {
       server.instrumentationService
           .logInfo('Ignoring ${message.method} message while initializing');
-      return success();
+      return success(null);
     }
     return error(
         ErrorCodes.ServerNotInitialized,
@@ -151,7 +151,7 @@
     if (message is! RequestMessage) {
       server.instrumentationService
           .logInfo('Ignoring ${message.method} message while shutting down');
-      return success();
+      return success(null);
     }
     return error(ErrorCodes.InvalidRequest,
         'Unable to handle ${message.method} after shutdown request');
@@ -171,7 +171,7 @@
     if (message is! RequestMessage) {
       server.instrumentationService
           .logInfo('Ignoring ${message.method} message while uninitialized');
-      return success();
+      return success(null);
     }
     return error(ErrorCodes.ServerNotInitialized,
         'Unable to handle ${message.method} before client has sent initialize request');
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_text_document_changes.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_text_document_changes.dart
index c6addff..a03eb33 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/handler_text_document_changes.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_text_document_changes.dart
@@ -23,13 +23,13 @@
       DidChangeTextDocumentParams.jsonHandler;
 
   @override
-  ErrorOr<void> handle(
+  ErrorOr<Null> handle(
       DidChangeTextDocumentParams params, CancellationToken token) {
     final path = pathOfDoc(params.textDocument);
     return path.mapResult((path) => _changeFile(path, params));
   }
 
-  ErrorOr<void> _changeFile(String path, DidChangeTextDocumentParams params) {
+  ErrorOr<Null> _changeFile(String path, DidChangeTextDocumentParams params) {
     String oldContents;
     if (server.resourceProvider.hasOverlay(path)) {
       oldContents = server.resourceProvider.getFile(path).readAsStringSync();
@@ -49,7 +49,7 @@
     return newContents.mapResult((result) {
       server.documentVersions[path] = params.textDocument;
       server.onOverlayUpdated(path, result.last, newContent: result.first);
-      return success();
+      return success(null);
     });
   }
 }
@@ -66,7 +66,7 @@
       DidCloseTextDocumentParams.jsonHandler;
 
   @override
-  ErrorOr<void> handle(
+  ErrorOr<Null> handle(
       DidCloseTextDocumentParams params, CancellationToken token) {
     final path = pathOfDoc(params.textDocument);
     return path.mapResult((path) {
@@ -74,7 +74,7 @@
       server.documentVersions.remove(path);
       server.onOverlayDestroyed(path);
 
-      return success();
+      return success(null);
     });
   }
 }
@@ -91,7 +91,7 @@
       DidOpenTextDocumentParams.jsonHandler;
 
   @override
-  ErrorOr<void> handle(
+  ErrorOr<Null> handle(
       DidOpenTextDocumentParams params, CancellationToken token) {
     final doc = params.textDocument;
     final path = pathOfDocItem(doc);
@@ -110,7 +110,7 @@
 
       server.addPriorityFile(path);
 
-      return success();
+      return success(null);
     });
   }
 }
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_workspace_configuration.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_workspace_configuration.dart
index 3be46d8..067641c 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/handler_workspace_configuration.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_workspace_configuration.dart
@@ -30,6 +30,6 @@
     // whenever we are told they may have changed.
     await server.fetchClientConfigurationAndPerformDynamicRegistration();
 
-    return success();
+    return success(null);
   }
 }
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handlers.dart b/pkg/analysis_server/lib/src/lsp/handlers/handlers.dart
index 3f5def6..4a26e3c 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/handlers.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/handlers.dart
@@ -202,7 +202,7 @@
     // Otherwise respond with failure. Optional Requests must still be responded
     // to so they don't leave open requests on the client.
     return _isOptionalNotification(message)
-        ? success()
+        ? success(null)
         : error(ErrorCodes.MethodNotFound, 'Unknown method ${message.method}');
   }
 
diff --git a/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart b/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
index 076172d..c987a3f 100644
--- a/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
+++ b/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
@@ -805,23 +805,12 @@
     analysisServer.declarationsTracker
         ?.addContext(analysisDriver.analysisContext);
 
-    final supportedDiagnosticTags =
-        analysisServer.clientCapabilities.diagnosticTags;
     analysisDriver.results.listen((result) {
       var path = result.path;
       filesToFlush.add(path);
       if (analysisServer.isAnalyzed(path)) {
-        final serverErrors = protocol.mapEngineErrors(
-            result,
-            result.errors.where(_shouldSendDiagnostic).toList(),
-            (result, error, [severity]) => toDiagnostic(
-                  result,
-                  error,
-                  supportedTags: supportedDiagnosticTags,
-                  errorSeverity: severity,
-                ));
-
-        analysisServer.publishDiagnostics(result.path, serverErrors);
+        final serverErrors = protocol.doAnalysisError_listFromEngine(result);
+        recordAnalysisErrors(result.path, serverErrors);
       }
       if (result.unit != null) {
         if (analysisServer.shouldSendClosingLabelsFor(path)) {
@@ -854,12 +843,13 @@
 
   @override
   void recordAnalysisErrors(String path, List<protocol.AnalysisError> errors) {
+    final errorsToSend = errors.where(_shouldSendError).toList();
     filesToFlush.add(path);
     analysisServer.notificationManager
-        .recordAnalysisErrors(NotificationManager.serverId, path, errors);
+        .recordAnalysisErrors(NotificationManager.serverId, path, errorsToSend);
   }
 
-  bool _shouldSendDiagnostic(AnalysisError error) =>
-      error.errorCode.type != ErrorType.TODO ||
+  bool _shouldSendError(protocol.AnalysisError error) =>
+      error.code != ErrorType.TODO.name.toLowerCase() ||
       analysisServer.clientConfiguration.showTodos;
 }
diff --git a/pkg/analysis_server/lib/src/lsp/mapping.dart b/pkg/analysis_server/lib/src/lsp/mapping.dart
index 388fbdc..3f0b00c 100644
--- a/pkg/analysis_server/lib/src/lsp/mapping.dart
+++ b/pkg/analysis_server/lib/src/lsp/mapping.dart
@@ -24,7 +24,6 @@
 import 'package:analysis_server/src/search/workspace_symbols.dart' as server
     show DeclarationKind;
 import 'package:analyzer/dart/analysis/results.dart' as server;
-import 'package:analyzer/diagnostic/diagnostic.dart' as analyzer;
 import 'package:analyzer/error/error.dart' as server;
 import 'package:analyzer/source/line_info.dart' as server;
 import 'package:analyzer/source/source_range.dart' as server;
@@ -35,20 +34,22 @@
 import 'package:analyzer_plugin/utilities/pair.dart';
 import 'package:meta/meta.dart';
 
-const diagnosticTagsForErrorCode = <server.ErrorCode, List<lsp.DiagnosticTag>>{
-  HintCode.DEAD_CODE: [lsp.DiagnosticTag.Unnecessary],
-  HintCode.DEPRECATED_MEMBER_USE: [lsp.DiagnosticTag.Deprecated],
-  HintCode.DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE: [
-    lsp.DiagnosticTag.Deprecated
-  ],
-  HintCode.DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE_WITH_MESSAGE: [
-    lsp.DiagnosticTag.Deprecated
-  ],
-  HintCode.DEPRECATED_MEMBER_USE_WITH_MESSAGE: [lsp.DiagnosticTag.Deprecated],
-};
-
 const languageSourceName = 'dart';
 
+final diagnosticTagsForErrorCode = <String, List<lsp.DiagnosticTag>>{
+  _errorCode(HintCode.DEAD_CODE): [lsp.DiagnosticTag.Unnecessary],
+  _errorCode(HintCode.DEPRECATED_MEMBER_USE): [lsp.DiagnosticTag.Deprecated],
+  _errorCode(HintCode.DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE): [
+    lsp.DiagnosticTag.Deprecated
+  ],
+  _errorCode(HintCode.DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE_WITH_MESSAGE): [
+    lsp.DiagnosticTag.Deprecated
+  ],
+  _errorCode(HintCode.DEPRECATED_MEMBER_USE_WITH_MESSAGE): [
+    lsp.DiagnosticTag.Deprecated
+  ],
+};
+
 lsp.Either2<String, lsp.MarkupContent> asStringOrMarkupContent(
     Set<lsp.MarkupKind> preferredFormats, String content) {
   if (content == null) {
@@ -625,12 +626,12 @@
 }
 
 List<lsp.DiagnosticTag> getDiagnosticTags(
-    Set<lsp.DiagnosticTag> supportedTags, server.AnalysisError error) {
+    Set<lsp.DiagnosticTag> supportedTags, plugin.AnalysisError error) {
   if (supportedTags == null) {
     return null;
   }
 
-  final tags = diagnosticTagsForErrorCode[error.errorCode]
+  final tags = diagnosticTagsForErrorCode[error.code]
       ?.where(supportedTags.contains)
       ?.toList();
 
@@ -717,8 +718,9 @@
 
 lsp.Diagnostic pluginToDiagnostic(
   server.LineInfo Function(String) getLineInfo,
-  plugin.AnalysisError error,
-) {
+  plugin.AnalysisError error, {
+  @required Set<lsp.DiagnosticTag> supportedTags,
+}) {
   List<lsp.DiagnosticRelatedInformation> relatedInformation;
   if (error.contextMessages != null && error.contextMessages.isNotEmpty) {
     relatedInformation = error.contextMessages
@@ -739,6 +741,7 @@
     code: error.code,
     source: languageSourceName,
     message: message,
+    tags: getDiagnosticTags(supportedTags, error),
     relatedInformation: relatedInformation,
   );
 }
@@ -996,67 +999,10 @@
   server.AnalysisError error, {
   @required Set<lsp.DiagnosticTag> supportedTags,
   server.ErrorSeverity errorSeverity,
-}) {
-  var errorCode = error.errorCode;
-
-  // Default to the error's severity if none is specified.
-  errorSeverity ??= errorCode.errorSeverity;
-
-  List<lsp.DiagnosticRelatedInformation> relatedInformation;
-  if (error.contextMessages.isNotEmpty) {
-    relatedInformation = error.contextMessages
-        .map((message) => toDiagnosticRelatedInformation(result, message))
-        .toList();
-  }
-
-  var message = error.message;
-  if (error.correctionMessage != null) {
-    message = '$message\n${error.correctionMessage}';
-  }
-
-  return lsp.Diagnostic(
-    range: toRange(result.lineInfo, error.offset, error.length),
-    severity: toDiagnosticSeverity(errorSeverity),
-    code: errorCode.name.toLowerCase(),
-    source: languageSourceName,
-    message: message,
-    tags: getDiagnosticTags(supportedTags, error),
-    relatedInformation: relatedInformation,
-  );
-}
-
-lsp.DiagnosticRelatedInformation toDiagnosticRelatedInformation(
-    server.ResolvedUnitResult result, analyzer.DiagnosticMessage message) {
-  var file = message.filePath;
-  var lineInfo = result.session.getFile(file).lineInfo;
-  return lsp.DiagnosticRelatedInformation(
-      location: lsp.Location(
-        uri: Uri.file(file).toString(),
-        range: toRange(
-          lineInfo,
-          message.offset,
-          message.length,
-        ),
-      ),
-      message: message.message);
-}
-
-lsp.DiagnosticSeverity toDiagnosticSeverity(server.ErrorSeverity severity) {
-  switch (severity) {
-    case server.ErrorSeverity.ERROR:
-      return lsp.DiagnosticSeverity.Error;
-    case server.ErrorSeverity.WARNING:
-      return lsp.DiagnosticSeverity.Warning;
-    case server.ErrorSeverity.INFO:
-      return lsp.DiagnosticSeverity.Information;
-    // Note: LSP also supports "Hint", but they won't render in things like the
-    // VS Code errors list as they're apparently intended to communicate
-    // non-visible diagnostics back (for example, if you wanted to grey out
-    // unreachable code without producing an item in the error list).
-    default:
-      throw 'Unknown AnalysisErrorSeverity: $severity';
-  }
-}
+}) =>
+    pluginToDiagnostic((_) => result.lineInfo,
+        server.newAnalysisError_fromEngine(result, error),
+        supportedTags: supportedTags);
 
 lsp.Element toElement(server.LineInfo lineInfo, server.Element element) =>
     lsp.Element(
@@ -1481,3 +1427,5 @@
 
   return Pair(insertText, insertTextFormat);
 }
+
+String _errorCode(server.ErrorCode code) => code.name.toLowerCase();
diff --git a/pkg/analysis_server/lib/src/lsp/notification_manager.dart b/pkg/analysis_server/lib/src/lsp/notification_manager.dart
index e6506bd..0866a25 100644
--- a/pkg/analysis_server/lib/src/lsp/notification_manager.dart
+++ b/pkg/analysis_server/lib/src/lsp/notification_manager.dart
@@ -30,7 +30,11 @@
   void sendAnalysisErrors(
       String filePath, List<protocol.AnalysisError> errors) {
     final diagnostics = errors
-        .map((error) => pluginToDiagnostic(server.getLineInfo, error))
+        .map((error) => pluginToDiagnostic(
+              server.getLineInfo,
+              error,
+              supportedTags: server.clientCapabilities.diagnosticTags,
+            ))
         .toList();
 
     final params = PublishDiagnosticsParams(
diff --git a/pkg/analysis_server/lib/src/lsp/semantic_tokens/encoder.dart b/pkg/analysis_server/lib/src/lsp/semantic_tokens/encoder.dart
index a3de7dd..f2e88e1 100644
--- a/pkg/analysis_server/lib/src/lsp/semantic_tokens/encoder.dart
+++ b/pkg/analysis_server/lib/src/lsp/semantic_tokens/encoder.dart
@@ -2,8 +2,6 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-// @dart = 2.9
-
 import 'dart:collection';
 import 'dart:math' as math;
 
@@ -34,12 +32,10 @@
         .where((region) => highlightRegionTokenTypes.containsKey(region.type));
 
     for (final region in translatedRegions) {
-      final tokenType = highlightRegionTokenTypes[region.type];
-
       tokens.add(SemanticTokenInfo(
         region.offset,
         region.length,
-        tokenType,
+        highlightRegionTokenTypes[region.type]!,
         highlightRegionTokenModifiers[region.type],
       ));
     }
@@ -73,7 +69,7 @@
         relativeColumn,
         token.length,
         semanticTokenLegend.indexForType(token.type),
-        semanticTokenLegend.bitmaskForModifiers(token.modifiers) ?? 0
+        semanticTokenLegend.bitmaskForModifiers(token.modifiers)
       ]);
 
       lastLine = tokenLine;
@@ -126,17 +122,15 @@
     var pos = firstToken.offset;
 
     for (final current in sortedTokens.skip(1)) {
-      if (stack.last != null) {
-        final last = stack.last;
-        final newPos = current.offset;
-        if (newPos - pos > 0) {
-          // The previous region ends at either its original end or
-          // the position of this next region, whichever is shorter.
-          final end = math.min(last.offset + last.length, newPos);
-          final length = end - pos;
-          yield SemanticTokenInfo(pos, length, last.type, last.modifiers);
-          pos = newPos;
-        }
+      final last = stack.last;
+      final newPos = current.offset;
+      if (newPos - pos > 0) {
+        // The previous region ends at either its original end or
+        // the position of this next region, whichever is shorter.
+        final end = math.min(last.offset + last.length, newPos);
+        final length = end - pos;
+        yield SemanticTokenInfo(pos, length, last.type, last.modifiers);
+        pos = newPos;
       }
 
       stack.addLast(current);
@@ -159,7 +153,7 @@
   final int offset;
   final int length;
   final SemanticTokenTypes type;
-  final Set<SemanticTokenModifiers> modifiers;
+  final Set<SemanticTokenModifiers>? modifiers;
 
   SemanticTokenInfo(this.offset, this.length, this.type, this.modifiers);
 
diff --git a/pkg/analysis_server/lib/src/lsp/semantic_tokens/legend.dart b/pkg/analysis_server/lib/src/lsp/semantic_tokens/legend.dart
index 2b7c3e4..5106306 100644
--- a/pkg/analysis_server/lib/src/lsp/semantic_tokens/legend.dart
+++ b/pkg/analysis_server/lib/src/lsp/semantic_tokens/legend.dart
@@ -2,8 +2,6 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-// @dart = 2.9
-
 import 'dart:math' as math;
 
 import 'package:analysis_server/lsp_protocol/protocol_generated.dart';
@@ -17,17 +15,17 @@
 /// [SemanticTokenModifiers].
 class SemanticTokenLegendLookup {
   /// An LSP [SemanticTokensLegend] describing all supported tokens and modifiers.
-  SemanticTokensLegend lspLegend;
+  late SemanticTokensLegend lspLegend;
 
   /// All [SemanticTokenModifiers] the server may generate. The order of these
   /// items is important as the indexes will be used in communication between
   /// server and client.
-  List<SemanticTokenModifiers> _usedTokenModifiers;
+  late List<SemanticTokenModifiers> _usedTokenModifiers;
 
   /// All [SemanticTokenTypes] the server may generate. The order of these
   /// items is important as the indexes will be used in communication betewen
   /// server and client.
-  List<SemanticTokenTypes> _usedTokenTypes;
+  late List<SemanticTokenTypes> _usedTokenTypes;
 
   SemanticTokenLegendLookup() {
     // Build lists of all tokens and modifiers that exist in our mappings or that
@@ -51,13 +49,14 @@
     );
   }
 
-  int bitmaskForModifiers(Set<SemanticTokenModifiers> modifiers) {
+  int bitmaskForModifiers(Set<SemanticTokenModifiers>? modifiers) {
     // Modifiers use a bit mask where each bit represents the index of a modifier.
     // 001001 would indicate the 1st and 4th modifiers are applied.
     return modifiers
             ?.map(_usedTokenModifiers.indexOf)
-            ?.map((index) => math.pow(2, index))
-            ?.reduce((a, b) => a + b) ??
+            .map((index) => math.pow(2, index))
+            .reduce((a, b) => a + b)
+            .toInt() ??
         0;
   }
 
diff --git a/pkg/analysis_server/lib/src/lsp/semantic_tokens/mapping.dart b/pkg/analysis_server/lib/src/lsp/semantic_tokens/mapping.dart
index 34c7909..66e4b26 100644
--- a/pkg/analysis_server/lib/src/lsp/semantic_tokens/mapping.dart
+++ b/pkg/analysis_server/lib/src/lsp/semantic_tokens/mapping.dart
@@ -2,8 +2,6 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-// @dart = 2.9
-
 import 'package:analysis_server/lsp_protocol/protocol_generated.dart';
 import 'package:analysis_server/src/lsp/constants.dart';
 import 'package:analysis_server/src/lsp/semantic_tokens/legend.dart';
@@ -154,7 +152,7 @@
     // for faster lookups.
     for (final regionType in highlightRegionTokenTypes.keys) {
       _tokenTypeIndexForHighlightRegion[regionType] = semanticTokenLegend
-          .indexForType(highlightRegionTokenTypes[regionType]);
+          .indexForType(highlightRegionTokenTypes[regionType]!);
     }
 
     for (final regionType in highlightRegionTokenTypes.keys) {
@@ -166,10 +164,10 @@
   /// Gets the [SemanticTokenModifiers] bitmask for a [HighlightRegionType]. Returns
   /// null if the region type has not been mapped.
   int bitmaskForModifier(HighlightRegionType type) =>
-      _tokenModifierBitmaskForHighlightRegion[type];
+      _tokenModifierBitmaskForHighlightRegion[type]!;
 
   /// Gets the [SemanticTokenTypes] index for a [HighlightRegionType]. Returns
   /// null if the region type has not been mapped.
   int indexForToken(HighlightRegionType type) =>
-      _tokenTypeIndexForHighlightRegion[type];
+      _tokenTypeIndexForHighlightRegion[type]!;
 }
diff --git a/pkg/analysis_server/lib/src/lsp/source_edits.dart b/pkg/analysis_server/lib/src/lsp/source_edits.dart
index a1004f1..f4975617 100644
--- a/pkg/analysis_server/lib/src/lsp/source_edits.dart
+++ b/pkg/analysis_server/lib/src/lsp/source_edits.dart
@@ -99,12 +99,12 @@
     // use seeing edits on every save with invalid code (if LSP gains the
     // ability to pass a context to know if the format was manually invoked
     // we may wish to change this to return an error for that case).
-    return success();
+    return success(null);
   }
   final formattedSource = formattedResult.text;
 
   if (formattedSource == unformattedSource) {
-    return success();
+    return success(null);
   }
 
   return _generateMinimalEdits(result, formattedSource, range: range);
diff --git a/pkg/analysis_server/test/lsp/diagnostic_test.dart b/pkg/analysis_server/test/lsp/diagnostic_test.dart
index a380a07..0d066fe 100644
--- a/pkg/analysis_server/test/lsp/diagnostic_test.dart
+++ b/pkg/analysis_server/test/lsp/diagnostic_test.dart
@@ -266,6 +266,44 @@
     await checkPluginErrorsForFile(mainFilePath);
   }
 
+  Future<void> test_fromPlugins_dartFile_combined() async {
+    // Check that if code has both a plugin and a server error, that when the
+    // plugin produces an error, it comes through _with_ the server-produced
+    // error.
+    // https://github.com/dart-lang/sdk/issues/45678
+    //
+    final serverErrorMessage =
+        "A value of type 'int' can't be assigned to a variable of type 'String'";
+    final pluginErrorMessage = 'Test error from plugin';
+
+    newFile(mainFilePath, content: 'String a = 1;');
+    final initialDiagnosticsFuture = waitForDiagnostics(mainFileUri);
+    await initialize();
+    final initialDiagnostics = await initialDiagnosticsFuture;
+    expect(initialDiagnostics, hasLength(1));
+    expect(initialDiagnostics.first.message, contains(serverErrorMessage));
+
+    final pluginTriggeredDiagnosticFuture = waitForDiagnostics(mainFileUri);
+    final pluginError = plugin.AnalysisError(
+      plugin.AnalysisErrorSeverity.ERROR,
+      plugin.AnalysisErrorType.STATIC_TYPE_WARNING,
+      plugin.Location(mainFilePath, 0, 1, 0, 0, 0, 1),
+      pluginErrorMessage,
+      'ERR1',
+    );
+    final pluginResult =
+        plugin.AnalysisErrorsParams(mainFilePath, [pluginError]);
+    configureTestPlugin(notification: pluginResult.toNotification());
+
+    final pluginTriggeredDiagnostics = await pluginTriggeredDiagnosticFuture;
+    expect(
+        pluginTriggeredDiagnostics.map((error) => error.message),
+        containsAll([
+          pluginErrorMessage,
+          contains(serverErrorMessage),
+        ]));
+  }
+
   Future<void> test_fromPlugins_nonDartFile() async {
     await checkPluginErrorsForFile(join(projectFolderPath, 'lib', 'foo.sql'));
   }
diff --git a/pkg/analysis_server/tool/lsp_spec/codegen_dart.dart b/pkg/analysis_server/tool/lsp_spec/codegen_dart.dart
index 63bfa14..68c29f7 100644
--- a/pkg/analysis_server/tool/lsp_spec/codegen_dart.dart
+++ b/pkg/analysis_server/tool/lsp_spec/codegen_dart.dart
@@ -203,6 +203,9 @@
   // Any fields that are optional but present, must still type check.
   final fields = _getAllFields(interface);
   for (var field in fields) {
+    if (isAnyType(field.type)) {
+      continue;
+    }
     buffer
       ..writeIndentedln("reporter.push('${field.name}');")
       ..writeIndentedln('try {')
@@ -277,16 +280,14 @@
       final isLiteral = field.type is LiteralType;
       final isRequired =
           !isLiteral && !field.allowsNull && !field.allowsUndefined;
-      final annotation = isRequired ? '@required' : '';
+      final requiredKeyword = isRequired ? 'required' : '';
       final valueCode =
           isLiteral ? ' = ${(field.type as LiteralType).literal}' : '';
-      return '$annotation this.${field.name}$valueCode';
+      return '$requiredKeyword this.${field.name}$valueCode';
     }).join(', '))
     ..write('})');
-  final fieldsWithValidation = allFields
-      .where(
-          (f) => (!f.allowsNull && !f.allowsUndefined) || f.type is LiteralType)
-      .toList();
+  final fieldsWithValidation =
+      allFields.where((f) => f.type is LiteralType).toList();
   if (fieldsWithValidation.isNotEmpty) {
     buffer
       ..writeIndentedln(' {')
@@ -301,14 +302,6 @@
               "throw '${field.name} may only be the literal ${type.literal.replaceAll("'", "\\'")}';")
           ..outdent()
           ..writeIndentedln('}');
-      } else if (!field.allowsNull && !field.allowsUndefined) {
-        buffer
-          ..writeIndentedln('if (${field.name} == null) {')
-          ..indent()
-          ..writeIndentedln(
-              "throw '${field.name} is required but was not provided';")
-          ..outdent()
-          ..writeIndentedln('}');
       }
     }
     buffer
@@ -458,9 +451,12 @@
 
 void _writeField(IndentableStringBuffer buffer, Field field) {
   _writeDocCommentsAndAnnotations(buffer, field);
+  final needsNullable =
+      (field.allowsNull || field.allowsUndefined) && !isAnyType(field.type);
   buffer
     ..writeIndented('final ')
     ..write(field.type.dartTypeWithTypeArgs)
+    ..write(needsNullable ? '?' : '')
     ..writeln(' ${field.name};');
 }
 
@@ -473,8 +469,13 @@
     buffer.write('$valueCode');
   } else if (_isSpecType(type)) {
     // Our own types have fromJson() constructors we can call.
-    buffer.write(
-        '$valueCode != null ? ${type.dartType}.fromJson${type.typeArgsString}($valueCode) : null');
+    if (allowsNull) {
+      buffer.write('$valueCode != null ? ');
+    }
+    buffer.write('${type.dartType}.fromJson${type.typeArgsString}($valueCode)');
+    if (allowsNull) {
+      buffer.write(': null');
+    }
   } else if (type is ArrayType) {
     // Lists need to be map()'d so we can recursively call writeFromJsonCode
     // as they may need fromJson on each element.
@@ -523,12 +524,19 @@
   // x is y ? new Either.tx(x) : (...)
   var hasIncompleteCondition = false;
   var unclosedParens = 0;
+
+  if (allowsNull) {
+    buffer.write('$valueCode == null ? null : (');
+    hasIncompleteCondition = true;
+    unclosedParens++;
+  }
+
   for (var i = 0; i < union.types.length; i++) {
     final type = union.types[i];
-    final isDynamic = type.dartType == 'dynamic';
+    final isAny = isAnyType(type);
 
     // Dynamic matches all type checks, so only emit it if required.
-    if (!isDynamic) {
+    if (!isAny) {
       _writeTypeCheckCondition(
           buffer, null, valueCode, type, 'nullLspJsonReporter');
       buffer.write(' ? ');
@@ -537,13 +545,13 @@
     // The code to construct a value with this "side" of the union.
     buffer.write('${union.dartTypeWithTypeArgs}.t${i + 1}(');
     _writeFromJsonCode(buffer, type, valueCode,
-        allowsNull: allowsNull,
+        allowsNull: false, // null is already handled above this loop
         requiresBracesInInterpolation:
             requiresBracesInInterpolation); // Call recursively!
     buffer.write(')');
 
     // If we output the type condition at the top, prepare for the next condition.
-    if (!isDynamic) {
+    if (!isAny) {
       buffer.write(' : (');
       hasIncompleteCondition = true;
       unclosedParens++;
@@ -554,10 +562,6 @@
   // Fill the final parens with a throw because if we fell through all of the
   // cases then the value we had didn't match any of the types in the union.
   if (hasIncompleteCondition) {
-    if (allowsNull) {
-      buffer.write('$valueCode == null ? null : (');
-      unclosedParens++;
-    }
     var interpolation =
         requiresBracesInInterpolation ? '\${$valueCode}' : '\$$valueCode';
     buffer.write(
@@ -676,13 +680,10 @@
       ..writeIndentedln('if (${field.name} != null) {')
       ..indent();
   }
-  // Suppress the ? operator if we've output a null check already.
-  final nullOp = shouldBeOmittedIfNoValue ? '' : '?';
+  // Use the correct null operator depending on whether the value could be null.
+  final nullOp = field.allowsNull || field.allowsUndefined ? '?' : '';
   buffer.writeIndented('''$mapName['${field.name}'] = ''');
   _writeToJsonCode(buffer, field.type, field.name, nullOp);
-  if (!field.allowsUndefined && !field.allowsNull) {
-    buffer.write(''' ?? (throw '${field.name} is required but was not set')''');
-  }
   buffer.writeln(';');
   if (shouldBeOmittedIfNoValue) {
     buffer
@@ -712,7 +713,7 @@
   } else if (type is ArrayType && _isSpecType(type.elementType)) {
     buffer.write('$valueCode$nullOp.map((item) => ');
     _writeToJsonCode(buffer, type.elementType, 'item', '');
-    buffer.write(')$nullOp.toList()');
+    buffer.write(').toList()');
   } else {
     buffer.write(valueCode);
   }
diff --git a/pkg/analysis_server/tool/lsp_spec/generate_all.dart b/pkg/analysis_server/tool/lsp_spec/generate_all.dart
index 24084c8..e6bd416 100644
--- a/pkg/analysis_server/tool/lsp_spec/generate_all.dart
+++ b/pkg/analysis_server/tool/lsp_spec/generate_all.dart
@@ -2,8 +2,6 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-// @dart = 2.9
-
 import 'dart:io';
 
 import 'package:analysis_server/src/utilities/strings.dart';
@@ -93,7 +91,7 @@
     licenseResp.body,
     specResp.body
   ];
-  return File(localSpecPath).writeAsString(text.join('\n\n---\n\n'));
+  await File(localSpecPath).writeAsString(text.join('\n\n---\n\n'));
 }
 
 Namespace extractMethodsEnum(String spec) {
@@ -136,7 +134,8 @@
     final parsed = parseString(typeAlias);
 
     // Extract the InlineInterface that was created.
-    InlineInterface interface = parsed.firstWhere((t) => t is InlineInterface);
+    final interface =
+        parsed.firstWhere((t) => t is InlineInterface) as InlineInterface;
 
     // Create a new name based on the fields.
     var newName = interface.members.map((m) => capitalize(m.name)).join('And');
@@ -146,7 +145,7 @@
 
   return _resultsInlineTypesPattern
       .allMatches(spec)
-      .map((m) => m.group(1).trim())
+      .map((m) => m.group(1)!.trim())
       .toList()
       .map(toInterface)
       .toList();
@@ -157,8 +156,6 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-// @dart = 2.9
-
 // This file has been automatically generated. Please do not edit it manually.
 // To regenerate the file, use the script
 // "pkg/analysis_server/tool/lsp_spec/generate_all.dart".
@@ -174,14 +171,13 @@
 import 'package:analysis_server/src/lsp/json_parsing.dart';
 import 'package:analysis_server/src/protocol/protocol_internal.dart';
 import 'package:analyzer/src/generated/utilities_general.dart';
-import 'package:meta/meta.dart';
 
 const jsonEncoder = JsonEncoder.withIndent('    ');
 
 ''';
 
 List<AstNode> getCustomClasses() {
-  Interface interface(String name, List<Member> fields, {String baseType}) {
+  Interface interface(String name, List<Member> fields, {String? baseType}) {
     return Interface(
       null,
       Token.identifier(name),
@@ -191,8 +187,13 @@
     );
   }
 
-  Field field(String name,
-      {String type, array = false, canBeNull = false, canBeUndefined = false}) {
+  Field field(
+    String name, {
+    required String type,
+    array = false,
+    canBeNull = false,
+    canBeUndefined = false,
+  }) {
     var fieldType =
         array ? ArrayType(Type.identifier(type)) : Type.identifier(type);
 
diff --git a/pkg/analysis_server/tool/lsp_spec/typescript.dart b/pkg/analysis_server/tool/lsp_spec/typescript.dart
index 268b1f8..5ebb88d 100644
--- a/pkg/analysis_server/tool/lsp_spec/typescript.dart
+++ b/pkg/analysis_server/tool/lsp_spec/typescript.dart
@@ -118,6 +118,9 @@
     'ParameterInformation': {
       'label': 'String',
     },
+    'ProgressParams': {
+      'value': 'object',
+    },
     'ServerCapabilities': {
       'changeNotifications': 'bool',
     },
diff --git a/pkg/analyzer/lib/error/error.dart b/pkg/analyzer/lib/error/error.dart
index ef61719..0134b77 100644
--- a/pkg/analyzer/lib/error/error.dart
+++ b/pkg/analyzer/lib/error/error.dart
@@ -848,7 +848,6 @@
   StaticWarningCode.INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL,
   StaticWarningCode.MISSING_ENUM_CONSTANT_IN_SWITCH,
   StaticWarningCode.UNNECESSARY_NON_NULL_ASSERTION,
-  StrongModeCode.TOP_LEVEL_FUNCTION_LITERAL_BLOCK,
   StrongModeCode.TOP_LEVEL_IDENTIFIER_NO_TYPE,
   StrongModeCode.TOP_LEVEL_INSTANCE_GETTER,
   TodoCode.TODO,
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart
index 8f17b48..35f7890 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -621,22 +621,25 @@
   /// Throw [ArgumentError] if the [uri] corresponds to a part.
   Future<LibraryElement> getLibraryByUri(String uri) async {
     var uriObj = Uri.parse(uri);
-    var file = _fsState.getFileForUri(uriObj);
+    var fileOr = _fsState.getFileForUri(uriObj);
+    return fileOr.map(
+      (file) async {
+        if (file == null) {
+          throw ArgumentError('$uri cannot be resolved to a file.');
+        }
 
-    if (file == null) {
-      throw ArgumentError('$uri cannot be resolved to a file.');
-    }
+        if (file.isPart) {
+          throw ArgumentError('$uri is not a library.');
+        }
 
-    if (file.isExternalLibrary) {
-      return _createLibraryContext(file).getLibraryElement(file);
-    }
-
-    if (file.isPart) {
-      throw ArgumentError('$uri is not a library.');
-    }
-
-    UnitElementResult unitResult = await getUnitElement(file.path!);
-    return unitResult.element.library;
+        var unitResult = await getUnitElement(file.path!);
+        return unitResult.element.library;
+      },
+      (externalLibrary) async {
+        var libraryContext = _createLibraryContext(null);
+        return libraryContext.getLibraryElement(externalLibrary.uri);
+      },
+    );
   }
 
   /// Return a [ParsedLibraryResult] for the library with the given [path].
@@ -673,22 +676,21 @@
   /// Throw [ArgumentError] if the given [uri] is not the defining compilation
   /// unit for a library (that is, is a part of a library).
   ParsedLibraryResult getParsedLibraryByUri(Uri uri) {
-    var file = _fsState.getFileForUri(uri);
-
-    if (file == null) {
-      throw ArgumentError('URI cannot be resolved: $uri');
-    }
-
-    if (file.isExternalLibrary) {
-      return ParsedLibraryResultImpl.external(currentSession, file.uri);
-    }
-
-    if (file.isPart) {
-      throw ArgumentError('Is a part: $uri');
-    }
-
-    // The file is a local file, we can get the result.
-    return getParsedLibrary(file.path!);
+    var fileOr = _fsState.getFileForUri(uri);
+    return fileOr.map(
+      (file) {
+        if (file == null) {
+          throw ArgumentError('URI cannot be resolved: $uri');
+        }
+        if (file.isPart) {
+          throw ArgumentError('Is a part: $uri');
+        }
+        return getParsedLibrary(file.path!);
+      },
+      (externalLibrary) {
+        return ParsedLibraryResultImpl.external(currentSession, uri);
+      },
+    );
   }
 
   /// Return a [Future] that completes with a [ResolvedLibraryResult] for the
@@ -748,24 +750,21 @@
   /// [changeFile]), prior to the next time the analysis state transitions
   /// to "idle".
   Future<ResolvedLibraryResult> getResolvedLibraryByUri(Uri uri) {
-    var file = _fsState.getFileForUri(uri);
-
-    if (file == null) {
-      throw ArgumentError('URI cannot be resolved: $uri');
-    }
-
-    if (file.isExternalLibrary) {
-      return Future.value(
-        ResolvedLibraryResultImpl.external(currentSession, file.uri),
-      );
-    }
-
-    if (file.isPart) {
-      throw ArgumentError('Is a part: $uri');
-    }
-
-    // The file is a local file, we can get the result.
-    return getResolvedLibrary(file.path!);
+    var fileOr = _fsState.getFileForUri(uri);
+    return fileOr.map(
+      (file) {
+        if (file == null) {
+          throw ArgumentError('URI cannot be resolved: $uri');
+        }
+        if (file.isPart) {
+          throw ArgumentError('Is a part: $uri');
+        }
+        return getResolvedLibrary(file.path!);
+      },
+      (externalLibrary) async {
+        return ResolvedLibraryResultImpl.external(currentSession, uri);
+      },
+    );
   }
 
   ApiSignature getResolvedUnitKeyByPath(String path) {
@@ -891,8 +890,11 @@
   /// without a package name. In these cases we cannot prove that the file is
   /// not a part, so it must be a library.
   bool isLibraryByUri(Uri uri) {
-    var file = _fsState.getFileForUri(uri);
-    return file == null || !file.isPart;
+    var fileOr = _fsState.getFileForUri(uri);
+    return fileOr.map(
+      (file) => file == null || !file.isPart,
+      (uri) => false,
+    );
   }
 
   /// Return a [Future] that completes with a [ParsedUnitResult] for the file
@@ -1288,15 +1290,11 @@
       try {
         _testView.numOfAnalyzedLibraries++;
 
-        var dartCoreUri = Uri.parse('dart:core');
-        var dartCoreFile = _fsState.getFileForUri(dartCoreUri);
-        if (dartCoreFile == null || !dartCoreFile.exists) {
+        if (!_hasLibraryByUri('dart:core')) {
           return _newMissingDartLibraryResult(file, 'dart:core');
         }
 
-        var dartAsyncUri = Uri.parse('dart:async');
-        var dartAsyncFile = _fsState.getFileForUri(dartAsyncUri);
-        if (dartAsyncFile == null || !dartAsyncFile.exists) {
+        if (!_hasLibraryByUri('dart:async')) {
           return _newMissingDartLibraryResult(file, 'dart:async');
         }
 
@@ -1515,30 +1513,33 @@
   }
 
   /// Return the context in which the [library] should be analyzed.
-  LibraryContext _createLibraryContext(FileState library) {
-    if (_libraryContext != null) {
-      if (_libraryContext!.pack()) {
-        clearLibraryContext();
+  LibraryContext _createLibraryContext(FileState? library) {
+    {
+      var libraryContext = _libraryContext;
+      if (libraryContext != null) {
+        if (libraryContext.pack()) {
+          clearLibraryContext();
+        }
       }
     }
 
-    if (_libraryContext == null) {
-      _libraryContext = LibraryContext(
-        testView: _testView.libraryContext,
-        session: currentSession,
-        logger: _logger,
-        byteStore: _byteStore,
-        analysisOptions: _analysisOptions,
-        declaredVariables: declaredVariables,
-        sourceFactory: _sourceFactory,
-        externalSummaries: _externalSummaries,
-        targetLibrary: library,
-      );
-    } else {
-      _libraryContext!.load2(library);
+    var libraryContext = _libraryContext;
+    libraryContext ??= _libraryContext = LibraryContext(
+      testView: _testView.libraryContext,
+      session: currentSession,
+      logger: _logger,
+      byteStore: _byteStore,
+      analysisOptions: _analysisOptions,
+      declaredVariables: declaredVariables,
+      sourceFactory: _sourceFactory,
+      externalSummaries: _externalSummaries,
+    );
+
+    if (library != null) {
+      libraryContext.load2(library);
     }
 
-    return _libraryContext!;
+    return libraryContext;
   }
 
   /// Create a new analysis session, so invalidating the current one.
@@ -1649,6 +1650,15 @@
     return signature.toHex();
   }
 
+  bool _hasLibraryByUri(String uriStr) {
+    var uri = Uri.parse(uriStr);
+    var fileOr = _fsState.getFileForUri(uri);
+    return fileOr.map(
+      (file) => file != null && file.exists,
+      (_) => true,
+    );
+  }
+
   /// We detected that one of the required `dart` libraries is missing.
   /// Return the empty analysis result with the error.
   AnalysisResult _newMissingDartLibraryResult(
@@ -2034,12 +2044,6 @@
   Map<String, ResolvedUnitResult> get priorityResults {
     return driver._priorityResults;
   }
-
-  SummaryDataStore getSummaryStore(String libraryPath) {
-    FileState library = driver.fsState.getFileForPath(libraryPath);
-    LibraryContext libraryContext = driver._createLibraryContext(library);
-    return libraryContext.store;
-  }
 }
 
 /// The result of analyzing of a single file.
diff --git a/pkg/analyzer/lib/src/dart/analysis/file_state.dart b/pkg/analyzer/lib/src/dart/analysis/file_state.dart
index fcf5423..fbb35e3 100644
--- a/pkg/analyzer/lib/src/dart/analysis/file_state.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/file_state.dart
@@ -35,6 +35,7 @@
 import 'package:analyzer/src/summary/idl.dart';
 import 'package:analyzer/src/summary/package_bundle_reader.dart';
 import 'package:analyzer/src/summary2/bundle_writer.dart';
+import 'package:analyzer/src/util/either.dart';
 import 'package:analyzer/src/workspace/workspace.dart';
 import 'package:collection/collection.dart';
 import 'package:convert/convert.dart';
@@ -48,6 +49,13 @@
 int fileObjectId = 0;
 var timerFileStateRefresh = Stopwatch();
 
+/// A library from [SummaryDataStore].
+class ExternalLibrary {
+  final Uri uri;
+
+  ExternalLibrary(this.uri);
+}
+
 /// [FileContentOverlay] is used to temporary override content of files.
 class FileContentOverlay {
   final _map = <String, String>{};
@@ -97,12 +105,6 @@
   /// It might be `null` if the file is outside of the workspace.
   final WorkspacePackage? workspacePackage;
 
-  /// Return `true` if this file is a stub created for a file in the provided
-  /// external summary store. The values of most properties are not the same
-  /// as they would be if the file were actually read from the file system.
-  /// The value of the property [uri] is correct.
-  final bool isInExternalSummaries;
-
   /// The [FeatureSet] for all files in the analysis context.
   ///
   /// Usually it is the feature set of the latest language version, plus
@@ -158,19 +160,7 @@
     this.workspacePackage,
     this._contextFeatureSet,
     this.packageLanguageVersion,
-  ) : isInExternalSummaries = false;
-
-  FileState._external(this._fsState, this.uri)
-      : isInExternalSummaries = true,
-        path = null,
-        source = null,
-        workspacePackage = null,
-        _exists = true,
-        _contextFeatureSet = null,
-        packageLanguageVersion = null {
-    _apiSignature = Uint8List(16);
-    _libraryCycle = LibraryCycle.external();
-  }
+  );
 
   /// The unlinked API signature of the file.
   List<int> get apiSignature => _apiSignature!;
@@ -221,8 +211,12 @@
       _exportedFiles = <FileState?>[];
       for (var directive in _unlinked2!.exports) {
         var uri = _selectRelativeUri(directive);
-        var file = _fileForRelativeUri(uri);
-        _exportedFiles!.add(file);
+        _fileForRelativeUri(uri).map(
+          (file) {
+            _exportedFiles!.add(file);
+          },
+          (_) {},
+        );
       }
     }
     return _exportedFiles!;
@@ -237,8 +231,12 @@
       _importedFiles = <FileState?>[];
       for (var directive in _unlinked2!.imports) {
         var uri = _selectRelativeUri(directive);
-        var file = _fileForRelativeUri(uri);
-        _importedFiles!.add(file);
+        _fileForRelativeUri(uri).map(
+          (file) {
+            _importedFiles!.add(file);
+          },
+          (_) {},
+        );
       }
     }
     return _importedFiles!;
@@ -310,13 +308,17 @@
     if (_partedFiles == null) {
       _partedFiles = <FileState?>[];
       for (var uri in _unlinked2!.parts) {
-        var file = _fileForRelativeUri(uri);
-        _partedFiles!.add(file);
-        if (file != null) {
-          _fsState._partToLibraries
-              .putIfAbsent(file, () => <FileState>[])
-              .add(this);
-        }
+        _fileForRelativeUri(uri).map(
+          (file) {
+            _partedFiles!.add(file);
+            if (file != null) {
+              _fsState._partToLibraries
+                  .putIfAbsent(file, () => <FileState>[])
+                  .add(this);
+            }
+          },
+          (_) {},
+        );
       }
     }
     return _partedFiles!;
@@ -547,16 +549,18 @@
 
   /// Return the [FileState] for the given [relativeUri], or `null` if the
   /// URI cannot be parsed, cannot correspond any file, etc.
-  FileState? _fileForRelativeUri(String relativeUri) {
+  Either2<FileState?, ExternalLibrary> _fileForRelativeUri(
+    String relativeUri,
+  ) {
     if (relativeUri.isEmpty) {
-      return null;
+      return Either2.t1(null);
     }
 
     Uri absoluteUri;
     try {
       absoluteUri = resolveRelativeUri(uri, Uri.parse(relativeUri));
     } on FormatException {
-      return null;
+      return Either2.t1(null);
     }
 
     return _fsState.getFileForUri(absoluteUri);
@@ -894,30 +898,34 @@
     return file;
   }
 
-  /// Return the [FileState] for the given absolute [uri]. May return the
-  /// "unresolved" file if the [uri] is invalid, e.g. a `package:` URI without
-  /// a package name. The returned file has the last known state since if was
-  /// last refreshed.
-  FileState? getFileForUri(Uri uri) {
+  /// The given [uri] must be absolute.
+  ///
+  /// If [uri] corresponds to a library from the summary store, return a
+  /// [ExternalLibrary].
+  ///
+  /// Otherwise the [uri] is resolved to a file, and the corresponding
+  /// [FileState] is returned. Might be `null` if the [uri] cannot be resolved
+  /// to a file, for example because it is invalid (e.g. a `package:` URI
+  /// without a package name), or we don't know this package. The returned
+  /// file has the last known state since if was last refreshed.
+  Either2<FileState?, ExternalLibrary> getFileForUri(Uri uri) {
+    // If the external store has this URI, create a stub file for it.
+    // We are given all required unlinked and linked summaries for it.
+    if (externalSummaries != null) {
+      String uriStr = uri.toString();
+      if (externalSummaries!.hasLinkedLibrary(uriStr)) {
+        return Either2.t2(ExternalLibrary(uri));
+      }
+    }
+
     FileState? file = _uriToFile[uri];
     if (file == null) {
-      // If the external store has this URI, create a stub file for it.
-      // We are given all required unlinked and linked summaries for it.
-      if (externalSummaries != null) {
-        String uriStr = uri.toString();
-        if (externalSummaries!.hasLinkedLibrary(uriStr)) {
-          file = FileState._external(this, uri);
-          _uriToFile[uri] = file;
-          return file;
-        }
-      }
-
       Source? uriSource = _sourceFactory.resolveUri(null, uri.toString());
 
       // If the URI cannot be resolved, for example because the factory
       // does not understand the scheme, return the unresolved file instance.
       if (uriSource == null) {
-        return null;
+        return Either2.t1(null);
       }
 
       String path = uriSource.fullName;
@@ -933,7 +941,7 @@
       _addFileWithPath(path, file);
       file.refresh(allowCached: true);
     }
-    return file;
+    return Either2.t1(file);
   }
 
   /// Return the list of all [FileState]s corresponding to the given [path]. The
diff --git a/pkg/analyzer/lib/src/dart/analysis/file_tracker.dart b/pkg/analyzer/lib/src/dart/analysis/file_tracker.dart
index d6caee6..f973d53 100644
--- a/pkg/analyzer/lib/src/dart/analysis/file_tracker.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/file_tracker.dart
@@ -185,11 +185,6 @@
     return _logger.run('Verify API signature of $path', () {
       _logger.writeln('Work in ${_fsState.contextName}');
 
-      var file = _fsState.getFileForPath(path);
-      if (file.isInExternalSummaries) {
-        return file;
-      }
-
       bool anyApiChanged = false;
       List<FileState> files = _fsState.getFilesForPath(path);
       for (FileState file in files) {
diff --git a/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart b/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
index 137eec9..1b7434b 100644
--- a/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
@@ -45,6 +45,7 @@
 import 'package:analyzer/src/lint/linter.dart';
 import 'package:analyzer/src/lint/linter_visitor.dart';
 import 'package:analyzer/src/services/lint.dart';
+import 'package:analyzer/src/summary/package_bundle_reader.dart';
 import 'package:analyzer/src/task/strong/checker.dart';
 import 'package:pub_semver/pub_semver.dart';
 
@@ -507,6 +508,9 @@
   }
 
   bool _isExistingSource(Source source) {
+    if (source is InSummarySource) {
+      return true;
+    }
     for (var file in _library.directReferencedFiles) {
       if (file.uri == source.uri) {
         return file.exists;
diff --git a/pkg/analyzer/lib/src/dart/analysis/library_context.dart b/pkg/analyzer/lib/src/dart/analysis/library_context.dart
index d13ec6e..94a44cf 100644
--- a/pkg/analyzer/lib/src/dart/analysis/library_context.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/library_context.dart
@@ -63,7 +63,6 @@
     required DeclaredVariables declaredVariables,
     required SourceFactory sourceFactory,
     required this.externalSummaries,
-    required FileState targetLibrary,
   })   : logger = logger,
         byteStore = byteStore,
         analysisSession = session {
@@ -72,7 +71,6 @@
     analysisContext = AnalysisContextImpl(synchronousSession, sourceFactory);
 
     _createElementFactory();
-    load2(targetLibrary);
   }
 
   /// Computes a [CompilationUnitElement] for the given library/unit pair.
@@ -86,8 +84,9 @@
   }
 
   /// Get the [LibraryElement] for the given library.
-  LibraryElement getLibraryElement(FileState library) {
-    return elementFactory.libraryOfUri2(library.uriStr);
+  LibraryElement getLibraryElement(Uri uri) {
+    _createElementFactoryTypeProvider();
+    return elementFactory.libraryOfUri2('$uri');
   }
 
   /// Return `true` if the given [uri] is known to be a library.
diff --git a/pkg/analyzer/lib/src/error/codes.dart b/pkg/analyzer/lib/src/error/codes.dart
index bf643c4..9900a5e 100644
--- a/pkg/analyzer/lib/src/error/codes.dart
+++ b/pkg/analyzer/lib/src/error/codes.dart
@@ -14200,13 +14200,6 @@
   /* TODO(leafp) Delete most of these.
    */
 
-  static const StrongModeCode TOP_LEVEL_FUNCTION_LITERAL_BLOCK = StrongModeCode(
-      ErrorType.HINT,
-      'TOP_LEVEL_FUNCTION_LITERAL_BLOCK',
-      "The type of the function literal can't be inferred because the "
-          "literal has a block as its body.",
-      correction: "Try adding an explicit type to the variable.");
-
   static const StrongModeCode TOP_LEVEL_IDENTIFIER_NO_TYPE = StrongModeCode(
       ErrorType.HINT,
       'TOP_LEVEL_IDENTIFIER_NO_TYPE',
diff --git a/pkg/analyzer/lib/src/task/strong/checker.dart b/pkg/analyzer/lib/src/task/strong/checker.dart
index ee2b7f3..bd2547c 100644
--- a/pkg/analyzer/lib/src/task/strong/checker.dart
+++ b/pkg/analyzer/lib/src/task/strong/checker.dart
@@ -1064,17 +1064,6 @@
   }
 
   @override
-  visitFunctionExpression(FunctionExpression node) {
-    var body = node.body;
-    if (body is ExpressionFunctionBody) {
-      body.expression.accept(this);
-    } else {
-      _codeChecker._recordMessage(
-          node, StrongModeCode.TOP_LEVEL_FUNCTION_LITERAL_BLOCK, []);
-    }
-  }
-
-  @override
   visitFunctionExpressionInvocation(FunctionExpressionInvocation node) {
     if (node.typeArguments != null) {
       return;
diff --git a/pkg/analyzer/lib/src/util/either.dart b/pkg/analyzer/lib/src/util/either.dart
index 9ff9bc4..6835936 100644
--- a/pkg/analyzer/lib/src/util/either.dart
+++ b/pkg/analyzer/lib/src/util/either.dart
@@ -3,23 +3,23 @@
 // BSD-style license that can be found in the LICENSE file.
 
 /// A container that is either [T1] or [T2].
-class Either2<T1 extends Object, T2 extends Object> {
-  final T1? _t1;
-  final T2? _t2;
+class Either2<T1, T2> {
+  final int _which;
+  final Object? _value;
 
   Either2.t1(T1 t1)
-      : _t1 = t1,
-        _t2 = null;
+      : _which = 1,
+        _value = t1;
 
   Either2.t2(T2 t2)
-      : _t1 = null,
-        _t2 = t2;
+      : _which = 2,
+        _value = t2;
 
   T map<T>(T Function(T1) f1, T Function(T2) f2) {
-    if (_t1 != null) {
-      return f1(_t1!);
+    if (_which == 1) {
+      return f1(_value as T1);
     } else {
-      return f2(_t2!);
+      return f2(_value as T2);
     }
   }
 
diff --git a/pkg/analyzer/test/src/dart/analysis/file_state_test.dart b/pkg/analyzer/test/src/dart/analysis/file_state_test.dart
index 024c895..6e417e6 100644
--- a/pkg/analyzer/test/src/dart/analysis/file_state_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/file_state_test.dart
@@ -21,6 +21,7 @@
 import 'package:analyzer/src/source/package_map_resolver.dart';
 import 'package:analyzer/src/test_utilities/mock_sdk.dart';
 import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
+import 'package:analyzer/src/util/either.dart';
 import 'package:analyzer/src/workspace/basic.dart';
 import 'package:convert/convert.dart';
 import 'package:crypto/crypto.dart';
@@ -346,8 +347,14 @@
 
   test_getFileForUri_invalidUri() {
     var uri = Uri.parse('package:x');
-    var file = fileSystemState.getFileForUri(uri);
-    expect(file, isNull);
+    fileSystemState.getFileForUri(uri).map(
+      (file) {
+        expect(file, isNull);
+      },
+      (_) {
+        fail('Expected null.');
+      },
+    );
   }
 
   test_getFileForUri_packageVsFileUri() {
@@ -356,8 +363,8 @@
     var fileUri = toUri(path);
 
     // The files with `package:` and `file:` URIs are different.
-    FileState filePackageUri = fileSystemState.getFileForUri(packageUri)!;
-    FileState fileFileUri = fileSystemState.getFileForUri(fileUri)!;
+    var filePackageUri = fileSystemState.getFileForUri(packageUri).asFileState;
+    var fileFileUri = fileSystemState.getFileForUri(fileUri).asFileState;
     expect(filePackageUri, isNot(same(fileFileUri)));
 
     expect(filePackageUri.path, path);
@@ -739,3 +746,12 @@
     throw StateError('Unexpected invocation of ${invocation.memberName}');
   }
 }
+
+extension on Either2<FileState?, ExternalLibrary> {
+  FileState get asFileState {
+    return map(
+      (file) => file!,
+      (_) => fail('Expected a file'),
+    );
+  }
+}
diff --git a/pkg/analyzer/test/src/summary/top_level_inference_test.dart b/pkg/analyzer/test/src/summary/top_level_inference_test.dart
index 212b95b..25b90f1 100644
--- a/pkg/analyzer/test/src/summary/top_level_inference_test.dart
+++ b/pkg/analyzer/test/src/summary/top_level_inference_test.dart
@@ -122,11 +122,13 @@
   }
 
   test_initializer_functionLiteral_blockBody() async {
-    await assertErrorsInCode('''
+    await assertNoErrorsInCode('''
 var t = (int p) {};
-''', [
-      error(StrongModeCode.TOP_LEVEL_FUNCTION_LITERAL_BLOCK, 8, 10),
-    ]);
+''');
+    assertType(
+      findElement.topVar('t').type,
+      'Null Function(int)',
+    );
   }
 
   test_initializer_functionLiteral_expressionBody() async {
@@ -134,12 +136,20 @@
 var a = 0;
 var t = (int p) => (a = 1);
 ''');
+    assertType(
+      findElement.topVar('t').type,
+      'int Function(int)',
+    );
   }
 
   test_initializer_functionLiteral_parameters_withoutType() async {
     await assertNoErrorsInCode('''
 var t = (int a, b,int c, d) => 0;
 ''');
+    assertType(
+      findElement.topVar('t').type,
+      'int Function(int, dynamic, int, dynamic)',
+    );
   }
 
   test_initializer_hasTypeAnnotation() async {
diff --git a/pkg/analyzer/test/src/util/either_test.dart b/pkg/analyzer/test/src/util/either_test.dart
index 52f4799..bd6c634 100644
--- a/pkg/analyzer/test/src/util/either_test.dart
+++ b/pkg/analyzer/test/src/util/either_test.dart
@@ -23,4 +23,14 @@
     var either = Either2<int, String>.t2('hello');
     expect(either.map((_) => throw 'unexpected', (x) => x.length), 5);
   }
+
+  void test_toString_t1() {
+    var either = Either2<int, String>.t1(42);
+    expect(either.toString(), '42');
+  }
+
+  void test_toString_t2() {
+    var either = Either2<int, String>.t2('hello');
+    expect(either.toString(), 'hello');
+  }
 }
diff --git a/pkg/compiler/lib/src/common/codegen.dart b/pkg/compiler/lib/src/common/codegen.dart
index fcc224f..eed8576 100644
--- a/pkg/compiler/lib/src/common/codegen.dart
+++ b/pkg/compiler/lib/src/common/codegen.dart
@@ -18,6 +18,8 @@
 import '../js/js.dart' as js;
 import '../js_backend/backend.dart';
 import '../js_backend/namer.dart';
+import '../js_backend/deferred_holder_expression.dart'
+    show DeferredHolderExpression;
 import '../js_backend/string_reference.dart' show StringReference;
 import '../js_backend/type_reference.dart' show TypeReference;
 import '../js_emitter/code_emitter_task.dart' show Emitter;
@@ -592,26 +594,6 @@
     }
     for (ModularExpression expression in modularExpressions) {
       switch (expression.kind) {
-        case ModularExpressionKind.globalObjectForLibrary:
-          expression.value = namer
-              .readGlobalObjectForLibrary(expression.data)
-              .withSourceInformation(expression.sourceInformation);
-          break;
-        case ModularExpressionKind.globalObjectForClass:
-          expression.value = namer
-              .readGlobalObjectForClass(expression.data)
-              .withSourceInformation(expression.sourceInformation);
-          break;
-        case ModularExpressionKind.globalObjectForType:
-          expression.value = namer
-              .readGlobalObjectForType(expression.data)
-              .withSourceInformation(expression.sourceInformation);
-          break;
-        case ModularExpressionKind.globalObjectForMember:
-          expression.value = namer
-              .readGlobalObjectForMember(expression.data)
-              .withSourceInformation(expression.sourceInformation);
-          break;
         case ModularExpressionKind.constant:
           expression.value = emitter
               .constantReference(expression.data)
@@ -830,10 +812,6 @@
 }
 
 enum ModularExpressionKind {
-  globalObjectForLibrary,
-  globalObjectForClass,
-  globalObjectForType,
-  globalObjectForMember,
   constant,
   embeddedGlobalAccess,
 }
@@ -853,18 +831,6 @@
     ModularExpressionKind kind = source.readEnum(ModularExpressionKind.values);
     Object data;
     switch (kind) {
-      case ModularExpressionKind.globalObjectForLibrary:
-        data = source.readLibrary();
-        break;
-      case ModularExpressionKind.globalObjectForClass:
-        data = source.readClass();
-        break;
-      case ModularExpressionKind.globalObjectForType:
-        data = source.readClass();
-        break;
-      case ModularExpressionKind.globalObjectForMember:
-        data = source.readMember();
-        break;
       case ModularExpressionKind.constant:
         data = source.readConstant();
         break;
@@ -880,18 +846,6 @@
     sink.begin(tag);
     sink.writeEnum(kind);
     switch (kind) {
-      case ModularExpressionKind.globalObjectForLibrary:
-        sink.writeLibrary(data);
-        break;
-      case ModularExpressionKind.globalObjectForClass:
-        sink.writeClass(data);
-        break;
-      case ModularExpressionKind.globalObjectForType:
-        sink.writeClass(data);
-        break;
-      case ModularExpressionKind.globalObjectForMember:
-        sink.writeMember(data);
-        break;
       case ModularExpressionKind.constant:
         sink.writeConstant(data);
         break;
@@ -1009,6 +963,7 @@
   program,
   stringReference,
   typeReference,
+  deferredHolderExpression,
 }
 
 /// Tags used for debugging serialization/deserialization boundary mismatches.
@@ -1073,6 +1028,7 @@
   static const String program = 'js-program';
   static const String stringReference = 'js-stringReference';
   static const String typeReference = 'js-typeReference';
+  static const String deferredHolderExpression = 'js-deferredHolderExpression';
 }
 
 /// Visitor that serializes a [js.Node] into a [DataSink].
@@ -1321,6 +1277,12 @@
       node.writeToDataSink(sink);
       sink.end(JsNodeTags.stringReference);
       _writeInfo(node);
+    } else if (node is DeferredHolderExpression) {
+      sink.writeEnum(JsNodeKind.deferredHolderExpression);
+      sink.begin(JsNodeTags.deferredHolderExpression);
+      node.writeToDataSink(sink);
+      sink.end(JsNodeTags.deferredHolderExpression);
+      _writeInfo(node);
     } else {
       throw new UnsupportedError(
           'Unexpected deferred expression: ${node.runtimeType}.');
@@ -2119,6 +2081,11 @@
         node = TypeReference.readFromDataSource(source);
         source.end(JsNodeTags.typeReference);
         break;
+      case JsNodeKind.deferredHolderExpression:
+        source.begin(JsNodeTags.deferredHolderExpression);
+        node = DeferredHolderExpression.readFromDataSource(source);
+        source.end(JsNodeTags.deferredHolderExpression);
+        break;
     }
     SourceInformation sourceInformation =
         source.readCached<SourceInformation>(() {
diff --git a/pkg/compiler/lib/src/js/size_estimator.dart b/pkg/compiler/lib/src/js/size_estimator.dart
index 257fa70..e8ec19f 100644
--- a/pkg/compiler/lib/src/js/size_estimator.dart
+++ b/pkg/compiler/lib/src/js/size_estimator.dart
@@ -8,6 +8,7 @@
 import 'package:js_ast/src/characters.dart' as charCodes;
 import 'package:js_ast/src/precedence.dart';
 
+import '../js_backend/deferred_holder_expression.dart';
 import '../js_backend/string_reference.dart';
 import '../js_backend/type_reference.dart';
 import '../js_emitter/metadata_collector.dart';
@@ -63,6 +64,9 @@
       // Worst case we have to inline the string so size of string + 2 bytes for
       // quotes.
       return "'${node.constant.toDartString()}'";
+    } else if (node is DeferredHolderExpression) {
+      // 1 byte holder + dot + nameSizeEstimate
+      return '#.$nameSizeEstimate';
     } else {
       throw UnsupportedError('$node type is not supported');
     }
diff --git a/pkg/compiler/lib/src/js_backend/deferred_holder_expression.dart b/pkg/compiler/lib/src/js_backend/deferred_holder_expression.dart
new file mode 100644
index 0000000..602ff08
--- /dev/null
+++ b/pkg/compiler/lib/src/js_backend/deferred_holder_expression.dart
@@ -0,0 +1,220 @@
+// Copyright (c) 2021, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:js_ast/src/precedence.dart' as js show PRIMARY;
+
+import '../elements/entities.dart';
+import '../js/js.dart' as js;
+import '../serialization/serialization.dart';
+import '../util/util.dart';
+
+import 'namer.dart';
+
+// TODO(joshualitt): Figure out how to subsume more of the modular naming
+// framework into this approach. For example, we are still creating ModularNames
+// for the entity referenced in the DeferredHolderExpression.
+enum DeferredHolderExpressionKind {
+  globalObjectForLibrary,
+  globalObjectForClass,
+  globalObjectForType,
+  globalObjectForMember,
+}
+
+class DeferredHolderExpression extends js.DeferredExpression
+    implements js.AstContainer {
+  static const String tag = 'deferred-holder-expression';
+
+  final DeferredHolderExpressionKind kind;
+  final Entity entity;
+  js.Expression _value;
+
+  @override
+  final js.JavaScriptNodeSourceInformation sourceInformation;
+
+  DeferredHolderExpression(this.kind, this.entity) : sourceInformation = null;
+  DeferredHolderExpression._(
+      this.kind, this.entity, this._value, this.sourceInformation);
+
+  factory DeferredHolderExpression.readFromDataSource(DataSource source) {
+    source.begin(tag);
+    var kind = source.readEnum(DeferredHolderExpressionKind.values);
+    Entity entity;
+    switch (kind) {
+      case DeferredHolderExpressionKind.globalObjectForLibrary:
+        entity = source.readLibrary();
+        break;
+      case DeferredHolderExpressionKind.globalObjectForClass:
+        entity = source.readClass();
+        break;
+      case DeferredHolderExpressionKind.globalObjectForType:
+        entity = source.readClass();
+        break;
+      case DeferredHolderExpressionKind.globalObjectForMember:
+        entity = source.readMember();
+        break;
+    }
+    source.end(tag);
+    return DeferredHolderExpression(kind, entity);
+  }
+
+  void writeToDataSink(DataSink sink) {
+    sink.begin(tag);
+    sink.writeEnum(kind);
+    switch (kind) {
+      case DeferredHolderExpressionKind.globalObjectForLibrary:
+        sink.writeLibrary(entity);
+        break;
+      case DeferredHolderExpressionKind.globalObjectForClass:
+        sink.writeClass(entity);
+        break;
+      case DeferredHolderExpressionKind.globalObjectForType:
+        sink.writeClass(entity);
+        break;
+      case DeferredHolderExpressionKind.globalObjectForMember:
+        sink.writeMember(entity);
+        break;
+    }
+    sink.end(tag);
+  }
+
+  set value(js.Expression value) {
+    assert(!isFinalized && value != null);
+    _value = value;
+  }
+
+  @override
+  js.Expression get value {
+    assert(isFinalized, '$this is unassigned');
+    return _value;
+  }
+
+  @override
+  bool get isFinalized => _value != null;
+
+  @override
+  DeferredHolderExpression withSourceInformation(
+      js.JavaScriptNodeSourceInformation newSourceInformation) {
+    if (newSourceInformation == sourceInformation) return this;
+    if (newSourceInformation == null) return this;
+    return DeferredHolderExpression._(
+        kind, entity, _value, newSourceInformation);
+  }
+
+  @override
+  int get precedenceLevel => _value?.precedenceLevel ?? js.PRIMARY;
+
+  @override
+  int get hashCode {
+    return Hashing.objectsHash(kind, entity);
+  }
+
+  @override
+  bool operator ==(Object other) {
+    if (identical(this, other)) return true;
+    return other is DeferredHolderExpression &&
+        kind == other.kind &&
+        entity == other.entity;
+  }
+
+  @override
+  String toString() {
+    StringBuffer sb = new StringBuffer();
+    sb.write('DeferredHolderExpression(kind=$kind,entity=$entity,');
+    sb.write('value=$_value)');
+    return sb.toString();
+  }
+
+  @override
+  Iterable<js.Node> get containedNodes => isFinalized ? [_value] : const [];
+}
+
+abstract class DeferredHolderExpressionFinalizer {
+  /// Collects DeferredHolderExpressions from the JavaScript
+  /// AST [code];
+  void addCode(js.Node code);
+
+  /// Performs analysis on all collected DeferredHolderExpression nodes
+  /// finalizes the values to expressions to access the holders.
+  void finalize();
+}
+
+class DeferredHolderExpressionFinalizerImpl
+    implements DeferredHolderExpressionFinalizer {
+  _DeferredHolderExpressionCollectorVisitor _visitor;
+  final List<DeferredHolderExpression> holderReferences = [];
+  final Namer _namer;
+
+  DeferredHolderExpressionFinalizerImpl(this._namer) {
+    _visitor = _DeferredHolderExpressionCollectorVisitor(this);
+  }
+
+  @override
+  void addCode(js.Node code) {
+    code.accept(_visitor);
+  }
+
+  @override
+  void finalize() {
+    for (var reference in holderReferences) {
+      if (reference.isFinalized) continue;
+      switch (reference.kind) {
+        case DeferredHolderExpressionKind.globalObjectForLibrary:
+          reference.value = _namer
+              .readGlobalObjectForLibrary(reference.entity)
+              .withSourceInformation(reference.sourceInformation);
+          break;
+        case DeferredHolderExpressionKind.globalObjectForClass:
+          reference.value = _namer
+              .readGlobalObjectForClass(reference.entity)
+              .withSourceInformation(reference.sourceInformation);
+          break;
+        case DeferredHolderExpressionKind.globalObjectForType:
+          reference.value = _namer
+              .readGlobalObjectForType(reference.entity)
+              .withSourceInformation(reference.sourceInformation);
+          break;
+        case DeferredHolderExpressionKind.globalObjectForMember:
+          reference.value = _namer
+              .readGlobalObjectForMember(reference.entity)
+              .withSourceInformation(reference.sourceInformation);
+          break;
+      }
+    }
+  }
+
+  void _registerDeferredHolderExpression(DeferredHolderExpression node) {
+    holderReferences.add(node);
+  }
+}
+
+/// Scans a JavaScript AST to collect all the DeferredHolderExpression nodes.
+///
+/// The state is kept in the finalizer so that this scan could be extended to
+/// look for other deferred expressions in one pass.
+class _DeferredHolderExpressionCollectorVisitor extends js.BaseVisitor<void> {
+  final DeferredHolderExpressionFinalizerImpl _finalizer;
+
+  _DeferredHolderExpressionCollectorVisitor(this._finalizer);
+
+  @override
+  void visitNode(js.Node node) {
+    assert(node is! DeferredHolderExpression);
+    if (node is js.AstContainer) {
+      for (js.Node element in node.containedNodes) {
+        element.accept(this);
+      }
+    } else {
+      super.visitNode(node);
+    }
+  }
+
+  @override
+  void visitDeferredExpression(js.DeferredExpression node) {
+    if (node is DeferredHolderExpression) {
+      _finalizer._registerDeferredHolderExpression(node);
+    } else {
+      visitNode(node);
+    }
+  }
+}
diff --git a/pkg/compiler/lib/src/js_backend/namer.dart b/pkg/compiler/lib/src/js_backend/namer.dart
index 559c51e..4b1e667 100644
--- a/pkg/compiler/lib/src/js_backend/namer.dart
+++ b/pkg/compiler/lib/src/js_backend/namer.dart
@@ -31,6 +31,7 @@
 import '../universe/selector.dart' show Selector, SelectorKind;
 import '../util/util.dart';
 import '../world.dart' show JClosedWorld;
+import 'deferred_holder_expression.dart';
 import 'native_data.dart';
 
 part 'field_naming_mixin.dart';
@@ -2622,34 +2623,26 @@
 
   @override
   jsAst.Expression readGlobalObjectForLibrary(LibraryEntity library) {
-    jsAst.Expression expression = new ModularExpression(
-        ModularExpressionKind.globalObjectForLibrary, library);
-    _registry.registerModularExpression(expression);
-    return expression;
+    return DeferredHolderExpression(
+        DeferredHolderExpressionKind.globalObjectForLibrary, library);
   }
 
   @override
   jsAst.Expression readGlobalObjectForClass(ClassEntity element) {
-    jsAst.Expression expression = new ModularExpression(
-        ModularExpressionKind.globalObjectForClass, element);
-    _registry.registerModularExpression(expression);
-    return expression;
+    return DeferredHolderExpression(
+        DeferredHolderExpressionKind.globalObjectForClass, element);
   }
 
   @override
   jsAst.Expression readGlobalObjectForType(Entity element) {
-    jsAst.Expression expression = new ModularExpression(
-        ModularExpressionKind.globalObjectForType, element);
-    _registry.registerModularExpression(expression);
-    return expression;
+    return DeferredHolderExpression(
+        DeferredHolderExpressionKind.globalObjectForType, element);
   }
 
   @override
   jsAst.Expression readGlobalObjectForMember(MemberEntity element) {
-    jsAst.Expression expression = new ModularExpression(
-        ModularExpressionKind.globalObjectForMember, element);
-    _registry.registerModularExpression(expression);
-    return expression;
+    return DeferredHolderExpression(
+        DeferredHolderExpressionKind.globalObjectForMember, element);
   }
 
   @override
diff --git a/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart b/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
index ac5714b..c99d393 100644
--- a/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
@@ -834,7 +834,7 @@
         mainCode
       ]);
     }
-    finalizeStringAndTypeReferences(mainCode);
+    finalizeCode(mainCode);
     return mainCode;
   }
 
@@ -920,11 +920,11 @@
     if (_options.experimentStartupFunctions) {
       code = js.Parentheses(code);
     }
-    finalizeStringAndTypeReferences(code);
+    finalizeCode(code);
     return code;
   }
 
-  void finalizeStringAndTypeReferences(js.Node code) {
+  void finalizeCode(js.Node code) {
     StringReferenceFinalizer stringFinalizer =
         StringReferenceFinalizerImpl(_options.enableMinification);
     stringFinalizer.addCode(code);
@@ -933,6 +933,12 @@
         _emitter, _commonElements, _recipeEncoder, _options.enableMinification);
     finalizer.addCode(code);
     finalizer.finalize();
+
+    // DeferredHolders need to be finalized last.
+    DeferredHolderExpressionFinalizer holderFinalizer =
+        DeferredHolderExpressionFinalizerImpl(_namer);
+    holderFinalizer.addCode(code);
+    holderFinalizer.finalize();
   }
 
   /// Emits all holders, except for the static-state holder.
diff --git a/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart b/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart
index 2b23a2c..9a84f01 100644
--- a/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart
@@ -61,6 +61,10 @@
 import '../../js_backend/runtime_types_new.dart'
     show RecipeEncoder, RecipeEncoderImpl, Ruleset, RulesetEncoder;
 import '../../js_backend/runtime_types_resolution.dart' show RuntimeTypesNeed;
+import '../../js_backend/deferred_holder_expression.dart'
+    show
+        DeferredHolderExpressionFinalizer,
+        DeferredHolderExpressionFinalizerImpl;
 import '../../js_backend/type_reference.dart'
     show
         TypeReferenceFinalizer,
diff --git a/pkg/compiler/test/deferred_loading/data/lazy_types/main.dart b/pkg/compiler/test/deferred_loading/data/lazy_types/main.dart
index a5d40ab..fb34862 100644
--- a/pkg/compiler/test/deferred_loading/data/lazy_types/main.dart
+++ b/pkg/compiler/test/deferred_loading/data/lazy_types/main.dart
@@ -23,17 +23,17 @@
 
 /*two-frag.library: 
  a_pre_fragments=[
-  p1: {units: [1{libB}, 6{libA}], usedBy: [p2], needs: []},
-  p2: {units: [5{libB, libC}, 4{libA, libC}, 2{libC}], usedBy: [p3], needs: [p1]},
-  p3: {units: [3{libA, libB, libC}], usedBy: [], needs: [p2]}],
+  p1: {units: [6{libA}], usedBy: [p3], needs: []},
+  p2: {units: [1{libB}], usedBy: [p3], needs: []},
+  p3: {units: [3{libA, libB, libC}, 5{libB, libC}, 4{libA, libC}, 2{libC}], usedBy: [], needs: [p2, p1]}],
  b_finalized_fragments=[
-  f1: [1{libB}, 6{libA}],
-  f2: [2{libC}],
-  f3: [3{libA, libB, libC}]],
+  f1: [6{libA}],
+  f2: [1{libB}],
+  f3: [3{libA, libB, libC}, 2{libC}]],
  c_steps=[
   libA=(f3, f1),
-  libB=(f3, f1),
-  libC=(f3, f2)]
+  libB=(f3, f2),
+  libC=(f3)]
 */
 
 /*three-frag.library: 
diff --git a/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart b/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart
index 495ae0c..795419a 100644
--- a/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart
@@ -52,6 +52,7 @@
         messageNonAgnosticConstant,
         messageNotAConstantExpression,
         noLength,
+        templateConstEvalBadState,
         templateConstEvalCaseImplementsEqual,
         templateConstEvalDeferredLibrary,
         templateConstEvalDuplicateElement,
@@ -1006,8 +1007,16 @@
         errorReporter.reportInvalidExpression(invalid);
         return new UnevaluatedConstant(invalid);
       } else if (result is _AbortDueToThrowConstant) {
-        final Message message = templateConstEvalUnhandledException
-            .withArguments(result.throwValue, isNonNullableByDefault);
+        final Object value = result.throwValue;
+        Message message;
+        if (value is Constant) {
+          message = templateConstEvalUnhandledException.withArguments(
+              value, isNonNullableByDefault);
+        } else if (value is StateError) {
+          message = templateConstEvalBadState.withArguments(value.message);
+        }
+        assert(message != null);
+
         final Uri uri = getFileUri(result.node);
         final int fileOffset = getFileOffset(uri, result.node);
         final LocatedMessage locatedMessageActualError =
@@ -2478,6 +2487,42 @@
           new PropertyGet(extract(receiver), node.name, node.interfaceTarget));
     } else if (receiver is NullConstant) {
       return createErrorConstant(node, messageConstEvalNullValue);
+    } else if (receiver is ListConstant && enableConstFunctions) {
+      switch (node.name.text) {
+        case 'first':
+          if (receiver.entries.isEmpty) {
+            return new _AbortDueToThrowConstant(
+                node, new StateError('No element'));
+          }
+          return receiver.entries.first;
+        case 'hashCode':
+          return new IntConstant(receiver.entries.hashCode);
+        case 'isEmpty':
+          return new BoolConstant(receiver.entries.isEmpty);
+        case 'isNotEmpty':
+          return new BoolConstant(receiver.entries.isNotEmpty);
+        // TODO(kallentu): case 'iterator'
+        case 'last':
+          if (receiver.entries.isEmpty) {
+            return new _AbortDueToThrowConstant(
+                node, new StateError('No element'));
+          }
+          return receiver.entries.last;
+        case 'length':
+          return new IntConstant(receiver.entries.length);
+        // TODO(kallentu): case 'reversed'
+        case 'runtimeType':
+          return new TypeLiteralConstant(receiver.typeArgument);
+        case 'single':
+          if (receiver.entries.isEmpty) {
+            return new _AbortDueToThrowConstant(
+                node, new StateError('No element'));
+          } else if (receiver.entries.length > 1) {
+            return new _AbortDueToThrowConstant(
+                node, new StateError('Too many elements'));
+          }
+          return receiver.entries.single;
+      }
     }
     return createErrorConstant(
         node,
@@ -3582,17 +3627,33 @@
     if (tryStatus is AbortStatus) {
       final Constant error = tryStatus.error;
       if (error is _AbortDueToThrowConstant) {
-        final Constant throwConstant = error.throwValue;
+        final Object throwValue = error.throwValue;
         final DartType defaultType =
             exprEvaluator.typeEnvironment.coreTypes.objectNonNullableRawType;
+
+        DartType throwType;
+        if (throwValue is Constant) {
+          throwType = throwValue.getType(exprEvaluator._staticTypeContext);
+        } else if (throwValue is StateError) {
+          final Class stateErrorClass = exprEvaluator
+              .coreTypes.coreLibrary.classes
+              .firstWhere((Class klass) => klass.name == 'StateError');
+          throwType =
+              new InterfaceType(stateErrorClass, Nullability.nonNullable);
+        }
+        assert(throwType != null);
+
         for (Catch catchClause in node.catches) {
-          if (exprEvaluator.isSubtype(throwConstant, catchClause.guard,
-                  SubtypeCheckMode.withNullabilities) ||
+          if (exprEvaluator.typeEnvironment.isSubtypeOf(throwType,
+                  catchClause.guard, SubtypeCheckMode.withNullabilities) ||
               catchClause.guard == defaultType) {
             return exprEvaluator.withNewEnvironment(() {
               if (catchClause.exception != null) {
-                exprEvaluator.env
-                    .addVariableValue(catchClause.exception, throwConstant);
+                // TODO(kallentu): Store non-constant exceptions.
+                if (throwValue is Constant) {
+                  exprEvaluator.env
+                      .addVariableValue(catchClause.exception, throwValue);
+                }
               }
               // TODO(kallentu): Store appropriate stack trace in environment.
               return catchClause.body.accept(this);
@@ -3993,8 +4054,8 @@
 }
 
 class _AbortDueToThrowConstant extends AbortConstant {
-  final Throw node;
-  final Constant throwValue;
+  final TreeNode node;
+  final Object throwValue;
 
   _AbortDueToThrowConstant(this.node, this.throwValue);
 
diff --git a/pkg/front_end/messages.status b/pkg/front_end/messages.status
index 35e9097..99253fc 100644
--- a/pkg/front_end/messages.status
+++ b/pkg/front_end/messages.status
@@ -92,6 +92,8 @@
 ConstConstructorLateFinalFieldWarning/example: Fail
 ConstConstructorNonFinalField/example: Fail
 ConstConstructorRedirectionToNonConst/analyzerCode: Fail # The analyzer doesn't report this error.
+ConstEvalBadState/analyzerCode: Fail
+ConstEvalBadState/example: Fail
 ConstEvalCaseImplementsEqual/analyzerCode: Fail
 ConstEvalCaseImplementsEqual/example: Fail
 ConstEvalCircularity/example: Fail
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index 540ad5d..6b392cf 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -106,6 +106,9 @@
 ConstEvalStartingPoint:
   template: "Constant evaluation error:"
 
+ConstEvalBadState:
+  template: "Bad state: '#stringOKEmpty'"
+
 ConstEvalContext:
   template: "While analyzing:"
 
diff --git a/pkg/front_end/testcases/const_functions/const_functions_list.dart b/pkg/front_end/testcases/const_functions/const_functions_list.dart
new file mode 100644
index 0000000..4d16542
--- /dev/null
+++ b/pkg/front_end/testcases/const_functions/const_functions_list.dart
@@ -0,0 +1,108 @@
+// 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.
+
+// Tests lists with const functions.
+
+import "package:expect/expect.dart";
+
+const firstVar = firstFn();
+int firstFn() {
+  const List<int> x = [1, 2];
+  return x.first;
+}
+
+const firstCatchVar = firstCatchFn();
+int firstCatchFn() {
+  try {
+    const List<int> x = [];
+    var v = x.first;
+  } on StateError {
+    return 0;
+  }
+  return 1;
+}
+
+const isEmptyVar = isEmptyFn();
+bool isEmptyFn() {
+  const List<int> x = [1, 2];
+  return x.isEmpty;
+}
+
+const isNotEmptyVar = isNotEmptyFn();
+bool isNotEmptyFn() {
+  const List<int> x = [1, 2];
+  return x.isNotEmpty;
+}
+
+const lastVar = lastFn();
+int lastFn() {
+  const List<int> x = [1, 2];
+  return x.last;
+}
+
+const lastCatchVar = lastCatchFn();
+int lastCatchFn() {
+  try {
+    const List<int> x = [];
+    var v = x.last;
+  } on StateError {
+    return 0;
+  }
+  return 1;
+}
+
+const lengthVar = lengthFn();
+int lengthFn() {
+  const List<int> x = [1, 2];
+  return x.length;
+}
+
+const singleVar = singleFn();
+int singleFn() {
+  const List<int> x = [1];
+  return x.single;
+}
+
+const singleCatchVar = singleCatchFn();
+int singleCatchFn() {
+  try {
+    const List<int> x = [];
+    var v = x.single;
+  } on StateError {
+    return 0;
+  }
+  return 1;
+}
+
+const singleCatchVar2 = singleCatchFn2();
+int singleCatchFn2() {
+  try {
+    const List<int> x = [1, 2];
+    var v = x.single;
+  } on StateError {
+    return 0;
+  }
+  return 1;
+}
+
+const typeExample = int;
+const typeVar = typeFn();
+Type typeFn() {
+  const List<int> x = [1, 2];
+  return x.runtimeType;
+}
+
+void main() {
+  Expect.equals(firstVar, 1);
+  Expect.equals(firstCatchVar, 0);
+  Expect.equals(isEmptyVar, false);
+  Expect.equals(isNotEmptyVar, true);
+  Expect.equals(lastVar, 2);
+  Expect.equals(lastCatchVar, 0);
+  Expect.equals(lengthVar, 2);
+  Expect.equals(singleVar, 1);
+  Expect.equals(singleCatchVar, 0);
+  Expect.equals(singleCatchVar2, 0);
+  Expect.equals(typeVar, int);
+}
diff --git a/pkg/front_end/testcases/const_functions/const_functions_list.dart.strong.expect b/pkg/front_end/testcases/const_functions/const_functions_list.dart.strong.expect
new file mode 100644
index 0000000..b978859
--- /dev/null
+++ b/pkg/front_end/testcases/const_functions/const_functions_list.dart.strong.expect
@@ -0,0 +1,101 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+import "package:expect/expect.dart" as exp;
+
+import "package:expect/expect.dart";
+
+static const field core::int firstVar = #C1;
+static const field core::int firstCatchVar = #C2;
+static const field core::bool isEmptyVar = #C3;
+static const field core::bool isNotEmptyVar = #C4;
+static const field core::int lastVar = #C5;
+static const field core::int lastCatchVar = #C2;
+static const field core::int lengthVar = #C5;
+static const field core::int singleVar = #C1;
+static const field core::int singleCatchVar = #C2;
+static const field core::int singleCatchVar2 = #C2;
+static const field core::Type typeExample = #C6;
+static const field core::Type typeVar = #C6;
+static method firstFn() → core::int {
+  return (#C7).{core::Iterable::first};
+}
+static method firstCatchFn() → core::int {
+  try {
+    core::int v = (#C8).{core::Iterable::first};
+  }
+  on core::StateError catch(no-exception-var) {
+    return 0;
+  }
+  return 1;
+}
+static method isEmptyFn() → core::bool {
+  return (#C7).{core::Iterable::isEmpty};
+}
+static method isNotEmptyFn() → core::bool {
+  return (#C7).{core::Iterable::isNotEmpty};
+}
+static method lastFn() → core::int {
+  return (#C7).{core::Iterable::last};
+}
+static method lastCatchFn() → core::int {
+  try {
+    core::int v = (#C8).{core::Iterable::last};
+  }
+  on core::StateError catch(no-exception-var) {
+    return 0;
+  }
+  return 1;
+}
+static method lengthFn() → core::int {
+  return (#C7).{core::List::length};
+}
+static method singleFn() → core::int {
+  return (#C9).{core::Iterable::single};
+}
+static method singleCatchFn() → core::int {
+  try {
+    core::int v = (#C8).{core::Iterable::single};
+  }
+  on core::StateError catch(no-exception-var) {
+    return 0;
+  }
+  return 1;
+}
+static method singleCatchFn2() → core::int {
+  try {
+    core::int v = (#C7).{core::Iterable::single};
+  }
+  on core::StateError catch(no-exception-var) {
+    return 0;
+  }
+  return 1;
+}
+static method typeFn() → core::Type {
+  return (#C7).{core::Object::runtimeType};
+}
+static method main() → void {
+  exp::Expect::equals(#C1, 1);
+  exp::Expect::equals(#C2, 0);
+  exp::Expect::equals(#C3, false);
+  exp::Expect::equals(#C4, true);
+  exp::Expect::equals(#C5, 2);
+  exp::Expect::equals(#C2, 0);
+  exp::Expect::equals(#C5, 2);
+  exp::Expect::equals(#C1, 1);
+  exp::Expect::equals(#C2, 0);
+  exp::Expect::equals(#C2, 0);
+  exp::Expect::equals(#C6, #C6);
+}
+
+constants  {
+  #C1 = 1
+  #C2 = 0
+  #C3 = false
+  #C4 = true
+  #C5 = 2
+  #C6 = TypeLiteralConstant(core::int)
+  #C7 = <core::int>[#C1, #C5]
+  #C8 = <core::int>[]
+  #C9 = <core::int>[#C1]
+}
diff --git a/pkg/front_end/testcases/const_functions/const_functions_list.dart.strong.transformed.expect b/pkg/front_end/testcases/const_functions/const_functions_list.dart.strong.transformed.expect
new file mode 100644
index 0000000..b978859
--- /dev/null
+++ b/pkg/front_end/testcases/const_functions/const_functions_list.dart.strong.transformed.expect
@@ -0,0 +1,101 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+import "package:expect/expect.dart" as exp;
+
+import "package:expect/expect.dart";
+
+static const field core::int firstVar = #C1;
+static const field core::int firstCatchVar = #C2;
+static const field core::bool isEmptyVar = #C3;
+static const field core::bool isNotEmptyVar = #C4;
+static const field core::int lastVar = #C5;
+static const field core::int lastCatchVar = #C2;
+static const field core::int lengthVar = #C5;
+static const field core::int singleVar = #C1;
+static const field core::int singleCatchVar = #C2;
+static const field core::int singleCatchVar2 = #C2;
+static const field core::Type typeExample = #C6;
+static const field core::Type typeVar = #C6;
+static method firstFn() → core::int {
+  return (#C7).{core::Iterable::first};
+}
+static method firstCatchFn() → core::int {
+  try {
+    core::int v = (#C8).{core::Iterable::first};
+  }
+  on core::StateError catch(no-exception-var) {
+    return 0;
+  }
+  return 1;
+}
+static method isEmptyFn() → core::bool {
+  return (#C7).{core::Iterable::isEmpty};
+}
+static method isNotEmptyFn() → core::bool {
+  return (#C7).{core::Iterable::isNotEmpty};
+}
+static method lastFn() → core::int {
+  return (#C7).{core::Iterable::last};
+}
+static method lastCatchFn() → core::int {
+  try {
+    core::int v = (#C8).{core::Iterable::last};
+  }
+  on core::StateError catch(no-exception-var) {
+    return 0;
+  }
+  return 1;
+}
+static method lengthFn() → core::int {
+  return (#C7).{core::List::length};
+}
+static method singleFn() → core::int {
+  return (#C9).{core::Iterable::single};
+}
+static method singleCatchFn() → core::int {
+  try {
+    core::int v = (#C8).{core::Iterable::single};
+  }
+  on core::StateError catch(no-exception-var) {
+    return 0;
+  }
+  return 1;
+}
+static method singleCatchFn2() → core::int {
+  try {
+    core::int v = (#C7).{core::Iterable::single};
+  }
+  on core::StateError catch(no-exception-var) {
+    return 0;
+  }
+  return 1;
+}
+static method typeFn() → core::Type {
+  return (#C7).{core::Object::runtimeType};
+}
+static method main() → void {
+  exp::Expect::equals(#C1, 1);
+  exp::Expect::equals(#C2, 0);
+  exp::Expect::equals(#C3, false);
+  exp::Expect::equals(#C4, true);
+  exp::Expect::equals(#C5, 2);
+  exp::Expect::equals(#C2, 0);
+  exp::Expect::equals(#C5, 2);
+  exp::Expect::equals(#C1, 1);
+  exp::Expect::equals(#C2, 0);
+  exp::Expect::equals(#C2, 0);
+  exp::Expect::equals(#C6, #C6);
+}
+
+constants  {
+  #C1 = 1
+  #C2 = 0
+  #C3 = false
+  #C4 = true
+  #C5 = 2
+  #C6 = TypeLiteralConstant(core::int)
+  #C7 = <core::int>[#C1, #C5]
+  #C8 = <core::int>[]
+  #C9 = <core::int>[#C1]
+}
diff --git a/pkg/front_end/testcases/const_functions/const_functions_list.dart.textual_outline.expect b/pkg/front_end/testcases/const_functions/const_functions_list.dart.textual_outline.expect
new file mode 100644
index 0000000..91be3d9
--- /dev/null
+++ b/pkg/front_end/testcases/const_functions/const_functions_list.dart.textual_outline.expect
@@ -0,0 +1,26 @@
+import "package:expect/expect.dart";
+
+const firstVar = firstFn();
+int firstFn() {}
+const firstCatchVar = firstCatchFn();
+int firstCatchFn() {}
+const isEmptyVar = isEmptyFn();
+bool isEmptyFn() {}
+const isNotEmptyVar = isNotEmptyFn();
+bool isNotEmptyFn() {}
+const lastVar = lastFn();
+int lastFn() {}
+const lastCatchVar = lastCatchFn();
+int lastCatchFn() {}
+const lengthVar = lengthFn();
+int lengthFn() {}
+const singleVar = singleFn();
+int singleFn() {}
+const singleCatchVar = singleCatchFn();
+int singleCatchFn() {}
+const singleCatchVar2 = singleCatchFn2();
+int singleCatchFn2() {}
+const typeExample = int;
+const typeVar = typeFn();
+Type typeFn() {}
+void main() {}
diff --git a/pkg/front_end/testcases/const_functions/const_functions_list.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/const_functions/const_functions_list.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..a297feb
--- /dev/null
+++ b/pkg/front_end/testcases/const_functions/const_functions_list.dart.textual_outline_modelled.expect
@@ -0,0 +1,26 @@
+import "package:expect/expect.dart";
+
+Type typeFn() {}
+bool isEmptyFn() {}
+bool isNotEmptyFn() {}
+const firstCatchVar = firstCatchFn();
+const firstVar = firstFn();
+const isEmptyVar = isEmptyFn();
+const isNotEmptyVar = isNotEmptyFn();
+const lastCatchVar = lastCatchFn();
+const lastVar = lastFn();
+const lengthVar = lengthFn();
+const singleCatchVar = singleCatchFn();
+const singleCatchVar2 = singleCatchFn2();
+const singleVar = singleFn();
+const typeExample = int;
+const typeVar = typeFn();
+int firstCatchFn() {}
+int firstFn() {}
+int lastCatchFn() {}
+int lastFn() {}
+int lengthFn() {}
+int singleCatchFn() {}
+int singleCatchFn2() {}
+int singleFn() {}
+void main() {}
diff --git a/pkg/front_end/testcases/const_functions/const_functions_list.dart.weak.expect b/pkg/front_end/testcases/const_functions/const_functions_list.dart.weak.expect
new file mode 100644
index 0000000..e5b0a71
--- /dev/null
+++ b/pkg/front_end/testcases/const_functions/const_functions_list.dart.weak.expect
@@ -0,0 +1,101 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+import "package:expect/expect.dart" as exp;
+
+import "package:expect/expect.dart";
+
+static const field core::int firstVar = #C1;
+static const field core::int firstCatchVar = #C2;
+static const field core::bool isEmptyVar = #C3;
+static const field core::bool isNotEmptyVar = #C4;
+static const field core::int lastVar = #C5;
+static const field core::int lastCatchVar = #C2;
+static const field core::int lengthVar = #C5;
+static const field core::int singleVar = #C1;
+static const field core::int singleCatchVar = #C2;
+static const field core::int singleCatchVar2 = #C2;
+static const field core::Type typeExample = #C6;
+static const field core::Type typeVar = #C6;
+static method firstFn() → core::int {
+  return (#C7).{core::Iterable::first};
+}
+static method firstCatchFn() → core::int {
+  try {
+    core::int v = (#C8).{core::Iterable::first};
+  }
+  on core::StateError catch(no-exception-var) {
+    return 0;
+  }
+  return 1;
+}
+static method isEmptyFn() → core::bool {
+  return (#C7).{core::Iterable::isEmpty};
+}
+static method isNotEmptyFn() → core::bool {
+  return (#C7).{core::Iterable::isNotEmpty};
+}
+static method lastFn() → core::int {
+  return (#C7).{core::Iterable::last};
+}
+static method lastCatchFn() → core::int {
+  try {
+    core::int v = (#C8).{core::Iterable::last};
+  }
+  on core::StateError catch(no-exception-var) {
+    return 0;
+  }
+  return 1;
+}
+static method lengthFn() → core::int {
+  return (#C7).{core::List::length};
+}
+static method singleFn() → core::int {
+  return (#C9).{core::Iterable::single};
+}
+static method singleCatchFn() → core::int {
+  try {
+    core::int v = (#C8).{core::Iterable::single};
+  }
+  on core::StateError catch(no-exception-var) {
+    return 0;
+  }
+  return 1;
+}
+static method singleCatchFn2() → core::int {
+  try {
+    core::int v = (#C7).{core::Iterable::single};
+  }
+  on core::StateError catch(no-exception-var) {
+    return 0;
+  }
+  return 1;
+}
+static method typeFn() → core::Type {
+  return (#C7).{core::Object::runtimeType};
+}
+static method main() → void {
+  exp::Expect::equals(#C1, 1);
+  exp::Expect::equals(#C2, 0);
+  exp::Expect::equals(#C3, false);
+  exp::Expect::equals(#C4, true);
+  exp::Expect::equals(#C5, 2);
+  exp::Expect::equals(#C2, 0);
+  exp::Expect::equals(#C5, 2);
+  exp::Expect::equals(#C1, 1);
+  exp::Expect::equals(#C2, 0);
+  exp::Expect::equals(#C2, 0);
+  exp::Expect::equals(#C6, #C6);
+}
+
+constants  {
+  #C1 = 1
+  #C2 = 0
+  #C3 = false
+  #C4 = true
+  #C5 = 2
+  #C6 = TypeLiteralConstant(core::int*)
+  #C7 = <core::int*>[#C1, #C5]
+  #C8 = <core::int*>[]
+  #C9 = <core::int*>[#C1]
+}
diff --git a/pkg/front_end/testcases/const_functions/const_functions_list.dart.weak.outline.expect b/pkg/front_end/testcases/const_functions/const_functions_list.dart.weak.outline.expect
new file mode 100644
index 0000000..dcd0734
--- /dev/null
+++ b/pkg/front_end/testcases/const_functions/const_functions_list.dart.weak.outline.expect
@@ -0,0 +1,47 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+import "package:expect/expect.dart";
+
+static const field core::int firstVar = self::firstFn();
+static const field core::int firstCatchVar = self::firstCatchFn();
+static const field core::bool isEmptyVar = self::isEmptyFn();
+static const field core::bool isNotEmptyVar = self::isNotEmptyFn();
+static const field core::int lastVar = self::lastFn();
+static const field core::int lastCatchVar = self::lastCatchFn();
+static const field core::int lengthVar = self::lengthFn();
+static const field core::int singleVar = self::singleFn();
+static const field core::int singleCatchVar = self::singleCatchFn();
+static const field core::int singleCatchVar2 = self::singleCatchFn2();
+static const field core::Type typeExample = core::int;
+static const field core::Type typeVar = self::typeFn();
+static method firstFn() → core::int
+  ;
+static method firstCatchFn() → core::int
+  ;
+static method isEmptyFn() → core::bool
+  ;
+static method isNotEmptyFn() → core::bool
+  ;
+static method lastFn() → core::int
+  ;
+static method lastCatchFn() → core::int
+  ;
+static method lengthFn() → core::int
+  ;
+static method singleFn() → core::int
+  ;
+static method singleCatchFn() → core::int
+  ;
+static method singleCatchFn2() → core::int
+  ;
+static method typeFn() → core::Type
+  ;
+static method main() → void
+  ;
+
+
+Extra constant evaluation status:
+Evaluated: TypeLiteral @ org-dartlang-testcase:///const_functions_list.dart:89:21 -> TypeLiteralConstant(int*)
+Extra constant evaluation: evaluated: 12, effectively constant: 1
diff --git a/pkg/front_end/testcases/const_functions/const_functions_list.dart.weak.transformed.expect b/pkg/front_end/testcases/const_functions/const_functions_list.dart.weak.transformed.expect
new file mode 100644
index 0000000..e5b0a71
--- /dev/null
+++ b/pkg/front_end/testcases/const_functions/const_functions_list.dart.weak.transformed.expect
@@ -0,0 +1,101 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+import "package:expect/expect.dart" as exp;
+
+import "package:expect/expect.dart";
+
+static const field core::int firstVar = #C1;
+static const field core::int firstCatchVar = #C2;
+static const field core::bool isEmptyVar = #C3;
+static const field core::bool isNotEmptyVar = #C4;
+static const field core::int lastVar = #C5;
+static const field core::int lastCatchVar = #C2;
+static const field core::int lengthVar = #C5;
+static const field core::int singleVar = #C1;
+static const field core::int singleCatchVar = #C2;
+static const field core::int singleCatchVar2 = #C2;
+static const field core::Type typeExample = #C6;
+static const field core::Type typeVar = #C6;
+static method firstFn() → core::int {
+  return (#C7).{core::Iterable::first};
+}
+static method firstCatchFn() → core::int {
+  try {
+    core::int v = (#C8).{core::Iterable::first};
+  }
+  on core::StateError catch(no-exception-var) {
+    return 0;
+  }
+  return 1;
+}
+static method isEmptyFn() → core::bool {
+  return (#C7).{core::Iterable::isEmpty};
+}
+static method isNotEmptyFn() → core::bool {
+  return (#C7).{core::Iterable::isNotEmpty};
+}
+static method lastFn() → core::int {
+  return (#C7).{core::Iterable::last};
+}
+static method lastCatchFn() → core::int {
+  try {
+    core::int v = (#C8).{core::Iterable::last};
+  }
+  on core::StateError catch(no-exception-var) {
+    return 0;
+  }
+  return 1;
+}
+static method lengthFn() → core::int {
+  return (#C7).{core::List::length};
+}
+static method singleFn() → core::int {
+  return (#C9).{core::Iterable::single};
+}
+static method singleCatchFn() → core::int {
+  try {
+    core::int v = (#C8).{core::Iterable::single};
+  }
+  on core::StateError catch(no-exception-var) {
+    return 0;
+  }
+  return 1;
+}
+static method singleCatchFn2() → core::int {
+  try {
+    core::int v = (#C7).{core::Iterable::single};
+  }
+  on core::StateError catch(no-exception-var) {
+    return 0;
+  }
+  return 1;
+}
+static method typeFn() → core::Type {
+  return (#C7).{core::Object::runtimeType};
+}
+static method main() → void {
+  exp::Expect::equals(#C1, 1);
+  exp::Expect::equals(#C2, 0);
+  exp::Expect::equals(#C3, false);
+  exp::Expect::equals(#C4, true);
+  exp::Expect::equals(#C5, 2);
+  exp::Expect::equals(#C2, 0);
+  exp::Expect::equals(#C5, 2);
+  exp::Expect::equals(#C1, 1);
+  exp::Expect::equals(#C2, 0);
+  exp::Expect::equals(#C2, 0);
+  exp::Expect::equals(#C6, #C6);
+}
+
+constants  {
+  #C1 = 1
+  #C2 = 0
+  #C3 = false
+  #C4 = true
+  #C5 = 2
+  #C6 = TypeLiteralConstant(core::int*)
+  #C7 = <core::int*>[#C1, #C5]
+  #C8 = <core::int*>[]
+  #C9 = <core::int*>[#C1]
+}
diff --git a/pkg/front_end/testcases/const_functions/const_functions_list_error.dart b/pkg/front_end/testcases/const_functions/const_functions_list_error.dart
new file mode 100644
index 0000000..b2e29ac
--- /dev/null
+++ b/pkg/front_end/testcases/const_functions/const_functions_list_error.dart
@@ -0,0 +1,39 @@
+// 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.
+
+// Tests erroneous list usage with const functions.
+
+import "package:expect/expect.dart";
+
+const firstException = firstExceptionFn();
+int firstExceptionFn() {
+  const List<int> x = [];
+  return x.first;
+}
+
+const lastException = lastExceptionFn();
+int lastExceptionFn() {
+  const List<int> x = [];
+  return x.last;
+}
+
+const singleException = singleExceptionFn();
+int singleExceptionFn() {
+  const List<int> x = [];
+  return x.single;
+}
+
+const singleExceptionMulti = singleExceptionMultiFn();
+int singleExceptionMultiFn() {
+  const List<int> x = [1, 2];
+  return x.single;
+}
+
+const invalidProperty = invalidPropertyFn();
+int invalidPropertyFn() {
+  const List<int> x = [1, 2];
+  return x.invalidProperty;
+}
+
+void main() {}
diff --git a/pkg/front_end/testcases/const_functions/const_functions_list_error.dart.strong.expect b/pkg/front_end/testcases/const_functions/const_functions_list_error.dart.strong.expect
new file mode 100644
index 0000000..4024724
--- /dev/null
+++ b/pkg/front_end/testcases/const_functions/const_functions_list_error.dart.strong.expect
@@ -0,0 +1,79 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/const_functions/const_functions_list_error.dart:36:12: Error: The getter 'invalidProperty' isn't defined for the class 'List<int>'.
+//  - 'List' is from 'dart:core'.
+// Try correcting the name to the name of an existing getter, or defining a getter or field named 'invalidProperty'.
+//   return x.invalidProperty;
+//            ^^^^^^^^^^^^^^^
+//
+// pkg/front_end/testcases/const_functions/const_functions_list_error.dart:9:24: Error: Constant evaluation error:
+// const firstException = firstExceptionFn();
+//                        ^
+// pkg/front_end/testcases/const_functions/const_functions_list_error.dart:12:12: Context: Bad state: 'No element'
+//   return x.first;
+//            ^
+//
+// pkg/front_end/testcases/const_functions/const_functions_list_error.dart:15:23: Error: Constant evaluation error:
+// const lastException = lastExceptionFn();
+//                       ^
+// pkg/front_end/testcases/const_functions/const_functions_list_error.dart:18:12: Context: Bad state: 'No element'
+//   return x.last;
+//            ^
+//
+// pkg/front_end/testcases/const_functions/const_functions_list_error.dart:21:25: Error: Constant evaluation error:
+// const singleException = singleExceptionFn();
+//                         ^
+// pkg/front_end/testcases/const_functions/const_functions_list_error.dart:24:12: Context: Bad state: 'No element'
+//   return x.single;
+//            ^
+//
+// pkg/front_end/testcases/const_functions/const_functions_list_error.dart:27:30: Error: Constant evaluation error:
+// const singleExceptionMulti = singleExceptionMultiFn();
+//                              ^
+// pkg/front_end/testcases/const_functions/const_functions_list_error.dart:30:12: Context: Bad state: 'Too many elements'
+//   return x.single;
+//            ^
+//
+import self as self;
+import "dart:core" as core;
+
+import "package:expect/expect.dart";
+
+static const field core::int firstException = invalid-expression "Bad state: 'No element'";
+static const field core::int lastException = invalid-expression "Bad state: 'No element'";
+static const field core::int singleException = invalid-expression "Bad state: 'No element'";
+static const field core::int singleExceptionMulti = invalid-expression "Bad state: 'Too many elements'";
+static const field core::int invalidProperty = invalid-expression "pkg/front_end/testcases/const_functions/const_functions_list_error.dart:36:12: Error: The getter 'invalidProperty' isn't defined for the class 'List<int>'.
+ - 'List' is from 'dart:core'.
+Try correcting the name to the name of an existing getter, or defining a getter or field named 'invalidProperty'.
+  return x.invalidProperty;
+           ^^^^^^^^^^^^^^^";
+static method firstExceptionFn() → core::int {
+  return (#C1).{core::Iterable::first};
+}
+static method lastExceptionFn() → core::int {
+  return (#C1).{core::Iterable::last};
+}
+static method singleExceptionFn() → core::int {
+  return (#C1).{core::Iterable::single};
+}
+static method singleExceptionMultiFn() → core::int {
+  return (#C4).{core::Iterable::single};
+}
+static method invalidPropertyFn() → core::int {
+  return invalid-expression "pkg/front_end/testcases/const_functions/const_functions_list_error.dart:36:12: Error: The getter 'invalidProperty' isn't defined for the class 'List<int>'.
+ - 'List' is from 'dart:core'.
+Try correcting the name to the name of an existing getter, or defining a getter or field named 'invalidProperty'.
+  return x.invalidProperty;
+           ^^^^^^^^^^^^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} core::int;
+}
+static method main() → void {}
+
+constants  {
+  #C1 = <core::int>[]
+  #C2 = 1
+  #C3 = 2
+  #C4 = <core::int>[#C2, #C3]
+}
diff --git a/pkg/front_end/testcases/const_functions/const_functions_list_error.dart.strong.transformed.expect b/pkg/front_end/testcases/const_functions/const_functions_list_error.dart.strong.transformed.expect
new file mode 100644
index 0000000..6cf44d0
--- /dev/null
+++ b/pkg/front_end/testcases/const_functions/const_functions_list_error.dart.strong.transformed.expect
@@ -0,0 +1,79 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/const_functions/const_functions_list_error.dart:36:12: Error: The getter 'invalidProperty' isn't defined for the class 'List<int>'.
+//  - 'List' is from 'dart:core'.
+// Try correcting the name to the name of an existing getter, or defining a getter or field named 'invalidProperty'.
+//   return x.invalidProperty;
+//            ^^^^^^^^^^^^^^^
+//
+// pkg/front_end/testcases/const_functions/const_functions_list_error.dart:9:24: Error: Constant evaluation error:
+// const firstException = firstExceptionFn();
+//                        ^
+// pkg/front_end/testcases/const_functions/const_functions_list_error.dart:12:12: Context: Bad state: 'No element'
+//   return x.first;
+//            ^
+//
+// pkg/front_end/testcases/const_functions/const_functions_list_error.dart:15:23: Error: Constant evaluation error:
+// const lastException = lastExceptionFn();
+//                       ^
+// pkg/front_end/testcases/const_functions/const_functions_list_error.dart:18:12: Context: Bad state: 'No element'
+//   return x.last;
+//            ^
+//
+// pkg/front_end/testcases/const_functions/const_functions_list_error.dart:21:25: Error: Constant evaluation error:
+// const singleException = singleExceptionFn();
+//                         ^
+// pkg/front_end/testcases/const_functions/const_functions_list_error.dart:24:12: Context: Bad state: 'No element'
+//   return x.single;
+//            ^
+//
+// pkg/front_end/testcases/const_functions/const_functions_list_error.dart:27:30: Error: Constant evaluation error:
+// const singleExceptionMulti = singleExceptionMultiFn();
+//                              ^
+// pkg/front_end/testcases/const_functions/const_functions_list_error.dart:30:12: Context: Bad state: 'Too many elements'
+//   return x.single;
+//            ^
+//
+import self as self;
+import "dart:core" as core;
+
+import "package:expect/expect.dart";
+
+static const field core::int firstException = invalid-expression "Bad state: 'No element'";
+static const field core::int lastException = invalid-expression "Bad state: 'No element'";
+static const field core::int singleException = invalid-expression "Bad state: 'No element'";
+static const field core::int singleExceptionMulti = invalid-expression "Bad state: 'Too many elements'";
+static const field core::int invalidProperty = invalid-expression "pkg/front_end/testcases/const_functions/const_functions_list_error.dart:36:12: Error: The getter 'invalidProperty' isn't defined for the class 'List<int>'.
+ - 'List' is from 'dart:core'.
+Try correcting the name to the name of an existing getter, or defining a getter or field named 'invalidProperty'.
+  return x.invalidProperty;
+           ^^^^^^^^^^^^^^^";
+static method firstExceptionFn() → core::int {
+  return (#C1).{core::Iterable::first};
+}
+static method lastExceptionFn() → core::int {
+  return (#C1).{core::Iterable::last};
+}
+static method singleExceptionFn() → core::int {
+  return (#C1).{core::Iterable::single};
+}
+static method singleExceptionMultiFn() → core::int {
+  return (#C4).{core::Iterable::single};
+}
+static method invalidPropertyFn() → core::int {
+  return invalid-expression "pkg/front_end/testcases/const_functions/const_functions_list_error.dart:36:12: Error: The getter 'invalidProperty' isn't defined for the class 'List<int>'.
+ - 'List' is from 'dart:core'.
+Try correcting the name to the name of an existing getter, or defining a getter or field named 'invalidProperty'.
+  return x.invalidProperty;
+           ^^^^^^^^^^^^^^^";
+}
+static method main() → void {}
+
+constants  {
+  #C1 = <core::int>[]
+  #C2 = 1
+  #C3 = 2
+  #C4 = <core::int>[#C2, #C3]
+}
diff --git a/pkg/front_end/testcases/const_functions/const_functions_list_error.dart.textual_outline.expect b/pkg/front_end/testcases/const_functions/const_functions_list_error.dart.textual_outline.expect
new file mode 100644
index 0000000..4697c853
--- /dev/null
+++ b/pkg/front_end/testcases/const_functions/const_functions_list_error.dart.textual_outline.expect
@@ -0,0 +1,13 @@
+import "package:expect/expect.dart";
+
+const firstException = firstExceptionFn();
+int firstExceptionFn() {}
+const lastException = lastExceptionFn();
+int lastExceptionFn() {}
+const singleException = singleExceptionFn();
+int singleExceptionFn() {}
+const singleExceptionMulti = singleExceptionMultiFn();
+int singleExceptionMultiFn() {}
+const invalidProperty = invalidPropertyFn();
+int invalidPropertyFn() {}
+void main() {}
diff --git a/pkg/front_end/testcases/const_functions/const_functions_list_error.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/const_functions/const_functions_list_error.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..c41226a
--- /dev/null
+++ b/pkg/front_end/testcases/const_functions/const_functions_list_error.dart.textual_outline_modelled.expect
@@ -0,0 +1,13 @@
+import "package:expect/expect.dart";
+
+const firstException = firstExceptionFn();
+const invalidProperty = invalidPropertyFn();
+const lastException = lastExceptionFn();
+const singleException = singleExceptionFn();
+const singleExceptionMulti = singleExceptionMultiFn();
+int firstExceptionFn() {}
+int invalidPropertyFn() {}
+int lastExceptionFn() {}
+int singleExceptionFn() {}
+int singleExceptionMultiFn() {}
+void main() {}
diff --git a/pkg/front_end/testcases/const_functions/const_functions_list_error.dart.weak.expect b/pkg/front_end/testcases/const_functions/const_functions_list_error.dart.weak.expect
new file mode 100644
index 0000000..fea30ee
--- /dev/null
+++ b/pkg/front_end/testcases/const_functions/const_functions_list_error.dart.weak.expect
@@ -0,0 +1,79 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/const_functions/const_functions_list_error.dart:36:12: Error: The getter 'invalidProperty' isn't defined for the class 'List<int>'.
+//  - 'List' is from 'dart:core'.
+// Try correcting the name to the name of an existing getter, or defining a getter or field named 'invalidProperty'.
+//   return x.invalidProperty;
+//            ^^^^^^^^^^^^^^^
+//
+// pkg/front_end/testcases/const_functions/const_functions_list_error.dart:9:24: Error: Constant evaluation error:
+// const firstException = firstExceptionFn();
+//                        ^
+// pkg/front_end/testcases/const_functions/const_functions_list_error.dart:12:12: Context: Bad state: 'No element'
+//   return x.first;
+//            ^
+//
+// pkg/front_end/testcases/const_functions/const_functions_list_error.dart:15:23: Error: Constant evaluation error:
+// const lastException = lastExceptionFn();
+//                       ^
+// pkg/front_end/testcases/const_functions/const_functions_list_error.dart:18:12: Context: Bad state: 'No element'
+//   return x.last;
+//            ^
+//
+// pkg/front_end/testcases/const_functions/const_functions_list_error.dart:21:25: Error: Constant evaluation error:
+// const singleException = singleExceptionFn();
+//                         ^
+// pkg/front_end/testcases/const_functions/const_functions_list_error.dart:24:12: Context: Bad state: 'No element'
+//   return x.single;
+//            ^
+//
+// pkg/front_end/testcases/const_functions/const_functions_list_error.dart:27:30: Error: Constant evaluation error:
+// const singleExceptionMulti = singleExceptionMultiFn();
+//                              ^
+// pkg/front_end/testcases/const_functions/const_functions_list_error.dart:30:12: Context: Bad state: 'Too many elements'
+//   return x.single;
+//            ^
+//
+import self as self;
+import "dart:core" as core;
+
+import "package:expect/expect.dart";
+
+static const field core::int firstException = invalid-expression "Bad state: 'No element'";
+static const field core::int lastException = invalid-expression "Bad state: 'No element'";
+static const field core::int singleException = invalid-expression "Bad state: 'No element'";
+static const field core::int singleExceptionMulti = invalid-expression "Bad state: 'Too many elements'";
+static const field core::int invalidProperty = invalid-expression "pkg/front_end/testcases/const_functions/const_functions_list_error.dart:36:12: Error: The getter 'invalidProperty' isn't defined for the class 'List<int>'.
+ - 'List' is from 'dart:core'.
+Try correcting the name to the name of an existing getter, or defining a getter or field named 'invalidProperty'.
+  return x.invalidProperty;
+           ^^^^^^^^^^^^^^^";
+static method firstExceptionFn() → core::int {
+  return (#C1).{core::Iterable::first};
+}
+static method lastExceptionFn() → core::int {
+  return (#C1).{core::Iterable::last};
+}
+static method singleExceptionFn() → core::int {
+  return (#C1).{core::Iterable::single};
+}
+static method singleExceptionMultiFn() → core::int {
+  return (#C4).{core::Iterable::single};
+}
+static method invalidPropertyFn() → core::int {
+  return invalid-expression "pkg/front_end/testcases/const_functions/const_functions_list_error.dart:36:12: Error: The getter 'invalidProperty' isn't defined for the class 'List<int>'.
+ - 'List' is from 'dart:core'.
+Try correcting the name to the name of an existing getter, or defining a getter or field named 'invalidProperty'.
+  return x.invalidProperty;
+           ^^^^^^^^^^^^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} core::int;
+}
+static method main() → void {}
+
+constants  {
+  #C1 = <core::int*>[]
+  #C2 = 1
+  #C3 = 2
+  #C4 = <core::int*>[#C2, #C3]
+}
diff --git a/pkg/front_end/testcases/const_functions/const_functions_list_error.dart.weak.outline.expect b/pkg/front_end/testcases/const_functions/const_functions_list_error.dart.weak.outline.expect
new file mode 100644
index 0000000..49a82fb
--- /dev/null
+++ b/pkg/front_end/testcases/const_functions/const_functions_list_error.dart.weak.outline.expect
@@ -0,0 +1,23 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+import "package:expect/expect.dart";
+
+static const field core::int firstException = self::firstExceptionFn();
+static const field core::int lastException = self::lastExceptionFn();
+static const field core::int singleException = self::singleExceptionFn();
+static const field core::int singleExceptionMulti = self::singleExceptionMultiFn();
+static const field core::int invalidProperty = self::invalidPropertyFn();
+static method firstExceptionFn() → core::int
+  ;
+static method lastExceptionFn() → core::int
+  ;
+static method singleExceptionFn() → core::int
+  ;
+static method singleExceptionMultiFn() → core::int
+  ;
+static method invalidPropertyFn() → core::int
+  ;
+static method main() → void
+  ;
diff --git a/pkg/front_end/testcases/const_functions/const_functions_list_error.dart.weak.transformed.expect b/pkg/front_end/testcases/const_functions/const_functions_list_error.dart.weak.transformed.expect
new file mode 100644
index 0000000..95805b6
--- /dev/null
+++ b/pkg/front_end/testcases/const_functions/const_functions_list_error.dart.weak.transformed.expect
@@ -0,0 +1,79 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/const_functions/const_functions_list_error.dart:36:12: Error: The getter 'invalidProperty' isn't defined for the class 'List<int>'.
+//  - 'List' is from 'dart:core'.
+// Try correcting the name to the name of an existing getter, or defining a getter or field named 'invalidProperty'.
+//   return x.invalidProperty;
+//            ^^^^^^^^^^^^^^^
+//
+// pkg/front_end/testcases/const_functions/const_functions_list_error.dart:9:24: Error: Constant evaluation error:
+// const firstException = firstExceptionFn();
+//                        ^
+// pkg/front_end/testcases/const_functions/const_functions_list_error.dart:12:12: Context: Bad state: 'No element'
+//   return x.first;
+//            ^
+//
+// pkg/front_end/testcases/const_functions/const_functions_list_error.dart:15:23: Error: Constant evaluation error:
+// const lastException = lastExceptionFn();
+//                       ^
+// pkg/front_end/testcases/const_functions/const_functions_list_error.dart:18:12: Context: Bad state: 'No element'
+//   return x.last;
+//            ^
+//
+// pkg/front_end/testcases/const_functions/const_functions_list_error.dart:21:25: Error: Constant evaluation error:
+// const singleException = singleExceptionFn();
+//                         ^
+// pkg/front_end/testcases/const_functions/const_functions_list_error.dart:24:12: Context: Bad state: 'No element'
+//   return x.single;
+//            ^
+//
+// pkg/front_end/testcases/const_functions/const_functions_list_error.dart:27:30: Error: Constant evaluation error:
+// const singleExceptionMulti = singleExceptionMultiFn();
+//                              ^
+// pkg/front_end/testcases/const_functions/const_functions_list_error.dart:30:12: Context: Bad state: 'Too many elements'
+//   return x.single;
+//            ^
+//
+import self as self;
+import "dart:core" as core;
+
+import "package:expect/expect.dart";
+
+static const field core::int firstException = invalid-expression "Bad state: 'No element'";
+static const field core::int lastException = invalid-expression "Bad state: 'No element'";
+static const field core::int singleException = invalid-expression "Bad state: 'No element'";
+static const field core::int singleExceptionMulti = invalid-expression "Bad state: 'Too many elements'";
+static const field core::int invalidProperty = invalid-expression "pkg/front_end/testcases/const_functions/const_functions_list_error.dart:36:12: Error: The getter 'invalidProperty' isn't defined for the class 'List<int>'.
+ - 'List' is from 'dart:core'.
+Try correcting the name to the name of an existing getter, or defining a getter or field named 'invalidProperty'.
+  return x.invalidProperty;
+           ^^^^^^^^^^^^^^^";
+static method firstExceptionFn() → core::int {
+  return (#C1).{core::Iterable::first};
+}
+static method lastExceptionFn() → core::int {
+  return (#C1).{core::Iterable::last};
+}
+static method singleExceptionFn() → core::int {
+  return (#C1).{core::Iterable::single};
+}
+static method singleExceptionMultiFn() → core::int {
+  return (#C4).{core::Iterable::single};
+}
+static method invalidPropertyFn() → core::int {
+  return invalid-expression "pkg/front_end/testcases/const_functions/const_functions_list_error.dart:36:12: Error: The getter 'invalidProperty' isn't defined for the class 'List<int>'.
+ - 'List' is from 'dart:core'.
+Try correcting the name to the name of an existing getter, or defining a getter or field named 'invalidProperty'.
+  return x.invalidProperty;
+           ^^^^^^^^^^^^^^^";
+}
+static method main() → void {}
+
+constants  {
+  #C1 = <core::int*>[]
+  #C2 = 1
+  #C3 = 2
+  #C4 = <core::int*>[#C2, #C3]
+}
diff --git a/runtime/observatory/lib/src/elements/class_instances.dart b/runtime/observatory/lib/src/elements/class_instances.dart
index abf90cc..8d12e21 100644
--- a/runtime/observatory/lib/src/elements/class_instances.dart
+++ b/runtime/observatory/lib/src/elements/class_instances.dart
@@ -6,6 +6,7 @@
 import 'dart:async';
 import 'package:observatory/models.dart' as M;
 import 'package:observatory/src/elements/class_ref.dart';
+import 'package:observatory/src/elements/helpers/any_ref.dart';
 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart';
 import 'package:observatory/src/elements/helpers/custom_element.dart';
 import 'package:observatory/src/elements/inbound_references.dart';
@@ -25,6 +26,12 @@
   late M.ReachableSizeRepository _reachableSizes;
   late M.StronglyReachableInstancesRepository _stronglyReachableInstances;
   late M.ObjectRepository _objects;
+  M.Guarded<M.InstanceRef>? _allInstances = null;
+  bool _loadingAllInstances = false;
+  M.Guarded<M.InstanceRef>? _allSubclassInstances = null;
+  bool _loadingAllSubclassInstances = false;
+  M.Guarded<M.InstanceRef>? _allImplementorInstances = null;
+  bool _loadingAllImplementorInstances = false;
   M.Guarded<M.Instance>? _retainedSize = null;
   bool _loadingRetainedBytes = false;
   M.Guarded<M.Instance>? _reachableSize = null;
@@ -108,6 +115,41 @@
             ],
           new DivElement()
             ..classes = ['memberItem']
+            ..children = <Element>[
+              new DivElement()
+                ..classes = ['memberName']
+                ..text = 'all direct instances'
+                ..title = 'All instances whose class is exactly this class',
+              new DivElement()
+                ..classes = ['memberValue']
+                ..children = _createAllInstances()
+            ],
+          new DivElement()
+            ..classes = ['memberItem']
+            ..children = <Element>[
+              new DivElement()
+                ..classes = ['memberName']
+                ..text = 'all instances of subclasses'
+                ..title =
+                    'All instances whose class is a subclass of this class',
+              new DivElement()
+                ..classes = ['memberValue']
+                ..children = _createAllSubclassInstances()
+            ],
+          new DivElement()
+            ..classes = ['memberItem']
+            ..children = <Element>[
+              new DivElement()
+                ..classes = ['memberName']
+                ..text = 'all instances of implementors'
+                ..title =
+                    'All instances whose class implements the implicit interface of this class',
+              new DivElement()
+                ..classes = ['memberValue']
+                ..children = _createAllImplementorInstances()
+            ],
+          new DivElement()
+            ..classes = ['memberItem']
             ..title = 'Space reachable from this object, '
                 'excluding class references'
             ..children = <Element>[
@@ -134,6 +176,96 @@
     ];
   }
 
+  List<Element> _createAllInstances() {
+    final content = <Element>[];
+    if (_allInstances != null) {
+      if (_allInstances!.isSentinel) {
+        content.add(new SentinelValueElement(_allInstances!.asSentinel!,
+                queue: _r.queue)
+            .element);
+      } else {
+        content.add(anyRef(_isolate, _allInstances!.asValue!, _objects));
+      }
+    } else {
+      content.add(new SpanElement()..text = '...');
+    }
+    final button = new ButtonElement()
+      ..classes = ['reachable_size']
+      ..disabled = _loadingAllInstances
+      ..text = '↺';
+    button.onClick.listen((_) async {
+      button.disabled = true;
+      _loadingAllInstances = true;
+      _allInstances =
+          await _stronglyReachableInstances.getAsArray(_isolate, _cls);
+      _loadingAllInstances = false;
+      _r.dirty();
+    });
+    content.add(button);
+    return content;
+  }
+
+  List<Element> _createAllSubclassInstances() {
+    final content = <Element>[];
+    if (_allSubclassInstances != null) {
+      if (_allSubclassInstances!.isSentinel) {
+        content.add(new SentinelValueElement(_allSubclassInstances!.asSentinel!,
+                queue: _r.queue)
+            .element);
+      } else {
+        content
+            .add(anyRef(_isolate, _allSubclassInstances!.asValue!, _objects));
+      }
+    } else {
+      content.add(new SpanElement()..text = '...');
+    }
+    final button = new ButtonElement()
+      ..classes = ['reachable_size']
+      ..disabled = _loadingAllSubclassInstances
+      ..text = '↺';
+    button.onClick.listen((_) async {
+      button.disabled = true;
+      _loadingAllSubclassInstances = true;
+      _allSubclassInstances = await _stronglyReachableInstances
+          .getAsArray(_isolate, _cls, includeSubclasses: true);
+      _loadingAllSubclassInstances = false;
+      _r.dirty();
+    });
+    content.add(button);
+    return content;
+  }
+
+  List<Element> _createAllImplementorInstances() {
+    final content = <Element>[];
+    if (_allImplementorInstances != null) {
+      if (_allImplementorInstances!.isSentinel) {
+        content.add(new SentinelValueElement(
+                _allImplementorInstances!.asSentinel!,
+                queue: _r.queue)
+            .element);
+      } else {
+        content.add(
+            anyRef(_isolate, _allImplementorInstances!.asValue!, _objects));
+      }
+    } else {
+      content.add(new SpanElement()..text = '...');
+    }
+    final button = new ButtonElement()
+      ..classes = ['reachable_size']
+      ..disabled = _loadingAllImplementorInstances
+      ..text = '↺';
+    button.onClick.listen((_) async {
+      button.disabled = true;
+      _loadingAllImplementorInstances = true;
+      _allImplementorInstances = await _stronglyReachableInstances
+          .getAsArray(_isolate, _cls, includeImplementors: true);
+      _loadingAllImplementorInstances = false;
+      _r.dirty();
+    });
+    content.add(button);
+    return content;
+  }
+
   List<Element> _createReachableSizeValue() {
     final content = <Element>[];
     if (_reachableSize != null) {
@@ -157,6 +289,7 @@
       button.disabled = true;
       _loadingReachableBytes = true;
       _reachableSize = await _reachableSizes.get(_isolate, _cls.id!);
+      _loadingReachableBytes = false;
       _r.dirty();
     });
     content.add(button);
@@ -186,6 +319,7 @@
       button.disabled = true;
       _loadingRetainedBytes = true;
       _retainedSize = await _retainedSizes.get(_isolate, _cls.id!);
+      _loadingRetainedBytes = false;
       _r.dirty();
     });
     content.add(button);
diff --git a/runtime/observatory/lib/src/elements/vm_view.dart b/runtime/observatory/lib/src/elements/vm_view.dart
index 2b82602..4bcec55 100644
--- a/runtime/observatory/lib/src/elements/vm_view.dart
+++ b/runtime/observatory/lib/src/elements/vm_view.dart
@@ -174,14 +174,28 @@
               ..children = <Element>[
                 new DivElement()
                   ..classes = ['memberName']
-                  ..text = 'malloc memory',
+                  ..text = 'malloc used memory',
                 new DivElement()
                   ..classes = ['memberValue']
-                  ..text = _vm.heapAllocatedMemoryUsage != null
-                      ? Utils.formatSize(_vm.heapAllocatedMemoryUsage)
+                  ..text = _vm.mallocUsed != null
+                      ? Utils.formatSize(_vm.mallocUsed)
                       : 'unavailable'
-                  ..title = _vm.heapAllocatedMemoryUsage != null
-                      ? '${_vm.heapAllocatedMemoryUsage} bytes'
+                  ..title =
+                      _vm.mallocUsed != null ? '${_vm.mallocUsed} bytes' : null
+              ],
+            new DivElement()
+              ..classes = ['memberItem']
+              ..children = <Element>[
+                new DivElement()
+                  ..classes = ['memberName']
+                  ..text = 'malloc capacity memory',
+                new DivElement()
+                  ..classes = ['memberValue']
+                  ..text = _vm.mallocCapacity != null
+                      ? Utils.formatSize(_vm.mallocCapacity)
+                      : 'unavailable'
+                  ..title = _vm.mallocCapacity != null
+                      ? '${_vm.mallocCapacity} bytes'
                       : null
               ],
             new DivElement()
@@ -189,12 +203,10 @@
               ..children = <Element>[
                 new DivElement()
                   ..classes = ['memberName']
-                  ..text = 'malloc allocation count',
+                  ..text = 'malloc implementation',
                 new DivElement()
                   ..classes = ['memberValue']
-                  ..text = _vm.heapAllocationCount != null
-                      ? '${_vm.heapAllocationCount}'
-                      : 'unavailable'
+                  ..text = _vm.mallocImplementation
               ],
             new DivElement()
               ..classes = ['memberItem']
diff --git a/runtime/observatory/lib/src/models/objects/vm.dart b/runtime/observatory/lib/src/models/objects/vm.dart
index 10deac8..523f2a2 100644
--- a/runtime/observatory/lib/src/models/objects/vm.dart
+++ b/runtime/observatory/lib/src/models/objects/vm.dart
@@ -35,10 +35,9 @@
   int get pid;
 
   /// The current amount of native heap allocated memory within the VM.
-  int get heapAllocatedMemoryUsage;
-
-  /// The current number of allocations on the native heap within the VM.
-  int get heapAllocationCount;
+  int get mallocUsed;
+  int get mallocCapacity;
+  String get mallocImplementation;
 
   int get currentMemory;
   int get maxRSS;
diff --git a/runtime/observatory/lib/src/models/repositories/strongly_reachable_instances.dart b/runtime/observatory/lib/src/models/repositories/strongly_reachable_instances.dart
index c0449f8..195948a 100644
--- a/runtime/observatory/lib/src/models/repositories/strongly_reachable_instances.dart
+++ b/runtime/observatory/lib/src/models/repositories/strongly_reachable_instances.dart
@@ -6,4 +6,6 @@
 
 abstract class StronglyReachableInstancesRepository {
   Future<InstanceSet> get(IsolateRef isolate, ClassRef cls, {int limit: 100});
+  Future<Guarded<InstanceRef>> getAsArray(IsolateRef isolate, ClassRef cls,
+      {bool includeSubclasses: false, includeImplementors: false});
 }
diff --git a/runtime/observatory/lib/src/repositories/strongly_reachable_instances.dart b/runtime/observatory/lib/src/repositories/strongly_reachable_instances.dart
index a015928..f4ed736 100644
--- a/runtime/observatory/lib/src/repositories/strongly_reachable_instances.dart
+++ b/runtime/observatory/lib/src/repositories/strongly_reachable_instances.dart
@@ -15,4 +15,18 @@
     assert(limit != null);
     return (await isolate.getInstances(cls, limit)) as S.InstanceSet;
   }
+
+  Future<M.Guarded<M.InstanceRef>> getAsArray(M.IsolateRef i, M.ClassRef c,
+      {bool includeSubclasses: false, includeImplementors: false}) async {
+    S.Isolate isolate = i as S.Isolate;
+    S.Class cls = c as S.Class;
+    assert(isolate != null);
+    assert(cls != null);
+    final response = await isolate.invokeRpc('_getInstancesAsArray', {
+      'objectId': cls.id,
+      'includeSubclasses': includeSubclasses,
+      'includeImplementors': includeImplementors
+    });
+    return new S.Guarded<S.Instance>(response);
+  }
 }
diff --git a/runtime/observatory/lib/src/service/object.dart b/runtime/observatory/lib/src/service/object.dart
index e32c00f..4db752a 100644
--- a/runtime/observatory/lib/src/service/object.dart
+++ b/runtime/observatory/lib/src/service/object.dart
@@ -680,8 +680,9 @@
   bool typeChecksEnabled = false;
   int nativeZoneMemoryUsage = 0;
   int pid = 0;
-  int heapAllocatedMemoryUsage = 0;
-  int heapAllocationCount = 0;
+  int mallocUsed = 0;
+  int mallocCapacity = 0;
+  String mallocImplementation = 'unknown';
   int currentMemory = 0;
   int maxRSS = 0;
   int currentRSS = 0;
@@ -1041,8 +1042,9 @@
       nativeZoneMemoryUsage = map['_nativeZoneMemoryUsage'];
     }
     pid = map['pid'];
-    heapAllocatedMemoryUsage = map['_heapAllocatedMemoryUsage'];
-    heapAllocationCount = map['_heapAllocationCount'];
+    mallocUsed = map['_mallocUsed'];
+    mallocCapacity = map['_mallocCapacity'];
+    mallocImplementation = map['_mallocImplementation'];
     embedder = map['_embedder'];
     currentMemory = map['_currentMemory'];
     maxRSS = map['_maxRSS'];
diff --git a/runtime/observatory/tests/service/get_instances_as_array_rpc_test.dart b/runtime/observatory/tests/service/get_instances_as_array_rpc_test.dart
new file mode 100644
index 0000000..1981ec9c
--- /dev/null
+++ b/runtime/observatory/tests/service/get_instances_as_array_rpc_test.dart
@@ -0,0 +1,75 @@
+// Copyright (c) 2020, 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:observatory/service_io.dart";
+import "package:test/test.dart";
+
+import "test_helper.dart";
+
+@pragma("vm:entry-point")
+class Class {}
+
+@pragma("vm:entry-point")
+class Subclass extends Class {}
+
+@pragma("vm:entry-point")
+class Implementor implements Class {}
+
+@pragma("vm:entry-point")
+var aClass;
+@pragma("vm:entry-point")
+var aSubclass;
+@pragma("vm:entry-point")
+var anImplementor;
+
+@pragma("vm:entry-point")
+allocate() {
+  aClass = new Class();
+  aSubclass = new Subclass();
+  anImplementor = new Implementor();
+}
+
+var tests = <IsolateTest>[
+  (Isolate isolate) async {
+    invoke(String selector) async {
+      Map params = {
+        "targetId": isolate.rootLibrary.id,
+        "selector": selector,
+        "argumentIds": <String>[],
+      };
+      return await isolate.invokeRpcNoUpgrade("invoke", params);
+    }
+
+    Future<int> instanceCount(String className,
+        {bool includeSubclasses: false,
+        bool includeImplementors: false}) async {
+      Map params = {
+        "objectId": isolate.rootLibrary.classes
+            .singleWhere((cls) => cls.name == className)
+            .id,
+        "includeSubclasses": includeSubclasses,
+        "includeImplementors": includeImplementors,
+      };
+      var result =
+          await isolate.invokeRpcNoUpgrade("_getInstancesAsArray", params);
+      expect(result["type"], equals("@Instance"));
+      expect(result["kind"], equals("List"));
+      return result["length"] as int;
+    }
+
+    await isolate.rootLibrary.load();
+
+    expect(await instanceCount("Class"), equals(0));
+    expect(await instanceCount("Class", includeSubclasses: true), equals(0));
+    expect(await instanceCount("Class", includeImplementors: true), equals(0));
+
+    await invoke("allocate");
+
+    expect(await instanceCount("Class"), equals(1));
+    expect(await instanceCount("Class", includeSubclasses: true), equals(2));
+    expect(await instanceCount("Class", includeImplementors: true), equals(3));
+  },
+];
+
+main(args) async => runIsolateTests(args, tests);
diff --git a/runtime/observatory_2/lib/src/elements/class_instances.dart b/runtime/observatory_2/lib/src/elements/class_instances.dart
index bc3e101..7197780 100644
--- a/runtime/observatory_2/lib/src/elements/class_instances.dart
+++ b/runtime/observatory_2/lib/src/elements/class_instances.dart
@@ -6,6 +6,7 @@
 import 'dart:async';
 import 'package:observatory_2/models.dart' as M;
 import 'package:observatory_2/src/elements/class_ref.dart';
+import 'package:observatory_2/src/elements/helpers/any_ref.dart';
 import 'package:observatory_2/src/elements/helpers/rendering_scheduler.dart';
 import 'package:observatory_2/src/elements/helpers/custom_element.dart';
 import 'package:observatory_2/src/elements/inbound_references.dart';
@@ -25,6 +26,12 @@
   M.ReachableSizeRepository _reachableSizes;
   M.StronglyReachableInstancesRepository _stronglyReachableInstances;
   M.ObjectRepository _objects;
+  M.Guarded<M.InstanceRef> _allInstances = null;
+  bool _loadingAllInstances = false;
+  M.Guarded<M.InstanceRef> _allSubclassInstances = null;
+  bool _loadingAllSubclassInstances = false;
+  M.Guarded<M.InstanceRef> _allImplementorInstances = null;
+  bool _loadingAllImplementorInstances = false;
   M.Guarded<M.Instance> _retainedSize = null;
   bool _loadingRetainedBytes = false;
   M.Guarded<M.Instance> _reachableSize = null;
@@ -108,6 +115,41 @@
             ],
           new DivElement()
             ..classes = ['memberItem']
+            ..children = <Element>[
+              new DivElement()
+                ..classes = ['memberName']
+                ..text = 'all direct instances'
+                ..title = 'All instances whose class is exactly this class',
+              new DivElement()
+                ..classes = ['memberValue']
+                ..children = _createAllInstances()
+            ],
+          new DivElement()
+            ..classes = ['memberItem']
+            ..children = <Element>[
+              new DivElement()
+                ..classes = ['memberName']
+                ..text = 'all instances of subclasses'
+                ..title =
+                    'All instances whose class is a subclass of this class',
+              new DivElement()
+                ..classes = ['memberValue']
+                ..children = _createAllSubclassInstances()
+            ],
+          new DivElement()
+            ..classes = ['memberItem']
+            ..children = <Element>[
+              new DivElement()
+                ..classes = ['memberName']
+                ..text = 'all instances of implementors'
+                ..title =
+                    'All instances whose class implements the implicit interface of this class',
+              new DivElement()
+                ..classes = ['memberValue']
+                ..children = _createAllImplementorInstances()
+            ],
+          new DivElement()
+            ..classes = ['memberItem']
             ..title = 'Space reachable from this object, '
                 'excluding class references'
             ..children = <Element>[
@@ -134,6 +176,95 @@
     ];
   }
 
+  List<Element> _createAllInstances() {
+    final content = <Element>[];
+    if (_allInstances != null) {
+      if (_allInstances.isSentinel) {
+        content.add(
+            new SentinelValueElement(_allInstances.asSentinel, queue: _r.queue)
+                .element);
+      } else {
+        content.add(anyRef(_isolate, _allInstances.asValue, _objects));
+      }
+    } else {
+      content.add(new SpanElement()..text = '...');
+    }
+    final button = new ButtonElement()
+      ..classes = ['reachable_size']
+      ..disabled = _loadingAllInstances
+      ..text = '↺';
+    button.onClick.listen((_) async {
+      button.disabled = true;
+      _loadingAllInstances = true;
+      _allInstances =
+          await _stronglyReachableInstances.getAsArray(_isolate, _cls);
+      _loadingAllInstances = false;
+      _r.dirty();
+    });
+    content.add(button);
+    return content;
+  }
+
+  List<Element> _createAllSubclassInstances() {
+    final content = <Element>[];
+    if (_allSubclassInstances != null) {
+      if (_allSubclassInstances.isSentinel) {
+        content.add(new SentinelValueElement(_allSubclassInstances.asSentinel,
+                queue: _r.queue)
+            .element);
+      } else {
+        content.add(anyRef(_isolate, _allSubclassInstances.asValue, _objects));
+      }
+    } else {
+      content.add(new SpanElement()..text = '...');
+    }
+    final button = new ButtonElement()
+      ..classes = ['reachable_size']
+      ..disabled = _loadingAllSubclassInstances
+      ..text = '↺';
+    button.onClick.listen((_) async {
+      button.disabled = true;
+      _loadingAllSubclassInstances = true;
+      _allSubclassInstances = await _stronglyReachableInstances
+          .getAsArray(_isolate, _cls, includeSubclasses: true);
+      _loadingAllSubclassInstances = false;
+      _r.dirty();
+    });
+    content.add(button);
+    return content;
+  }
+
+  List<Element> _createAllImplementorInstances() {
+    final content = <Element>[];
+    if (_allImplementorInstances != null) {
+      if (_allImplementorInstances.isSentinel) {
+        content.add(new SentinelValueElement(
+                _allImplementorInstances.asSentinel,
+                queue: _r.queue)
+            .element);
+      } else {
+        content
+            .add(anyRef(_isolate, _allImplementorInstances.asValue, _objects));
+      }
+    } else {
+      content.add(new SpanElement()..text = '...');
+    }
+    final button = new ButtonElement()
+      ..classes = ['reachable_size']
+      ..disabled = _loadingAllImplementorInstances
+      ..text = '↺';
+    button.onClick.listen((_) async {
+      button.disabled = true;
+      _loadingAllImplementorInstances = true;
+      _allImplementorInstances = await _stronglyReachableInstances
+          .getAsArray(_isolate, _cls, includeImplementors: true);
+      _loadingAllImplementorInstances = false;
+      _r.dirty();
+    });
+    content.add(button);
+    return content;
+  }
+
   List<Element> _createReachableSizeValue() {
     final content = <Element>[];
     if (_reachableSize != null) {
diff --git a/runtime/observatory_2/lib/src/elements/vm_view.dart b/runtime/observatory_2/lib/src/elements/vm_view.dart
index 014cd50..b7b6d65 100644
--- a/runtime/observatory_2/lib/src/elements/vm_view.dart
+++ b/runtime/observatory_2/lib/src/elements/vm_view.dart
@@ -174,14 +174,28 @@
               ..children = <Element>[
                 new DivElement()
                   ..classes = ['memberName']
-                  ..text = 'malloc memory',
+                  ..text = 'malloc used memory',
                 new DivElement()
                   ..classes = ['memberValue']
-                  ..text = _vm.heapAllocatedMemoryUsage != null
-                      ? Utils.formatSize(_vm.heapAllocatedMemoryUsage)
+                  ..text = _vm.mallocUsed != null
+                      ? Utils.formatSize(_vm.mallocUsed)
                       : 'unavailable'
-                  ..title = _vm.heapAllocatedMemoryUsage != null
-                      ? '${_vm.heapAllocatedMemoryUsage} bytes'
+                  ..title =
+                      _vm.mallocUsed != null ? '${_vm.mallocUsed} bytes' : null
+              ],
+            new DivElement()
+              ..classes = ['memberItem']
+              ..children = <Element>[
+                new DivElement()
+                  ..classes = ['memberName']
+                  ..text = 'malloc capacity memory',
+                new DivElement()
+                  ..classes = ['memberValue']
+                  ..text = _vm.mallocCapacity != null
+                      ? Utils.formatSize(_vm.mallocCapacity)
+                      : 'unavailable'
+                  ..title = _vm.mallocCapacity != null
+                      ? '${_vm.mallocCapacity} bytes'
                       : null
               ],
             new DivElement()
@@ -189,12 +203,10 @@
               ..children = <Element>[
                 new DivElement()
                   ..classes = ['memberName']
-                  ..text = 'malloc allocation count',
+                  ..text = 'malloc implementation',
                 new DivElement()
                   ..classes = ['memberValue']
-                  ..text = _vm.heapAllocationCount != null
-                      ? '${_vm.heapAllocationCount}'
-                      : 'unavailable'
+                  ..text = _vm.mallocImplementation
               ],
             new DivElement()
               ..classes = ['memberItem']
diff --git a/runtime/observatory_2/lib/src/models/objects/vm.dart b/runtime/observatory_2/lib/src/models/objects/vm.dart
index b69d744..2cfdd75 100644
--- a/runtime/observatory_2/lib/src/models/objects/vm.dart
+++ b/runtime/observatory_2/lib/src/models/objects/vm.dart
@@ -35,10 +35,9 @@
   int get pid;
 
   /// The current amount of native heap allocated memory within the VM.
-  int get heapAllocatedMemoryUsage;
-
-  /// The current number of allocations on the native heap within the VM.
-  int get heapAllocationCount;
+  int get mallocUsed;
+  int get mallocCapacity;
+  String get mallocImplementation;
 
   int get currentMemory;
   int get maxRSS;
diff --git a/runtime/observatory_2/lib/src/models/repositories/strongly_reachable_instances.dart b/runtime/observatory_2/lib/src/models/repositories/strongly_reachable_instances.dart
index c0449f8..195948a 100644
--- a/runtime/observatory_2/lib/src/models/repositories/strongly_reachable_instances.dart
+++ b/runtime/observatory_2/lib/src/models/repositories/strongly_reachable_instances.dart
@@ -6,4 +6,6 @@
 
 abstract class StronglyReachableInstancesRepository {
   Future<InstanceSet> get(IsolateRef isolate, ClassRef cls, {int limit: 100});
+  Future<Guarded<InstanceRef>> getAsArray(IsolateRef isolate, ClassRef cls,
+      {bool includeSubclasses: false, includeImplementors: false});
 }
diff --git a/runtime/observatory_2/lib/src/repositories/strongly_reachable_instances.dart b/runtime/observatory_2/lib/src/repositories/strongly_reachable_instances.dart
index a015928..8083ea7 100644
--- a/runtime/observatory_2/lib/src/repositories/strongly_reachable_instances.dart
+++ b/runtime/observatory_2/lib/src/repositories/strongly_reachable_instances.dart
@@ -15,4 +15,18 @@
     assert(limit != null);
     return (await isolate.getInstances(cls, limit)) as S.InstanceSet;
   }
+
+  Future<M.Guarded<M.InstanceRef>> getAsArray(M.IsolateRef i, M.ClassRef c,
+      {bool includeSubclasses: false, includeImplementors: false}) async {
+    S.Isolate isolate = i as S.Isolate;
+    S.Class cls = c as S.Class;
+    assert(isolate != null);
+    assert(cls != null);
+    final response = await isolate.invokeRpc('_getInstancesAsArray', {
+      'objectId': cls.id,
+      'includeSubclasses': includeSubclasses == true,
+      'includeImplementors': includeImplementors == true,
+    });
+    return new S.Guarded<S.Instance>(response);
+  }
 }
diff --git a/runtime/observatory_2/lib/src/service/object.dart b/runtime/observatory_2/lib/src/service/object.dart
index 743ab24..e2acf8a 100644
--- a/runtime/observatory_2/lib/src/service/object.dart
+++ b/runtime/observatory_2/lib/src/service/object.dart
@@ -681,8 +681,9 @@
   bool typeChecksEnabled = false;
   int nativeZoneMemoryUsage = 0;
   int pid = 0;
-  int heapAllocatedMemoryUsage = 0;
-  int heapAllocationCount = 0;
+  int mallocUsed = 0;
+  int mallocCapacity = 0;
+  String mallocImplementation = 'unknown';
   int currentMemory;
   int maxRSS;
   int currentRSS;
@@ -1044,8 +1045,9 @@
       nativeZoneMemoryUsage = map['_nativeZoneMemoryUsage'];
     }
     pid = map['pid'];
-    heapAllocatedMemoryUsage = map['_heapAllocatedMemoryUsage'];
-    heapAllocationCount = map['_heapAllocationCount'];
+    mallocUsed = map['_mallocUsed'];
+    mallocCapacity = map['_mallocCapacity'];
+    mallocImplementation = map['_mallocImplementation'];
     embedder = map['_embedder'];
     currentMemory = map['_currentMemory'];
     maxRSS = map['_maxRSS'];
diff --git a/runtime/observatory_2/tests/service_2/get_instances_as_array_rpc_test.dart b/runtime/observatory_2/tests/service_2/get_instances_as_array_rpc_test.dart
new file mode 100644
index 0000000..f87d897
--- /dev/null
+++ b/runtime/observatory_2/tests/service_2/get_instances_as_array_rpc_test.dart
@@ -0,0 +1,72 @@
+// Copyright (c) 2020, 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:observatory_2/service_io.dart";
+import "package:test/test.dart";
+
+import "test_helper.dart";
+
+class Class {}
+
+class Subclass extends Class {}
+
+class Implementor implements Class {}
+
+@pragma("vm:entry-point")
+var aClass;
+@pragma("vm:entry-point")
+var aSubclass;
+@pragma("vm:entry-point")
+var anImplementor;
+
+@pragma("vm:entry-point")
+allocate() {
+  aClass = new Class();
+  aSubclass = new Subclass();
+  anImplementor = new Implementor();
+}
+
+var tests = <IsolateTest>[
+  (Isolate isolate) async {
+    invoke(String selector) async {
+      Map params = {
+        "targetId": isolate.rootLibrary.id,
+        "selector": selector,
+        "argumentIds": <String>[],
+      };
+      return await isolate.invokeRpcNoUpgrade("invoke", params);
+    }
+
+    Future<int> instanceCount(String className,
+        {bool includeSubclasses: false,
+        bool includeImplementors: false}) async {
+      Map params = {
+        "objectId": isolate.rootLibrary.classes
+            .singleWhere((cls) => cls.name == className)
+            .id,
+        "includeSubclasses": includeSubclasses,
+        "includeImplementors": includeImplementors,
+      };
+      var result =
+          await isolate.invokeRpcNoUpgrade("_getInstancesAsArray", params);
+      expect(result["type"], equals("@Instance"));
+      expect(result["kind"], equals("List"));
+      return result["length"] as int;
+    }
+
+    await isolate.rootLibrary.load();
+
+    expect(await instanceCount("Class"), equals(0));
+    expect(await instanceCount("Class", includeSubclasses: true), equals(0));
+    expect(await instanceCount("Class", includeImplementors: true), equals(0));
+
+    await invoke("allocate");
+
+    expect(await instanceCount("Class"), equals(1));
+    expect(await instanceCount("Class", includeSubclasses: true), equals(2));
+    expect(await instanceCount("Class", includeImplementors: true), equals(3));
+  },
+];
+
+main(args) async => runIsolateTests(args, tests);
diff --git a/runtime/vm/class_table.h b/runtime/vm/class_table.h
index 9d5ad54..5ef0df1 100644
--- a/runtime/vm/class_table.h
+++ b/runtime/vm/class_table.h
@@ -125,6 +125,20 @@
     trace_allocation_table_.load()[cid] = trace ? 1 : 0;
   }
   bool TraceAllocationFor(intptr_t cid);
+  void SetCollectInstancesFor(intptr_t cid, bool trace) {
+    ASSERT(cid > 0);
+    ASSERT(cid < top_);
+    if (trace) {
+      trace_allocation_table_.load()[cid] |= 2;
+    } else {
+      trace_allocation_table_.load()[cid] &= ~2;
+    }
+  }
+  bool CollectInstancesFor(intptr_t cid) {
+    ASSERT(cid > 0);
+    ASSERT(cid < top_);
+    return (trace_allocation_table_.load()[cid] & 2) != 0;
+  }
 #endif  // !defined(PRODUCT)
 
   void CopyBeforeHotReload(intptr_t** copy, intptr_t* copy_num_cids) {
diff --git a/runtime/vm/compiler/aot/precompiler.cc b/runtime/vm/compiler/aot/precompiler.cc
index e638bf2..0ad8406 100644
--- a/runtime/vm/compiler/aot/precompiler.cc
+++ b/runtime/vm/compiler/aot/precompiler.cc
@@ -2407,10 +2407,6 @@
     while (it.HasNext()) {
       cls = it.GetNextClass();
 
-      // The subclasses/implementors array is only needed for CHA.
-      cls.ClearDirectSubclasses();
-      cls.ClearDirectImplementors();
-
       bool retain = false;
       members = cls.fields();
       if (members.Length() > 0) {
@@ -2563,6 +2559,12 @@
 void Precompiler::DropClasses() {
   Class& cls = Class::Handle(Z);
   Array& constants = Array::Handle(Z);
+  GrowableObjectArray& implementors = GrowableObjectArray::Handle(Z);
+  GrowableObjectArray& retained_implementors = GrowableObjectArray::Handle(Z);
+  Class& implementor = Class::Handle(Z);
+  GrowableObjectArray& subclasses = GrowableObjectArray::Handle(Z);
+  GrowableObjectArray& retained_subclasses = GrowableObjectArray::Handle(Z);
+  Class& subclass = Class::Handle(Z);
 
   // We are about to remove classes from the class table. For this to be safe,
   // there must be no instances of these classes on the heap, not even
@@ -2572,6 +2574,7 @@
   IG->heap()->CollectAllGarbage();
   IG->heap()->WaitForSweeperTasks(T);
 
+  SafepointWriteRwLocker ml(T, IG->program_lock());
   ClassTable* class_table = IG->class_table();
   intptr_t num_cids = class_table->NumCids();
 
@@ -2590,6 +2593,30 @@
     cls = class_table->At(cid);
     ASSERT(!cls.IsNull());
 
+    implementors = cls.direct_implementors();
+    if (!implementors.IsNull()) {
+      retained_implementors = GrowableObjectArray::New();
+      for (intptr_t i = 0; i < implementors.Length(); i++) {
+        implementor ^= implementors.At(i);
+        if (classes_to_retain_.HasKey(&implementor)) {
+          retained_implementors.Add(implementor);
+        }
+      }
+      cls.set_direct_implementors(retained_implementors);
+    }
+
+    subclasses = cls.direct_subclasses();
+    if (!subclasses.IsNull()) {
+      retained_subclasses = GrowableObjectArray::New();
+      for (intptr_t i = 0; i < subclasses.Length(); i++) {
+        subclass ^= subclasses.At(i);
+        if (classes_to_retain_.HasKey(&subclass)) {
+          retained_subclasses.Add(subclass);
+        }
+      }
+      cls.set_direct_subclasses(retained_subclasses);
+    }
+
     if (cls.IsTopLevel()) {
       // Top-level classes are referenced directly from their library. They
       // will only be removed as a consequence of an entire library being
diff --git a/runtime/vm/compiler/backend/constant_propagator.cc b/runtime/vm/compiler/backend/constant_propagator.cc
index 1ba1c36..868e0e2 100644
--- a/runtime/vm/compiler/backend/constant_propagator.cc
+++ b/runtime/vm/compiler/backend/constant_propagator.cc
@@ -1190,13 +1190,11 @@
 }
 
 void ConstantPropagator::VisitBoxInt64(BoxInt64Instr* instr) {
-  // TODO(kmillikin): Handle box operation.
-  SetValue(instr, non_constant_);
+  VisitBox(instr);
 }
 
 void ConstantPropagator::VisitUnboxInt64(UnboxInt64Instr* instr) {
-  // TODO(kmillikin): Handle unbox operation.
-  SetValue(instr, non_constant_);
+  VisitUnbox(instr);
 }
 
 void ConstantPropagator::VisitUnaryIntegerOp(UnaryIntegerOpInstr* unary_op) {
@@ -1408,38 +1406,46 @@
 }
 
 void ConstantPropagator::VisitUnbox(UnboxInstr* instr) {
-  // TODO(kmillikin): Handle conversion.
-  SetValue(instr, non_constant_);
+  const Object& value = instr->value()->definition()->constant_value();
+  if (IsUnknown(value)) {
+    return;
+  }
+
+  SetValue(instr, value);
 }
 
 void ConstantPropagator::VisitBox(BoxInstr* instr) {
-  // TODO(kmillikin): Handle conversion.
-  SetValue(instr, non_constant_);
+  const Object& value = instr->value()->definition()->constant_value();
+  if (IsUnknown(value)) {
+    return;
+  }
+
+  if (instr->value()->definition()->representation() ==
+      instr->from_representation()) {
+    SetValue(instr, value);
+  } else {
+    SetValue(instr, non_constant_);
+  }
 }
 
 void ConstantPropagator::VisitBoxUint8(BoxUint8Instr* instr) {
-  // TODO(kmillikin): Handle box operation.
-  SetValue(instr, non_constant_);
+  VisitBox(instr);
 }
 
 void ConstantPropagator::VisitBoxUint32(BoxUint32Instr* instr) {
-  // TODO(kmillikin): Handle box operation.
-  SetValue(instr, non_constant_);
+  VisitBox(instr);
 }
 
 void ConstantPropagator::VisitUnboxUint32(UnboxUint32Instr* instr) {
-  // TODO(kmillikin): Handle unbox operation.
-  SetValue(instr, non_constant_);
+  VisitUnbox(instr);
 }
 
 void ConstantPropagator::VisitBoxInt32(BoxInt32Instr* instr) {
-  // TODO(kmillikin): Handle box operation.
-  SetValue(instr, non_constant_);
+  VisitBox(instr);
 }
 
 void ConstantPropagator::VisitUnboxInt32(UnboxInt32Instr* instr) {
-  // TODO(kmillikin): Handle unbox operation.
-  SetValue(instr, non_constant_);
+  VisitUnbox(instr);
 }
 
 void ConstantPropagator::VisitIntConverter(IntConverterInstr* instr) {
diff --git a/runtime/vm/compiler/backend/constant_propagator_test.cc b/runtime/vm/compiler/backend/constant_propagator_test.cc
index 5265ea0..de14881 100644
--- a/runtime/vm/compiler/backend/constant_propagator_test.cc
+++ b/runtime/vm/compiler/backend/constant_propagator_test.cc
@@ -5,6 +5,7 @@
 #include "vm/compiler/backend/constant_propagator.h"
 
 #include "vm/compiler/backend/block_builder.h"
+#include "vm/compiler/backend/il_printer.h"
 #include "vm/compiler/backend/il_test_helper.h"
 #include "vm/compiler/backend/type_propagator.h"
 #include "vm/unit_test.h"
@@ -80,7 +81,9 @@
   // To disable copying we mark graph to disable LICM.
   H.flow_graph()->disallow_licm();
 
+  FlowGraphPrinter::PrintGraph("Before ConstantPropagator", H.flow_graph());
   ConstantPropagator::Optimize(H.flow_graph());
+  FlowGraphPrinter::PrintGraph("After ConstantPropagator", H.flow_graph());
 
   auto& blocks = H.flow_graph()->reverse_postorder();
   EXPECT_EQ(2, blocks.length());
@@ -188,20 +191,27 @@
   }
 
   H.FinishGraph();
+  FlowGraphPrinter::PrintGraph("Before Optimization", H.flow_graph());
   FlowGraphTypePropagator::Propagate(H.flow_graph());
+  FlowGraphPrinter::PrintGraph("After Propagate", H.flow_graph());
   // Force phi unboxing independent of heuristics.
   v1->set_representation(op->representation());
   H.flow_graph()->SelectRepresentations();
+  FlowGraphPrinter::PrintGraph("After SelectRepresentations", H.flow_graph());
   H.flow_graph()->Canonicalize();
-  EXPECT_PROPERTY(ret->value()->definition(),
-                  it.IsBoxInteger() && it.RequiredInputRepresentation(0) ==
-                                           op->representation());
+  FlowGraphPrinter::PrintGraph("After Canonicalize", H.flow_graph());
+  if (!expected.should_fold) {
+    EXPECT_PROPERTY(ret->value()->definition(),
+                    it.IsBoxInteger() && it.RequiredInputRepresentation(0) ==
+                                             op->representation());
+  }
 
   ConstantPropagator::Optimize(H.flow_graph());
+  FlowGraphPrinter::PrintGraph("After ConstantPropagator", H.flow_graph());
 
   // If |should_fold| then check that resulting graph is
   //
-  //         Return(Box(Unbox(Constant(result))))
+  //         Return(Constant(result))
   //
   // otherwise check that the graph is
   //
@@ -209,21 +219,16 @@
   //
   {
     auto ret_val = ret->value()->definition();
-    EXPECT_PROPERTY(
-        ret_val, it.IsBoxInteger() &&
-                     it.RequiredInputRepresentation(0) == op->representation());
-    auto boxed_value = ret_val->AsBoxInteger()->value()->definition();
     if (expected.should_fold) {
-      EXPECT_PROPERTY(
-          boxed_value,
-          it.IsUnboxInteger() && it.representation() == op->representation());
-      auto unboxed_value = boxed_value->AsUnboxInteger()->value()->definition();
-      EXPECT_PROPERTY(unboxed_value,
-                      it.IsConstant() && it.AsConstant()->value().IsInteger());
-      EXPECT_EQ(
-          expected.result,
-          Integer::Cast(unboxed_value->AsConstant()->value()).AsInt64Value());
+      EXPECT_PROPERTY(ret_val,
+                      it.IsConstant() && it.representation() == kTagged);
+      EXPECT_EQ(expected.result,
+                Integer::Cast(ret_val->AsConstant()->value()).AsInt64Value());
     } else {
+      EXPECT_PROPERTY(ret_val,
+                      it.IsBoxInteger() && it.RequiredInputRepresentation(0) ==
+                                               op->representation());
+      auto boxed_value = ret_val->AsBoxInteger()->value()->definition();
       EXPECT_PROPERTY(boxed_value, &it == op);
     }
   }
diff --git a/runtime/vm/compiler/backend/flow_graph_checker.cc b/runtime/vm/compiler/backend/flow_graph_checker.cc
index 162fdd3..140ee55 100644
--- a/runtime/vm/compiler/backend/flow_graph_checker.cc
+++ b/runtime/vm/compiler/backend/flow_graph_checker.cc
@@ -19,6 +19,21 @@
             250,
             "Definition count threshold for extensive instruction checks");
 
+#define ASSERT1(cond, ctxt1)                                                   \
+  do {                                                                         \
+    if (!(cond))                                                               \
+      dart::Assert(__FILE__, __LINE__)                                         \
+          .Fail("expected: %s (%s=%s)", #cond, #ctxt1, (ctxt1)->ToCString());  \
+  } while (false)
+
+#define ASSERT2(cond, ctxt1, ctxt2)                                            \
+  do {                                                                         \
+    if (!(cond))                                                               \
+      dart::Assert(__FILE__, __LINE__)                                         \
+          .Fail("expected: %s (%s=%s, %s=%s)", #cond, #ctxt1,                  \
+                (ctxt1)->ToCString(), #ctxt2, (ctxt2)->ToCString());           \
+  } while (false)
+
 // Returns true for the "optimized out" and "null" constant.
 // Such constants reside outside the IR in the sense that
 // succ/pred/block links are not maintained.
@@ -121,15 +136,16 @@
     // Some calls (e.g. closure calls) have more inputs than actual arguments.
     // Those extra inputs will be consumed from the stack before the call.
     const intptr_t after_args_input_count = call->env()->LazyDeoptPruneCount();
-    ASSERT((arg_count + after_args_input_count) <= env_count);
+    ASSERT1((arg_count + after_args_input_count) <= env_count, call);
     const intptr_t env_base = env_count - arg_count - after_args_input_count;
     for (intptr_t i = 0; i < arg_count; i++) {
       if (call->HasPushArguments()) {
-        ASSERT(call->ArgumentAt(i) == env->ValueAt(env_base + i)
-                                          ->definition()
-                                          ->AsPushArgument()
-                                          ->value()
-                                          ->definition());
+        ASSERT1(call->ArgumentAt(i) == env->ValueAt(env_base + i)
+                                           ->definition()
+                                           ->AsPushArgument()
+                                           ->value()
+                                           ->definition(),
+                call);
       } else {
         // Redefintion instructions and boxing/unboxing are inserted
         // without updating environment uses (FlowGraph::RenameDominatedUses,
@@ -142,10 +158,11 @@
             env->ValueAt(env_base + i)
                 ->definition()
                 ->OriginalDefinitionIgnoreBoxingAndConstraints();
-        ASSERT((arg_def == env_def) ||
-               (arg_def->IsConstant() && env_def->IsConstant() &&
-                arg_def->AsConstant()->value().ptr() ==
-                    env_def->AsConstant()->value().ptr()));
+        ASSERT2((arg_def == env_def) ||
+                    (arg_def->IsConstant() && env_def->IsConstant() &&
+                     arg_def->AsConstant()->value().ptr() ==
+                         env_def->AsConstant()->value().ptr()),
+                arg_def, env_def);
       }
     }
   }
@@ -172,26 +189,26 @@
   for (BlockIterator it = flow_graph_->reverse_postorder_iterator(); !it.Done();
        it.Advance()) {
     BlockEntryInstr* block = it.Current();
-    ASSERT(block->block_id() <= max_block_id);
+    ASSERT1(block->block_id() <= max_block_id, block);
     // Make sure ordering is consistent.
-    ASSERT(block->preorder_number() <= block_count);
-    ASSERT(block->postorder_number() <= block_count);
-    ASSERT(preorder[block->preorder_number()] == block);
-    ASSERT(postorder[block->postorder_number()] == block);
+    ASSERT1(block->preorder_number() <= block_count, block);
+    ASSERT1(block->postorder_number() <= block_count, block);
+    ASSERT1(preorder[block->preorder_number()] == block, block);
+    ASSERT1(postorder[block->postorder_number()] == block, block);
     // Make sure predecessors and successors agree.
     Instruction* last = block->last_instruction();
     for (intptr_t i = 0, n = last->SuccessorCount(); i < n; ++i) {
-      ASSERT(IsPred(block, last->SuccessorAt(i)));
+      ASSERT1(IsPred(block, last->SuccessorAt(i)), block);
     }
     for (intptr_t i = 0, n = block->PredecessorCount(); i < n; ++i) {
-      ASSERT(IsSucc(block, block->PredecessorAt(i)));
+      ASSERT1(IsSucc(block, block->PredecessorAt(i)), block);
     }
     // Make sure dominance relations agree.
     for (intptr_t i = 0, n = block->dominated_blocks().length(); i < n; ++i) {
-      ASSERT(block->dominated_blocks()[i]->dominator() == block);
+      ASSERT1(block->dominated_blocks()[i]->dominator() == block, block);
     }
     if (block->dominator() != nullptr) {
-      ASSERT(IsDirectlyDominated(block, block->dominator()));
+      ASSERT1(IsDirectlyDominated(block, block->dominator()), block);
     }
     // Visit all instructions in this block.
     VisitInstructions(block);
@@ -211,15 +228,16 @@
   if (auto entry = block->AsBlockEntryWithInitialDefs()) {
     for (auto def : *entry->initial_definitions()) {
       ASSERT(def != nullptr);
-      ASSERT(def->IsConstant() || def->IsParameter() ||
-             def->IsSpecialParameter());
+      ASSERT1(
+          def->IsConstant() || def->IsParameter() || def->IsSpecialParameter(),
+          def);
       // Special constants reside outside the IR.
       if (IsSpecialConstant(def)) continue;
       // Make sure block lookup agrees.
-      ASSERT(def->GetBlock() == entry);
+      ASSERT1(def->GetBlock() == entry, def);
       // Initial definitions are partially linked into graph.
-      ASSERT(def->next() == nullptr);
-      ASSERT(def->previous() == entry);
+      ASSERT1(def->next() == nullptr, def);
+      ASSERT1(def->previous() == entry, def);
       // Visit the initial definition as instruction.
       VisitInstruction(def);
     }
@@ -229,30 +247,30 @@
     for (PhiIterator it(entry); !it.Done(); it.Advance()) {
       PhiInstr* phi = it.Current();
       // Make sure block lookup agrees.
-      ASSERT(phi->GetBlock() == entry);
+      ASSERT1(phi->GetBlock() == entry, phi);
       // Phis are never linked into graph.
-      ASSERT(phi->next() == nullptr);
-      ASSERT(phi->previous() == nullptr);
+      ASSERT1(phi->next() == nullptr, phi);
+      ASSERT1(phi->previous() == nullptr, phi);
       // Visit the phi as instruction.
       VisitInstruction(phi);
     }
   }
   // Visit regular instructions.
   Instruction* last = block->last_instruction();
-  ASSERT((last == block) == block->IsGraphEntry());
+  ASSERT1((last == block) == block->IsGraphEntry(), block);
   Instruction* prev = block;
   ASSERT(prev->previous() == nullptr);
   for (ForwardInstructionIterator it(block); !it.Done(); it.Advance()) {
     Instruction* instruction = it.Current();
     // Make sure block lookup agrees (scan in scan).
-    ASSERT(instruction->GetBlock() == block);
+    ASSERT1(instruction->GetBlock() == block, instruction);
     // Make sure linked list agrees.
-    ASSERT(prev->next() == instruction);
-    ASSERT(instruction->previous() == prev);
+    ASSERT1(prev->next() == instruction, instruction);
+    ASSERT1(instruction->previous() == prev, instruction);
     prev = instruction;
     // Make sure control flow makes sense.
-    ASSERT(IsControlFlow(instruction) == (instruction == last));
-    ASSERT(!instruction->IsPhi());
+    ASSERT1(IsControlFlow(instruction) == (instruction == last), instruction);
+    ASSERT1(!instruction->IsPhi(), instruction);
     // Visit the instruction.
     VisitInstruction(instruction);
   }
@@ -262,19 +280,20 @@
   if (flow_graph_->loop_hierarchy_ != nullptr) {
     for (LoopInfo* loop = block->loop_info(); loop != nullptr;
          loop = loop->outer()) {
-      ASSERT(loop->Contains(block));
+      ASSERT1(loop->Contains(block), block);
     }
   }
 }
 
 void FlowGraphChecker::VisitInstruction(Instruction* instruction) {
-  ASSERT(!instruction->IsBlockEntry());
+  ASSERT1(!instruction->IsBlockEntry(), instruction);
 
 #if !defined(DART_PRECOMPILER)
   // In JIT mode, any instruction which may throw must have a deopt-id, except
   // tail-call because it replaces the stack frame.
-  ASSERT(!instruction->MayThrow() || instruction->IsTailCall() ||
-         instruction->deopt_id() != DeoptId::kNone);
+  ASSERT1(!instruction->MayThrow() || instruction->IsTailCall() ||
+              instruction->deopt_id() != DeoptId::kNone,
+          instruction);
 #endif  // !defined(DART_PRECOMPILER)
 
   // If checking token positions and the flow graph has an inlining ID,
@@ -283,7 +302,7 @@
   if (FLAG_check_token_positions && flow_graph_->inlining_id() >= 0) {
     const TokenPosition& pos = instruction->token_pos();
     if (pos.IsReal() || pos.IsSynthetic()) {
-      ASSERT(instruction->has_inlining_id());
+      ASSERT1(instruction->has_inlining_id(), instruction);
       const intptr_t inlining_id = instruction->inlining_id();
       const auto& function = *inline_id_to_function_[inlining_id];
       if (function.end_token_pos().IsReal() &&
@@ -336,9 +355,9 @@
   // Used definitions must have an SSA name, and the SSA name must
   // be less than the current_ssa_temp_index.
   if (def->HasSSATemp()) {
-    ASSERT(def->ssa_temp_index() < flow_graph_->current_ssa_temp_index());
+    ASSERT1(def->ssa_temp_index() < flow_graph_->current_ssa_temp_index(), def);
   } else {
-    ASSERT(def->input_use_list() == nullptr);
+    ASSERT1(def->input_use_list() == nullptr, def);
   }
   // Check all regular uses.
   Value* prev = nullptr;
@@ -360,36 +379,38 @@
                                    Value* use,
                                    intptr_t index,
                                    bool is_env) {
-  ASSERT(use->instruction() == instruction);
-  ASSERT(use->use_index() == index);
+  ASSERT2(use->instruction() == instruction, use, instruction);
+  ASSERT1(use->use_index() == index, use);
   // Get definition.
   Definition* def = use->definition();
   ASSERT(def != nullptr);
-  ASSERT(def != instruction || def->IsPhi() || def->IsMaterializeObject());
+  ASSERT1(def != instruction || def->IsPhi() || def->IsMaterializeObject(),
+          def);
   // Make sure each input is properly defined in the graph by something
   // that dominates the input (note that the proper dominance relation
   // on the input values of Phis is checked by the Phi visitor below).
   if (def->IsPhi()) {
-    ASSERT(def->GetBlock()->IsJoinEntry());
+    ASSERT1(def->GetBlock()->IsJoinEntry(), def);
     // Phis are never linked into graph.
-    ASSERT(def->next() == nullptr);
-    ASSERT(def->previous() == nullptr);
+    ASSERT1(def->next() == nullptr, def);
+    ASSERT1(def->previous() == nullptr, def);
   } else if (def->IsConstant() || def->IsParameter() ||
              def->IsSpecialParameter()) {
     // Special constants reside outside the IR.
     if (IsSpecialConstant(def)) return;
     // Initial definitions are partially linked into graph, but some
     // constants are fully linked into graph (so no next() assert).
-    ASSERT(def->previous() != nullptr);
+    ASSERT1(def->previous() != nullptr, def);
   } else {
     // Others are fully linked into graph.
-    ASSERT(def->next() != nullptr);
-    ASSERT(def->previous() != nullptr);
+    ASSERT1(def->next() != nullptr, def);
+    ASSERT1(def->previous() != nullptr, def);
   }
   if (def->HasSSATemp()) {
-    ASSERT(DefDominatesUse(def, instruction));
-    ASSERT(IsInUseList(is_env ? def->env_use_list() : def->input_use_list(),
-                       instruction));
+    ASSERT2(DefDominatesUse(def, instruction), def, instruction);
+    ASSERT2(IsInUseList(is_env ? def->env_use_list() : def->input_use_list(),
+                        instruction),
+            def, instruction);
   }
 }
 
@@ -397,41 +418,45 @@
                                    Value* use,
                                    Value* prev,
                                    bool is_env) {
-  ASSERT(use->definition() == def);
-  ASSERT(use->previous_use() == prev);
+  ASSERT2(use->definition() == def, use, def);
+  ASSERT1(use->previous_use() == prev, use);
   // Get using instruction.
   Instruction* instruction = use->instruction();
   ASSERT(instruction != nullptr);
-  ASSERT(def != instruction || def->IsPhi() || def->IsMaterializeObject());
+  ASSERT1(def != instruction || def->IsPhi() || def->IsMaterializeObject(),
+          def);
   if (is_env) {
-    ASSERT(instruction->env()->ValueAtUseIndex(use->use_index()) == use);
+    ASSERT2(instruction->env()->ValueAtUseIndex(use->use_index()) == use,
+            instruction, use);
   } else {
-    ASSERT(instruction->InputAt(use->use_index()) == use);
+    ASSERT2(instruction->InputAt(use->use_index()) == use, instruction, use);
   }
   // Make sure the reaching type, if any, has an owner consistent with this use.
   if (auto const type = use->reaching_type()) {
-    ASSERT(type->owner() == nullptr || type->owner() == def);
+    ASSERT1(type->owner() == nullptr || type->owner() == def, use);
   }
   // Make sure each use appears in the graph and is properly dominated
   // by the definition (note that the proper dominance relation on the
   // input values of Phis is checked by the Phi visitor below).
   if (instruction->IsPhi()) {
-    ASSERT(instruction->AsPhi()->is_alive());
-    ASSERT(instruction->GetBlock()->IsJoinEntry());
+    ASSERT1(instruction->AsPhi()->is_alive(), instruction);
+    ASSERT1(instruction->GetBlock()->IsJoinEntry(), instruction);
     // Phis are never linked into graph.
-    ASSERT(instruction->next() == nullptr);
-    ASSERT(instruction->previous() == nullptr);
+    ASSERT1(instruction->next() == nullptr, instruction);
+    ASSERT1(instruction->previous() == nullptr, instruction);
   } else if (instruction->IsBlockEntry()) {
     // BlockEntry instructions have environments attached to them but
     // have no reliable way to verify if they are still in the graph.
-    ASSERT(is_env);
-    ASSERT(instruction->next() != nullptr);
-    ASSERT(DefDominatesUse(def, instruction));
+    ASSERT1(is_env, instruction);
+    ASSERT1(instruction->next() != nullptr, instruction);
+    ASSERT2(DefDominatesUse(def, instruction), def, instruction);
   } else {
     // Others are fully linked into graph.
-    ASSERT(IsControlFlow(instruction) || instruction->next() != nullptr);
-    ASSERT(instruction->previous() != nullptr);
-    ASSERT(!def->HasSSATemp() || DefDominatesUse(def, instruction));
+    ASSERT1(IsControlFlow(instruction) || instruction->next() != nullptr,
+            instruction);
+    ASSERT1(instruction->previous() != nullptr, instruction);
+    ASSERT2(!def->HasSSATemp() || DefDominatesUse(def, instruction), def,
+            instruction);
   }
 }
 
@@ -454,29 +479,29 @@
 void FlowGraphChecker::VisitPhi(PhiInstr* phi) {
   // Make sure the definition of each input value of a Phi dominates
   // the corresponding incoming edge, as defined by order.
-  ASSERT(phi->InputCount() == current_block_->PredecessorCount());
+  ASSERT1(phi->InputCount() == current_block_->PredecessorCount(), phi);
   for (intptr_t i = 0, n = phi->InputCount(); i < n; ++i) {
     Definition* def = phi->InputAt(i)->definition();
-    ASSERT(def->HasSSATemp());  // phis have SSA defs
+    ASSERT1(def->HasSSATemp(), def);  // phis have SSA defs
     BlockEntryInstr* edge = current_block_->PredecessorAt(i);
-    ASSERT(DefDominatesUse(def, edge->last_instruction()));
+    ASSERT1(DefDominatesUse(def, edge->last_instruction()), def);
   }
 }
 
 void FlowGraphChecker::VisitGoto(GotoInstr* jmp) {
-  ASSERT(jmp->SuccessorCount() == 1);
+  ASSERT1(jmp->SuccessorCount() == 1, jmp);
 }
 
 void FlowGraphChecker::VisitIndirectGoto(IndirectGotoInstr* jmp) {
-  ASSERT(jmp->SuccessorCount() >= 1);
+  ASSERT1(jmp->SuccessorCount() >= 1, jmp);
 }
 
 void FlowGraphChecker::VisitBranch(BranchInstr* branch) {
-  ASSERT(branch->SuccessorCount() == 2);
+  ASSERT1(branch->SuccessorCount() == 2, branch);
 }
 
 void FlowGraphChecker::VisitRedefinition(RedefinitionInstr* def) {
-  ASSERT(def->value()->definition() != def);
+  ASSERT1(def->value()->definition() != def, def);
 }
 
 void FlowGraphChecker::VisitClosureCall(ClosureCallInstr* call) {
diff --git a/runtime/vm/compiler/backend/il.cc b/runtime/vm/compiler/backend/il.cc
index 74532bb..777e394 100644
--- a/runtime/vm/compiler/backend/il.cc
+++ b/runtime/vm/compiler/backend/il.cc
@@ -658,11 +658,11 @@
   return FinalizeHash(result, kBitsPerInt32 - 1);
 }
 
-bool Instruction::Equals(Instruction* other) const {
-  if (tag() != other->tag()) return false;
-  if (InputCount() != other->InputCount()) return false;
+bool Instruction::Equals(const Instruction& other) const {
+  if (tag() != other.tag()) return false;
+  if (InputCount() != other.InputCount()) return false;
   for (intptr_t i = 0; i < InputCount(); ++i) {
-    if (!InputAt(i)->Equals(other->InputAt(i))) return false;
+    if (!InputAt(i)->Equals(*other.InputAt(i))) return false;
   }
   return AttributesEqual(other);
 }
@@ -672,8 +672,8 @@
   UNREACHABLE();
 }
 
-bool Value::Equals(Value* other) const {
-  return definition() == other->definition();
+bool Value::Equals(const Value& other) const {
+  return definition() == other.definition();
 }
 
 static int OrderById(CidRange* const* a, CidRange* const* b) {
@@ -897,8 +897,8 @@
          cids[0].cid_start != kSmiCid);
 }
 
-bool CheckClassInstr::AttributesEqual(Instruction* other) const {
-  CheckClassInstr* other_check = other->AsCheckClass();
+bool CheckClassInstr::AttributesEqual(const Instruction& other) const {
+  auto const other_check = other.AsCheckClass();
   ASSERT(other_check != NULL);
   return cids().Equals(other_check->cids());
 }
@@ -1057,16 +1057,16 @@
   return this;
 }
 
-bool GuardFieldClassInstr::AttributesEqual(Instruction* other) const {
-  return field().ptr() == other->AsGuardFieldClass()->field().ptr();
+bool GuardFieldClassInstr::AttributesEqual(const Instruction& other) const {
+  return field().ptr() == other.AsGuardFieldClass()->field().ptr();
 }
 
-bool GuardFieldLengthInstr::AttributesEqual(Instruction* other) const {
-  return field().ptr() == other->AsGuardFieldLength()->field().ptr();
+bool GuardFieldLengthInstr::AttributesEqual(const Instruction& other) const {
+  return field().ptr() == other.AsGuardFieldLength()->field().ptr();
 }
 
-bool GuardFieldTypeInstr::AttributesEqual(Instruction* other) const {
-  return field().ptr() == other->AsGuardFieldType()->field().ptr();
+bool GuardFieldTypeInstr::AttributesEqual(const Instruction& other) const {
+  return field().ptr() == other.AsGuardFieldType()->field().ptr();
 }
 
 Instruction* AssertSubtypeInstr::Canonicalize(FlowGraph* flow_graph) {
@@ -1102,37 +1102,37 @@
   return this;
 }
 
-bool StrictCompareInstr::AttributesEqual(Instruction* other) const {
-  StrictCompareInstr* other_op = other->AsStrictCompare();
+bool StrictCompareInstr::AttributesEqual(const Instruction& other) const {
+  auto const other_op = other.AsStrictCompare();
   ASSERT(other_op != NULL);
   return ComparisonInstr::AttributesEqual(other) &&
          (needs_number_check() == other_op->needs_number_check());
 }
 
-bool MathMinMaxInstr::AttributesEqual(Instruction* other) const {
-  MathMinMaxInstr* other_op = other->AsMathMinMax();
+bool MathMinMaxInstr::AttributesEqual(const Instruction& other) const {
+  auto const other_op = other.AsMathMinMax();
   ASSERT(other_op != NULL);
   return (op_kind() == other_op->op_kind()) &&
          (result_cid() == other_op->result_cid());
 }
 
-bool BinaryIntegerOpInstr::AttributesEqual(Instruction* other) const {
-  ASSERT(other->tag() == tag());
-  BinaryIntegerOpInstr* other_op = other->AsBinaryIntegerOp();
+bool BinaryIntegerOpInstr::AttributesEqual(const Instruction& other) const {
+  ASSERT(other.tag() == tag());
+  auto const other_op = other.AsBinaryIntegerOp();
   return (op_kind() == other_op->op_kind()) &&
          (can_overflow() == other_op->can_overflow()) &&
          (is_truncating() == other_op->is_truncating());
 }
 
-bool LoadFieldInstr::AttributesEqual(Instruction* other) const {
-  LoadFieldInstr* other_load = other->AsLoadField();
+bool LoadFieldInstr::AttributesEqual(const Instruction& other) const {
+  auto const other_load = other.AsLoadField();
   ASSERT(other_load != NULL);
   return &this->slot_ == &other_load->slot_;
 }
 
-bool LoadStaticFieldInstr::AttributesEqual(Instruction* other) const {
+bool LoadStaticFieldInstr::AttributesEqual(const Instruction& other) const {
   ASSERT(AllowsCSE());
-  return field().ptr() == other->AsLoadStaticField()->field().ptr();
+  return field().ptr() == other.AsLoadStaticField()->field().ptr();
 }
 
 bool LoadStaticFieldInstr::IsFieldInitialized(Instance* field_value) const {
@@ -1218,8 +1218,8 @@
 #endif
 }
 
-bool ConstantInstr::AttributesEqual(Instruction* other) const {
-  ConstantInstr* other_constant = other->AsConstant();
+bool ConstantInstr::AttributesEqual(const Instruction& other) const {
+  auto const other_constant = other.AsConstant();
   ASSERT(other_constant != NULL);
   return (value().ptr() == other_constant->value().ptr() &&
           representation() == other_constant->representation());
@@ -3778,8 +3778,8 @@
   return (!value()->Type()->is_nullable()) ? value()->definition() : this;
 }
 
-bool CheckNullInstr::AttributesEqual(Instruction* other) const {
-  CheckNullInstr* other_check = other->AsCheckNull();
+bool CheckNullInstr::AttributesEqual(const Instruction& other) const {
+  auto const other_check = other.AsCheckNull();
   ASSERT(other_check != nullptr);
   return function_name().Equals(other_check->function_name()) &&
          exception_type() == other_check->exception_type();
@@ -5798,8 +5798,8 @@
                            deopt_id());
 }
 
-bool TestCidsInstr::AttributesEqual(Instruction* other) const {
-  TestCidsInstr* other_instr = other->AsTestCids();
+bool TestCidsInstr::AttributesEqual(const Instruction& other) const {
+  auto const other_instr = other.AsTestCids();
   if (!ComparisonInstr::AttributesEqual(other)) {
     return false;
   }
@@ -5851,8 +5851,9 @@
   bool look_for_redefinition = false;
   for (intptr_t i = 1; i < InputCount(); ++i) {
     Definition* def = InputAt(i)->definition();
-    if (def != first) {
-      if (def->OriginalDefinition() != first_origin) return nullptr;
+    if ((def != first) && (def != this)) {
+      Definition* origin = def->OriginalDefinition();
+      if ((origin != first_origin) && (origin != this)) return nullptr;
       look_for_redefinition = true;
     }
   }
@@ -5865,7 +5866,7 @@
       bool found = false;
       do {
         Definition* def = value->definition();
-        if (def == redef) {
+        if ((def == redef) || (def == this)) {
           found = true;
           break;
         }
@@ -5973,7 +5974,8 @@
   if (create_array == nullptr) {
     // Do not try to fold interpolate if array is an OSR argument.
     ASSERT(flow_graph->IsCompiledForOsr());
-    ASSERT(value()->definition()->IsPhi());
+    ASSERT(value()->definition()->IsPhi() ||
+           value()->definition()->IsParameter());
     return this;
   }
   // Check if the string interpolation has only constant inputs.
diff --git a/runtime/vm/compiler/backend/il.h b/runtime/vm/compiler/backend/il.h
index c4ff302..3ffd151 100644
--- a/runtime/vm/compiler/backend/il.h
+++ b/runtime/vm/compiler/backend/il.h
@@ -171,7 +171,7 @@
   // in the same chain of redefinitions.
   bool NeedsWriteBarrier();
 
-  bool Equals(Value* other) const;
+  bool Equals(const Value& other) const;
 
   // Returns true if this |Value| can evaluate to the given |value| during
   // execution.
@@ -1083,12 +1083,12 @@
   // 1. They have the same tag.
   // 2. All input operands are Equals.
   // 3. They satisfy AttributesEqual.
-  bool Equals(Instruction* other) const;
+  bool Equals(const Instruction& other) const;
 
   // Compare attributes of a instructions (except input operands and tag).
   // All instructions that participate in CSE have to override this function.
   // This function can assume that the argument has the same type as this.
-  virtual bool AttributesEqual(Instruction* other) const {
+  virtual bool AttributesEqual(const Instruction& other) const {
     UNREACHABLE();
     return false;
   }
@@ -2692,8 +2692,8 @@
   virtual bool ComputeCanDeoptimize() const { return false; }
   virtual bool HasUnknownSideEffects() const { return false; }
 
-  virtual bool AttributesEqual(Instruction* other) const {
-    return other->AsStoreIndexedUnsafe()->offset() == offset();
+  virtual bool AttributesEqual(const Instruction& other) const {
+    return other.AsStoreIndexedUnsafe()->offset() == offset();
   }
 
   Value* index() const { return inputs_[kIndexPos]; }
@@ -2741,8 +2741,8 @@
   virtual bool ComputeCanDeoptimize() const { return false; }
   virtual bool HasUnknownSideEffects() const { return false; }
 
-  virtual bool AttributesEqual(Instruction* other) const {
-    return other->AsLoadIndexedUnsafe()->offset() == offset();
+  virtual bool AttributesEqual(const Instruction& other) const {
+    return other.AsLoadIndexedUnsafe()->offset() == offset();
   }
 
   virtual Representation representation() const { return representation_; }
@@ -2801,7 +2801,7 @@
   virtual bool ComputeCanDeoptimize() const { return false; }
   virtual bool HasUnknownSideEffects() const { return true; }
 
-  virtual bool AttributesEqual(Instruction* other) const { return true; }
+  virtual bool AttributesEqual(const Instruction& other) const { return true; }
 
   Value* src() const { return inputs_[kSrcPos]; }
   Value* dest() const { return inputs_[kDestPos]; }
@@ -2872,8 +2872,8 @@
   // Two tailcalls can be canonicalized into one instruction if both have the
   // same destination.
   virtual bool AllowsCSE() const { return true; }
-  virtual bool AttributesEqual(Instruction* other) const {
-    return &other->AsTailCall()->code() == &code();
+  virtual bool AttributesEqual(const Instruction& other) const {
+    return &other.AsTailCall()->code() == &code();
   }
 
   // Since no code after this instruction will be executed, there will be no
@@ -2967,8 +2967,8 @@
 
   virtual bool HasUnknownSideEffects() const { return false; }
 
-  virtual bool AttributesEqual(Instruction* other) const {
-    auto other_return = other->AsReturn();
+  virtual bool AttributesEqual(const Instruction& other) const {
+    auto const other_return = other.AsReturn();
     return token_pos() == other_return->token_pos() &&
            yield_index() == other_return->yield_index();
   }
@@ -3268,13 +3268,12 @@
   virtual bool CanBecomeDeoptimizationTarget() const { return true; }
   virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); }
 
-  virtual bool AttributesEqual(Instruction* other) const {
-    ComparisonInstr* other_comparison = other->AsComparison();
+  virtual bool AttributesEqual(const Instruction& other) const {
+    auto const other_comparison = other.AsComparison();
     return kind() == other_comparison->kind() &&
            (operation_cid() == other_comparison->operation_cid());
   }
 
-
   DEFINE_INSTRUCTION_TYPE_CHECK(Comparison)
 
  protected:
@@ -3433,7 +3432,7 @@
 
   virtual bool ComputeCanDeoptimize() const { return true; }
 
-  virtual bool AttributesEqual(Instruction* other) const { return true; }
+  virtual bool AttributesEqual(const Instruction& other) const { return true; }
 
   DECLARE_INSTRUCTION(Deoptimize)
 
@@ -3512,7 +3511,7 @@
 
   virtual bool HasUnknownSideEffects() const { return false; }
 
-  virtual bool AttributesEqual(Instruction* other) const {
+  virtual bool AttributesEqual(const Instruction& other) const {
     UNREACHABLE();
     return false;
   }
@@ -3556,7 +3555,7 @@
 
   virtual void InferRange(RangeAnalysis* analysis, Range* range);
 
-  virtual bool AttributesEqual(Instruction* other) const;
+  virtual bool AttributesEqual(const Instruction& other) const;
 
   virtual TokenPosition token_pos() const { return token_pos_; }
 
@@ -3647,7 +3646,7 @@
 
   virtual Instruction* Canonicalize(FlowGraph* flow_graph);
 
-  virtual bool AttributesEqual(Instruction* other) const { return true; }
+  virtual bool AttributesEqual(const Instruction& other) const { return true; }
 
   PRINT_OPERANDS_TO_SUPPORT
 
@@ -3739,7 +3738,7 @@
 
   virtual Definition* Canonicalize(FlowGraph* flow_graph);
 
-  virtual bool AttributesEqual(Instruction* other) const { return true; }
+  virtual bool AttributesEqual(const Instruction& other) const { return true; }
 
   virtual Value* RedefinedValue() const;
 
@@ -3778,7 +3777,7 @@
 
   virtual Definition* Canonicalize(FlowGraph* flow_graph);
 
-  virtual bool AttributesEqual(Instruction* other) const { return true; }
+  virtual bool AttributesEqual(const Instruction& other) const { return true; }
 
   virtual Value* RedefinedValue() const;
 
@@ -3829,8 +3828,8 @@
 
   virtual bool HasUnknownSideEffects() const { return false; }
 
-  virtual bool AttributesEqual(Instruction* other) const {
-    return kind() == other->AsSpecialParameter()->kind();
+  virtual bool AttributesEqual(const Instruction& other) const {
+    return kind() == other.AsSpecialParameter()->kind();
   }
   SpecialParameterKind kind() const { return kind_; }
 
@@ -4409,7 +4408,7 @@
   bool needs_number_check() const { return needs_number_check_; }
   void set_needs_number_check(bool value) { needs_number_check_ = value; }
 
-  bool AttributesEqual(Instruction* other) const;
+  bool AttributesEqual(const Instruction& other) const;
 
   PRINT_OPERANDS_TO_SUPPORT;
 
@@ -4496,7 +4495,7 @@
     return kTagged;
   }
 
-  virtual bool AttributesEqual(Instruction* other) const;
+  virtual bool AttributesEqual(const Instruction& other) const;
 
   void set_licm_hoisted(bool value) { licm_hoisted_ = value; }
 
@@ -4550,10 +4549,10 @@
     return speculative_mode_;
   }
 
-  virtual bool AttributesEqual(Instruction* other) const {
+  virtual bool AttributesEqual(const Instruction& other) const {
     return ComparisonInstr::AttributesEqual(other) &&
-           (null_aware_ == other->AsEqualityCompare()->null_aware_) &&
-           (speculative_mode_ == other->AsEqualityCompare()->speculative_mode_);
+           (null_aware_ == other.AsEqualityCompare()->null_aware_) &&
+           (speculative_mode_ == other.AsEqualityCompare()->speculative_mode_);
   }
 
   virtual Definition* Canonicalize(FlowGraph* flow_graph);
@@ -4602,9 +4601,9 @@
     return speculative_mode_;
   }
 
-  virtual bool AttributesEqual(Instruction* other) const {
+  virtual bool AttributesEqual(const Instruction& other) const {
     return ComparisonInstr::AttributesEqual(other) &&
-           (speculative_mode_ == other->AsRelationalOp()->speculative_mode_);
+           (speculative_mode_ == other.AsRelationalOp()->speculative_mode_);
   }
 
   PRINT_OPERANDS_TO_SUPPORT
@@ -4673,10 +4672,10 @@
   }
   virtual bool CanCallDart() const { return comparison()->CanCallDart(); }
 
-  virtual bool AttributesEqual(Instruction* other) const {
-    IfThenElseInstr* other_if_then_else = other->AsIfThenElse();
+  virtual bool AttributesEqual(const Instruction& other) const {
+    auto const other_if_then_else = other.AsIfThenElse();
     return (comparison()->tag() == other_if_then_else->comparison()->tag()) &&
-           comparison()->AttributesEqual(other_if_then_else->comparison()) &&
+           comparison()->AttributesEqual(*other_if_then_else->comparison()) &&
            (if_true_ == other_if_then_else->if_true_) &&
            (if_false_ == other_if_then_else->if_false_);
   }
@@ -5461,7 +5460,7 @@
 
   virtual Instruction* Canonicalize(FlowGraph* flow_graph);
 
-  virtual bool AttributesEqual(Instruction* other) const;
+  virtual bool AttributesEqual(const Instruction& other) const;
 
  private:
   DISALLOW_COPY_AND_ASSIGN(GuardFieldClassInstr);
@@ -5478,7 +5477,7 @@
 
   virtual Instruction* Canonicalize(FlowGraph* flow_graph);
 
-  virtual bool AttributesEqual(Instruction* other) const;
+  virtual bool AttributesEqual(const Instruction& other) const;
 
  private:
   DISALLOW_COPY_AND_ASSIGN(GuardFieldLengthInstr);
@@ -5501,7 +5500,7 @@
 
   virtual Instruction* Canonicalize(FlowGraph* flow_graph);
 
-  virtual bool AttributesEqual(Instruction* other) const;
+  virtual bool AttributesEqual(const Instruction& other) const;
 
  private:
   DISALLOW_COPY_AND_ASSIGN(GuardFieldTypeInstr);
@@ -5551,7 +5550,7 @@
 
   virtual Definition* Canonicalize(FlowGraph* flow_graph);
 
-  virtual bool AttributesEqual(Instruction* other) const;
+  virtual bool AttributesEqual(const Instruction& other) const;
 
   virtual TokenPosition token_pos() const { return token_pos_; }
 
@@ -5776,7 +5775,7 @@
 
   virtual bool ComputeCanDeoptimize() const { return false; }
 
-  virtual bool AttributesEqual(Instruction* other) const { return true; }
+  virtual bool AttributesEqual(const Instruction& other) const { return true; }
 
  private:
   DISALLOW_COPY_AND_ASSIGN(OneByteStringFromCharCodeInstr);
@@ -5796,8 +5795,8 @@
 
   virtual bool ComputeCanDeoptimize() const { return false; }
 
-  virtual bool AttributesEqual(Instruction* other) const {
-    return other->AsStringToCharCode()->cid_ == cid_;
+  virtual bool AttributesEqual(const Instruction& other) const {
+    return other.AsStringToCharCode()->cid_ == cid_;
   }
 
  private:
@@ -5901,8 +5900,8 @@
     return kNotSpeculative;
   }
 
-  virtual bool AttributesEqual(Instruction* other) const {
-    return scan_flags_field_.Equals(&other->AsUtf8Scan()->scan_flags_field_);
+  virtual bool AttributesEqual(const Instruction& other) const {
+    return scan_flags_field_.Equals(other.AsUtf8Scan()->scan_flags_field_);
   }
 
   bool IsScanFlagsUnboxed() const;
@@ -6430,8 +6429,8 @@
   virtual bool ComputeCanDeoptimize() const { return false; }
 
   virtual bool HasUnknownSideEffects() const { return false; }
-  virtual bool AttributesEqual(Instruction* other) const {
-    return other->AsLoadUntagged()->offset_ == offset_;
+  virtual bool AttributesEqual(const Instruction& other) const {
+    return other.AsLoadUntagged()->offset_ == offset_;
   }
 
   PRINT_OPERANDS_TO_SUPPORT
@@ -6476,8 +6475,8 @@
 
   virtual bool ComputeCanDeoptimize() const { return false; }
   virtual bool HasUnknownSideEffects() const { return false; }
-  virtual bool AttributesEqual(Instruction* other) const {
-    return other->AsStoreUntagged()->offset_ == offset_;
+  virtual bool AttributesEqual(const Instruction& other) const {
+    return other.AsStoreUntagged()->offset_ == offset_;
   }
 
   intptr_t offset_from_tagged() const {
@@ -6511,8 +6510,8 @@
 
   virtual bool ComputeCanDeoptimize() const { return false; }
 
-  virtual bool AttributesEqual(Instruction* other) const {
-    auto other_load = other->AsLoadClassId();
+  virtual bool AttributesEqual(const Instruction& other) const {
+    auto const other_load = other.AsLoadClassId();
     return other_load->representation_ == representation_ &&
            other_load->input_can_be_smi_ == input_can_be_smi_;
   }
@@ -6628,7 +6627,7 @@
 
   virtual bool AllowsCSE() const { return slot_.is_immutable(); }
 
-  virtual bool AttributesEqual(Instruction* other) const;
+  virtual bool AttributesEqual(const Instruction& other) const;
 
   PRINT_OPERANDS_TO_SUPPORT
 
@@ -6871,7 +6870,7 @@
 
   virtual Instruction* Canonicalize(FlowGraph* flow_graph);
 
-  virtual bool AttributesEqual(Instruction* other) const { return true; }
+  virtual bool AttributesEqual(const Instruction& other) const { return true; }
 
   void set_licm_hoisted(bool value) { licm_hoisted_ = value; }
 
@@ -6916,8 +6915,8 @@
     return from_representation();
   }
 
-  virtual bool AttributesEqual(Instruction* other) const {
-    return other->AsBox()->from_representation() == from_representation();
+  virtual bool AttributesEqual(const Instruction& other) const {
+    return other.AsBox()->from_representation() == from_representation();
   }
 
   Definition* Canonicalize(FlowGraph* flow_graph);
@@ -7061,8 +7060,8 @@
   DECLARE_INSTRUCTION(Unbox)
   virtual CompileType ComputeType() const;
 
-  virtual bool AttributesEqual(Instruction* other) const {
-    UnboxInstr* other_unbox = other->AsUnbox();
+  virtual bool AttributesEqual(const Instruction& other) const {
+    auto const other_unbox = other.AsUnbox();
     return (representation() == other_unbox->representation()) &&
            (speculative_mode_ == other_unbox->speculative_mode_);
   }
@@ -7120,8 +7119,8 @@
 
   virtual CompileType ComputeType() const;
 
-  virtual bool AttributesEqual(Instruction* other) const {
-    UnboxIntegerInstr* other_unbox = other->AsUnboxInteger();
+  virtual bool AttributesEqual(const Instruction& other) const {
+    auto const other_unbox = other.AsUnboxInteger();
     return UnboxInstr::AttributesEqual(other) &&
            (other_unbox->is_truncating_ == is_truncating_);
   }
@@ -7272,8 +7271,8 @@
   DECLARE_INSTRUCTION(MathUnary)
   virtual CompileType ComputeType() const;
 
-  virtual bool AttributesEqual(Instruction* other) const {
-    return kind() == other->AsMathUnary()->kind();
+  virtual bool AttributesEqual(const Instruction& other) const {
+    return kind() == other.AsMathUnary()->kind();
   }
 
   Definition* Canonicalize(FlowGraph* flow_graph);
@@ -7331,8 +7330,8 @@
   DECLARE_INSTRUCTION(CaseInsensitiveCompare)
   virtual CompileType ComputeType() const;
 
-  virtual bool AttributesEqual(Instruction* other) const {
-    return other->AsCaseInsensitiveCompare()->cid_ == cid_;
+  virtual bool AttributesEqual(const Instruction& other) const {
+    return other.AsCaseInsensitiveCompare()->cid_ == cid_;
   }
 
  private:
@@ -7391,7 +7390,7 @@
 
   DECLARE_INSTRUCTION(MathMinMax)
   virtual CompileType ComputeType() const;
-  virtual bool AttributesEqual(Instruction* other) const;
+  virtual bool AttributesEqual(const Instruction& other) const;
 
  private:
   const MethodRecognizer::Kind op_kind_;
@@ -7449,8 +7448,8 @@
 
   virtual Definition* Canonicalize(FlowGraph* flow_graph);
 
-  virtual bool AttributesEqual(Instruction* other) const {
-    const BinaryDoubleOpInstr* other_bin_op = other->AsBinaryDoubleOp();
+  virtual bool AttributesEqual(const Instruction& other) const {
+    auto const other_bin_op = other.AsBinaryDoubleOp();
     return (op_kind() == other_bin_op->op_kind()) &&
            (speculative_mode_ == other_bin_op->speculative_mode_);
   }
@@ -7492,8 +7491,8 @@
 
   virtual Definition* Canonicalize(FlowGraph* flow_graph);
 
-  virtual bool AttributesEqual(Instruction* other) const {
-    return op_kind_ == other->AsDoubleTestOp()->op_kind() &&
+  virtual bool AttributesEqual(const Instruction& other) const {
+    return op_kind_ == other.AsDoubleTestOp()->op_kind() &&
            ComparisonInstr::AttributesEqual(other);
   }
 
@@ -7522,8 +7521,8 @@
   Value* value() const { return inputs_[0]; }
   Token::Kind op_kind() const { return op_kind_; }
 
-  virtual bool AttributesEqual(Instruction* other) const {
-    return other->AsUnaryIntegerOp()->op_kind() == op_kind();
+  virtual bool AttributesEqual(const Instruction& other) const {
+    return other.AsUnaryIntegerOp()->op_kind() == op_kind();
   }
 
   virtual intptr_t DeoptimizationTarget() const {
@@ -7608,8 +7607,8 @@
     return kUnboxedInt64;
   }
 
-  virtual bool AttributesEqual(Instruction* other) const {
-    UnaryInt64OpInstr* unary_op_other = other->AsUnaryInt64Op();
+  virtual bool AttributesEqual(const Instruction& other) const {
+    auto const unary_op_other = other.AsUnaryInt64Op();
     return UnaryIntegerOpInstr::AttributesEqual(other) &&
            (speculative_mode_ == unary_op_other->speculative_mode_);
   }
@@ -7680,7 +7679,7 @@
 
   virtual Definition* Canonicalize(FlowGraph* flow_graph);
 
-  virtual bool AttributesEqual(Instruction* other) const;
+  virtual bool AttributesEqual(const Instruction& other) const;
 
   virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); }
 
@@ -7862,9 +7861,9 @@
     return speculative_mode_;
   }
 
-  virtual bool AttributesEqual(Instruction* other) const {
+  virtual bool AttributesEqual(const Instruction& other) const {
     return BinaryIntegerOpInstr::AttributesEqual(other) &&
-           (speculative_mode_ == other->AsBinaryInt64Op()->speculative_mode_);
+           (speculative_mode_ == other.AsBinaryInt64Op()->speculative_mode_);
   }
 
   virtual CompileType ComputeType() const;
@@ -8080,8 +8079,8 @@
     return speculative_mode_;
   }
 
-  virtual bool AttributesEqual(Instruction* other) const {
-    return speculative_mode_ == other->AsUnaryDoubleOp()->speculative_mode_;
+  virtual bool AttributesEqual(const Instruction& other) const {
+    return speculative_mode_ == other.AsUnaryDoubleOp()->speculative_mode_;
   }
 
   PRINT_OPERANDS_TO_SUPPORT
@@ -8167,7 +8166,7 @@
 
   virtual bool ComputeCanDeoptimize() const { return false; }
 
-  virtual bool AttributesEqual(Instruction* other) const { return true; }
+  virtual bool AttributesEqual(const Instruction& other) const { return true; }
 
  private:
   const TokenPosition token_pos_;
@@ -8193,7 +8192,7 @@
 
   virtual bool ComputeCanDeoptimize() const { return false; }
 
-  virtual bool AttributesEqual(Instruction* other) const { return true; }
+  virtual bool AttributesEqual(const Instruction& other) const { return true; }
 
  private:
   DISALLOW_COPY_AND_ASSIGN(Int32ToDoubleInstr);
@@ -8232,8 +8231,8 @@
     return speculative_mode_;
   }
 
-  virtual bool AttributesEqual(Instruction* other) const {
-    return speculative_mode_ == other->AsInt64ToDouble()->speculative_mode_;
+  virtual bool AttributesEqual(const Instruction& other) const {
+    return speculative_mode_ == other.AsInt64ToDouble()->speculative_mode_;
   }
 
  private:
@@ -8293,7 +8292,7 @@
 
   virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); }
 
-  virtual bool AttributesEqual(Instruction* other) const { return true; }
+  virtual bool AttributesEqual(const Instruction& other) const { return true; }
 
  private:
   DISALLOW_COPY_AND_ASSIGN(DoubleToSmiInstr);
@@ -8326,8 +8325,8 @@
 
   virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); }
 
-  virtual bool AttributesEqual(Instruction* other) const {
-    return other->AsDoubleToDouble()->recognized_kind() == recognized_kind();
+  virtual bool AttributesEqual(const Instruction& other) const {
+    return other.AsDoubleToDouble()->recognized_kind() == recognized_kind();
   }
 
  private:
@@ -8372,7 +8371,7 @@
 
   virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); }
 
-  virtual bool AttributesEqual(Instruction* other) const { return true; }
+  virtual bool AttributesEqual(const Instruction& other) const { return true; }
 
   virtual Definition* Canonicalize(FlowGraph* flow_graph);
 
@@ -8406,7 +8405,7 @@
 
   virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); }
 
-  virtual bool AttributesEqual(Instruction* other) const { return true; }
+  virtual bool AttributesEqual(const Instruction& other) const { return true; }
 
   virtual Definition* Canonicalize(FlowGraph* flow_graph);
 
@@ -8448,8 +8447,8 @@
 
   virtual Value* InputAt(intptr_t i) const { return (*inputs_)[i]; }
 
-  virtual bool AttributesEqual(Instruction* other) const {
-    InvokeMathCFunctionInstr* other_invoke = other->AsInvokeMathCFunction();
+  virtual bool AttributesEqual(const Instruction& other) const {
+    auto const other_invoke = other.AsInvokeMathCFunction();
     return other_invoke->recognized_kind() == recognized_kind();
   }
 
@@ -8506,8 +8505,8 @@
     return definition_rep_;
   }
 
-  virtual bool AttributesEqual(Instruction* other) const {
-    ExtractNthOutputInstr* other_extract = other->AsExtractNthOutput();
+  virtual bool AttributesEqual(const Instruction& other) const {
+    auto const other_extract = other.AsExtractNthOutput();
     return (other_extract->representation() == representation()) &&
            (other_extract->index() == index());
   }
@@ -8542,7 +8541,7 @@
 
   DECLARE_INSTRUCTION(TruncDivMod)
 
-  virtual bool AttributesEqual(Instruction* other) const { return true; }
+  virtual bool AttributesEqual(const Instruction& other) const { return true; }
 
   PRINT_OPERANDS_TO_SUPPORT
 
@@ -8593,7 +8592,7 @@
   virtual bool AllowsCSE() const { return true; }
   virtual bool HasUnknownSideEffects() const { return false; }
 
-  virtual bool AttributesEqual(Instruction* other) const;
+  virtual bool AttributesEqual(const Instruction& other) const;
 
   bool licm_hoisted() const { return licm_hoisted_; }
   void set_licm_hoisted(bool value) { licm_hoisted_ = value; }
@@ -8644,7 +8643,7 @@
 
   virtual Instruction* Canonicalize(FlowGraph* flow_graph);
 
-  virtual bool AttributesEqual(Instruction* other) const { return true; }
+  virtual bool AttributesEqual(const Instruction& other) const { return true; }
 
   bool licm_hoisted() const { return licm_hoisted_; }
   void set_licm_hoisted(bool value) { licm_hoisted_ = value; }
@@ -8703,7 +8702,7 @@
 
   virtual Definition* Canonicalize(FlowGraph* flow_graph);
 
-  virtual bool AttributesEqual(Instruction* other) const;
+  virtual bool AttributesEqual(const Instruction& other) const;
 
   static void AddMetadataForRuntimeCall(CheckNullInstr* check_null,
                                         FlowGraphCompiler* compiler);
@@ -8740,7 +8739,7 @@
   virtual bool AllowsCSE() const { return true; }
   virtual bool HasUnknownSideEffects() const { return false; }
 
-  virtual bool AttributesEqual(Instruction* other) const { return true; }
+  virtual bool AttributesEqual(const Instruction& other) const { return true; }
 
   PRINT_OPERANDS_TO_SUPPORT
 
@@ -8808,7 +8807,7 @@
 
   static bool IsFixedLengthArrayType(intptr_t class_id);
 
-  virtual bool AttributesEqual(Instruction* other) const { return true; }
+  virtual bool AttributesEqual(const Instruction& other) const { return true; }
 
   void set_licm_hoisted(bool value) { licm_hoisted_ = value; }
 
@@ -8835,7 +8834,7 @@
   GenericCheckBoundInstr(Value* length, Value* index, intptr_t deopt_id)
       : CheckBoundBase(length, index, deopt_id) {}
 
-  virtual bool AttributesEqual(Instruction* other) const { return true; }
+  virtual bool AttributesEqual(const Instruction& other) const { return true; }
 
   DECLARE_INSTRUCTION(GenericCheckBound)
 
@@ -8897,9 +8896,9 @@
   virtual bool AllowsCSE() const { return true; }
   virtual bool HasUnknownSideEffects() const { return false; }
 
-  virtual bool AttributesEqual(Instruction* other) const {
-    return other->Cast<CheckConditionInstr>()->comparison()->AttributesEqual(
-        comparison());
+  virtual bool AttributesEqual(const Instruction& other) const {
+    return other.AsCheckCondition()->comparison()->AttributesEqual(
+        *comparison());
   }
 
   virtual intptr_t InputCount() const { return comparison()->InputCount(); }
@@ -8960,9 +8959,9 @@
     return from();
   }
 
-  virtual bool AttributesEqual(Instruction* other) const {
-    ASSERT(other->IsIntConverter());
-    auto converter = other->AsIntConverter();
+  virtual bool AttributesEqual(const Instruction& other) const {
+    ASSERT(other.IsIntConverter());
+    auto const converter = other.AsIntConverter();
     return (converter->from() == from()) && (converter->to() == to()) &&
            (converter->is_truncating() == is_truncating());
   }
@@ -9019,9 +9018,9 @@
     return from();
   }
 
-  virtual bool AttributesEqual(Instruction* other) const {
-    ASSERT(other->IsBitCast());
-    BitCastInstr* converter = other->AsBitCast();
+  virtual bool AttributesEqual(const Instruction& other) const {
+    ASSERT(other.IsBitCast());
+    auto const converter = other.AsBitCast();
     return converter->from() == from() && converter->to() == to();
   }
 
@@ -9232,8 +9231,8 @@
   virtual bool HasUnknownSideEffects() const { return false; }
   virtual bool AllowsCSE() const { return true; }
 
-  virtual bool AttributesEqual(Instruction* other) const {
-    SimdOpInstr* other_op = other->AsSimdOp();
+  virtual bool AttributesEqual(const Instruction& other) const {
+    auto const other_op = other.AsSimdOp();
     return kind() == other_op->kind() &&
            (!HasMask() || mask() == other_op->mask());
   }
diff --git a/runtime/vm/compiler/backend/il_printer.cc b/runtime/vm/compiler/backend/il_printer.cc
index 5773401..b9907ec 100644
--- a/runtime/vm/compiler/backend/il_printer.cc
+++ b/runtime/vm/compiler/backend/il_printer.cc
@@ -349,6 +349,13 @@
   value()->PrintTo(f);
 }
 
+const char* Value::ToCString() const {
+  char buffer[1024];
+  BufferFormatter f(buffer, sizeof(buffer));
+  PrintTo(&f);
+  return Thread::Current()->zone()->MakeCopyOfString(buffer);
+}
+
 void Value::PrintTo(BaseTextBuffer* f) const {
   PrintUse(f, *definition());
 
@@ -370,6 +377,10 @@
     buffer[pos] = '\0';
     f->Printf("#%s\\n...", buffer);
   }
+
+  if (representation() != kNoRepresentation && representation() != kTagged) {
+    f->Printf(" %s", RepresentationToCString(representation()));
+  }
 }
 
 void ConstraintInstr::PrintOperandsTo(BaseTextBuffer* f) const {
diff --git a/runtime/vm/compiler/backend/il_test.cc b/runtime/vm/compiler/backend/il_test.cc
index e02bec5..3a0286c 100644
--- a/runtime/vm/compiler/backend/il_test.cc
+++ b/runtime/vm/compiler/backend/il_test.cc
@@ -35,17 +35,17 @@
   Definition* def2 = new PhiInstr(join, 0);
   Value* use1a = new Value(def1);
   Value* use1b = new Value(def1);
-  EXPECT(use1a->Equals(use1b));
+  EXPECT(use1a->Equals(*use1b));
   Value* use2 = new Value(def2);
-  EXPECT(!use2->Equals(use1a));
+  EXPECT(!use2->Equals(*use1a));
 
   ConstantInstr* c1 = new ConstantInstr(Bool::True());
   ConstantInstr* c2 = new ConstantInstr(Bool::True());
-  EXPECT(c1->Equals(c2));
+  EXPECT(c1->Equals(*c2));
   ConstantInstr* c3 = new ConstantInstr(Object::ZoneHandle());
   ConstantInstr* c4 = new ConstantInstr(Object::ZoneHandle());
-  EXPECT(c3->Equals(c4));
-  EXPECT(!c3->Equals(c1));
+  EXPECT(c3->Equals(*c4));
+  EXPECT(!c3->Equals(*c1));
 }
 
 ISOLATE_UNIT_TEST_CASE(IRTest_EliminateWriteBarrier) {
@@ -261,4 +261,56 @@
                                                kUnboxedInt64, kUnboxedUint32));
 }
 
+ISOLATE_UNIT_TEST_CASE(IL_PhiCanonicalization) {
+  using compiler::BlockBuilder;
+
+  CompilerState S(thread, /*is_aot=*/false, /*is_optimizing=*/true);
+
+  FlowGraphBuilderHelper H;
+
+  auto normal_entry = H.flow_graph()->graph_entry()->normal_entry();
+  auto b2 = H.JoinEntry();
+  auto b3 = H.TargetEntry();
+  auto b4 = H.TargetEntry();
+
+  Definition* v0;
+  ReturnInstr* ret;
+  PhiInstr* phi;
+
+  {
+    BlockBuilder builder(H.flow_graph(), normal_entry);
+    v0 = builder.AddParameter(0, 0, /*with_frame=*/true, kTagged);
+    builder.AddInstruction(new GotoInstr(b2, S.GetNextDeoptId()));
+  }
+
+  {
+    BlockBuilder builder(H.flow_graph(), b2);
+    phi = new PhiInstr(b2, 2);
+    phi->SetInputAt(0, new Value(v0));
+    phi->SetInputAt(1, new Value(phi));
+    builder.AddPhi(phi);
+    builder.AddBranch(new StrictCompareInstr(
+                          InstructionSource(), Token::kEQ_STRICT,
+                          new Value(H.IntConstant(1)), new Value(phi),
+                          /*needs_number_check=*/false, S.GetNextDeoptId()),
+                      b3, b4);
+  }
+
+  {
+    BlockBuilder builder(H.flow_graph(), b3);
+    builder.AddInstruction(new GotoInstr(b2, S.GetNextDeoptId()));
+  }
+
+  {
+    BlockBuilder builder(H.flow_graph(), b4);
+    ret = builder.AddReturn(new Value(phi));
+  }
+
+  H.FinishGraph();
+
+  H.flow_graph()->Canonicalize();
+
+  EXPECT(ret->value()->definition() == v0);
+}
+
 }  // namespace dart
diff --git a/runtime/vm/compiler/backend/range_analysis.cc b/runtime/vm/compiler/backend/range_analysis.cc
index 51aa420..f38dc9b2 100644
--- a/runtime/vm/compiler/backend/range_analysis.cc
+++ b/runtime/vm/compiler/backend/range_analysis.cc
@@ -316,7 +316,7 @@
 static bool AreEqualDefinitions(Definition* a, Definition* b) {
   a = UnwrapConstraint(a);
   b = UnwrapConstraint(b);
-  return (a == b) || (a->AllowsCSE() && b->AllowsCSE() && a->Equals(b));
+  return (a == b) || (a->AllowsCSE() && b->AllowsCSE() && a->Equals(*b));
 }
 
 static bool DependOnSameSymbol(const RangeBoundary& a, const RangeBoundary& b) {
@@ -2714,7 +2714,7 @@
                    RangeBoundary::FromConstant(value));
   } else {
     // Only Smi and Mint supported.
-    UNREACHABLE();
+    FATAL1("Unexpected constant: %s\n", value_.ToCString());
   }
 }
 
diff --git a/runtime/vm/compiler/backend/redundancy_elimination.cc b/runtime/vm/compiler/backend/redundancy_elimination.cc
index 6edc0f3..99176ee 100644
--- a/runtime/vm/compiler/backend/redundancy_elimination.cc
+++ b/runtime/vm/compiler/backend/redundancy_elimination.cc
@@ -434,8 +434,8 @@
         kBitsPerInt32 - 1);
   }
 
-  bool Equals(const Place* other) const {
-    return (flags_ == other->flags_) && (instance_ == other->instance_) &&
+  bool Equals(const Place& other) const {
+    return (flags_ == other.flags_) && (instance_ == other.instance_) &&
            SameField(other);
   }
 
@@ -455,10 +455,10 @@
   Place(uword flags, Definition* instance, intptr_t selector)
       : flags_(flags), instance_(instance), raw_selector_(selector), id_(0) {}
 
-  bool SameField(const Place* other) const {
+  bool SameField(const Place& other) const {
     return (kind() == kStaticField)
-               ? (static_field().Original() == other->static_field().Original())
-               : (raw_selector_ == other->raw_selector_);
+               ? (static_field().Original() == other.static_field().Original())
+               : (raw_selector_ == other.raw_selector_);
   }
 
   uword FieldHash() const {
@@ -1027,7 +1027,7 @@
       bool is_load = false, is_store;
       Place load_place(instr, &is_load, &is_store);
 
-      if (is_load && load_place.Equals(place)) {
+      if (is_load && load_place.Equals(*place)) {
         return true;
       }
     }
@@ -2554,7 +2554,7 @@
   bool CanBeCongruent(Definition* a, Definition* b) {
     return (a->tag() == b->tag()) &&
            ((a->IsPhi() && (a->GetBlock() == b->GetBlock())) ||
-            (a->AllowsCSE() && a->AttributesEqual(b)));
+            (a->AllowsCSE() && a->AttributesEqual(*b)));
   }
 
   // Given two definitions check if they are congruent under assumption that
diff --git a/runtime/vm/compiler/backend/redundancy_elimination_test.cc b/runtime/vm/compiler/backend/redundancy_elimination_test.cc
index c76394e..2556df7 100644
--- a/runtime/vm/compiler/backend/redundancy_elimination_test.cc
+++ b/runtime/vm/compiler/backend/redundancy_elimination_test.cc
@@ -695,7 +695,6 @@
   EXPECT(entry != nullptr);
 
   AllocateTypedDataInstr* alloc_typed_data = nullptr;
-  UnboxedConstantInstr* double_one = nullptr;
   StoreIndexedInstr* first_store = nullptr;
   StoreIndexedInstr* second_store = nullptr;
   LoadIndexedInstr* final_load = nullptr;
@@ -705,7 +704,6 @@
   RELEASE_ASSERT(cursor.TryMatch(
       {
           {kMatchAndMoveAllocateTypedData, &alloc_typed_data},
-          {kMatchAndMoveUnboxedConstant, &double_one},
           {kMatchAndMoveStoreIndexed, &first_store},
           {kMatchAndMoveStoreIndexed, &second_store},
           {kMatchAndMoveLoadIndexed, &final_load},
@@ -716,7 +714,6 @@
 
   EXPECT(first_store->array()->definition() == alloc_typed_data);
   EXPECT(second_store->array()->definition() == alloc_typed_data);
-  EXPECT(boxed_result->value()->definition() != double_one);
   EXPECT(boxed_result->value()->definition() == final_load);
 }
 
@@ -818,7 +815,6 @@
   EXPECT(entry != nullptr);
 
   AllocateTypedDataInstr* alloc_typed_data = nullptr;
-  UnboxedConstantInstr* double_one = nullptr;
   StoreIndexedInstr* first_store = nullptr;
   StoreIndexedInstr* second_store = nullptr;
   LoadIndexedInstr* final_load = nullptr;
@@ -832,7 +828,6 @@
           kMatchAndMoveBranchTrue,
           kMatchAndMoveBranchFalse,
           kMatchAndMoveBranchFalse,
-          {kMatchAndMoveUnboxedConstant, &double_one},
           {kMatchAndMoveStoreIndexed, &first_store},
           kMatchAndMoveBranchFalse,
           {kMatchAndMoveStoreIndexed, &second_store},
@@ -844,7 +839,6 @@
 
   EXPECT(first_store->array()->definition() == alloc_typed_data);
   EXPECT(second_store->array()->definition() == alloc_typed_data);
-  EXPECT(boxed_result->value()->definition() != double_one);
   EXPECT(boxed_result->value()->definition() == final_load);
 }
 
@@ -1156,57 +1150,47 @@
   /* Flow graph to match:
 
   4:     CheckStackOverflow:8(stack=0, loop=0)
-  6:     v590 <- UnboxedConstant(#1.0) T{_Double}
-  7:     ParallelMove DS-8 <- xmm0
-  8:     v592 <- UnboxedConstant(#2.0) T{_Double}
-  9:     ParallelMove rax <- S+2, DS-7 <- xmm1
- 10:     CheckClass:14(v2 Cids[1: _Double@0150898 etc.  cid 54])
+  6:     v590 <- UnboxedConstant(#1.0 double) T{_Double}
+  8:     v592 <- UnboxedConstant(#2.0 double) T{_Double}
+  9:     ParallelMove r0 <- S+2
+ 10:     CheckClass:14(v2 Cids[1: _Double@0150898 etc.  cid 52])
  12:     v526 <- Unbox:14(v2 T{_Double}) T{_Double}
- 14:     ParallelMove xmm3 <- xmm0
  14:     v352 <- BinaryDoubleOp:22(+, v590, v526) T{_Double}
- 15:     ParallelMove DS-6 <- xmm3
- 16:     ParallelMove xmm4 <- xmm1
+ 15:     ParallelMove DS-9 <- q3
  16:     v363 <- BinaryDoubleOp:34(+, v592, v526) T{_Double}
- 17:     ParallelMove DS-5 <- xmm4
- 18:     ParallelMove xmm2 <- xmm3
+ 17:     ParallelMove DS-7 <- q0
  18:     v21 <- BinaryDoubleOp:28(+, v352, v363) T{_Double}
- 19:     ParallelMove rbx <- C, r10 <- C, DS-4 <- xmm2
+ 19:     ParallelMove r1 <- C, r2 <- C, DS-5 <- q1
  20:     v24 <- CreateArray:30(v0, v23) T{_List}
- 21:     ParallelMove rcx <- rax
- 22:     ParallelMove S-3 <- rcx
+ 21:     ParallelMove r2 <- r0
+ 22:     ParallelMove S-3 <- r2
  22:     StoreIndexed(v24, v6, v26, NoStoreBarrier)
  24:     StoreIndexed(v24, v7, v7, NoStoreBarrier)
  26:     StoreIndexed(v24, v3, v29, NoStoreBarrier)
  28:     StoreIndexed(v24, v30, v8, NoStoreBarrier)
  30:     StoreIndexed(v24, v33, v34, NoStoreBarrier)
- 31:     ParallelMove xmm0 <- DS-8
- 32:     v582 <- Box(v590) T{_Double}
- 33:     ParallelMove rdx <- rcx, rax <- rax
- 34:     StoreIndexed(v24, v35, v582)
- 36:     StoreIndexed(v24, v38, v29, NoStoreBarrier)
- 37:     ParallelMove xmm0 <- DS-7
- 38:     v584 <- Box(v592) T{_Double}
- 39:     ParallelMove rdx <- rcx, rax <- rax
- 40:     StoreIndexed(v24, v39, v584)
- 42:     StoreIndexed(v24, v42, v43, NoStoreBarrier)
- 43:     ParallelMove xmm0 <- DS-6
- 44:     v586 <- Box(v352) T{_Double}
- 45:     ParallelMove rdx <- rcx, rax <- rax
- 46:     StoreIndexed(v24, v44, v586)
- 48:     StoreIndexed(v24, v47, v29, NoStoreBarrier)
- 49:     ParallelMove xmm0 <- DS-5
- 50:     v588 <- Box(v363) T{_Double}
- 51:     ParallelMove rdx <- rcx, rax <- rax
- 52:     StoreIndexed(v24, v48, v588)
- 54:     StoreIndexed(v24, v51, v52, NoStoreBarrier)
- 55:     ParallelMove xmm0 <- DS-4
- 56:     v580 <- Box(v21) T{_Double}
- 57:     ParallelMove rdx <- rcx, rax <- rax
- 58:     StoreIndexed(v24, v53, v580)
- 59:     ParallelMove rax <- rcx
- 60:     v54 <- StringInterpolate:44(v24) T{String}
- 61:     ParallelMove rax <- rax
- 62:     Return:48(v54)
+ 32:     StoreIndexed(v24, v35, v9, NoStoreBarrier)
+ 34:     StoreIndexed(v24, v38, v29, NoStoreBarrier)
+ 36:     StoreIndexed(v24, v39, v10, NoStoreBarrier)
+ 38:     StoreIndexed(v24, v42, v43, NoStoreBarrier)
+ 39:     ParallelMove q0 <- DS-9
+ 40:     v586 <- Box(v352) T{_Double}
+ 41:     ParallelMove r1 <- r2, r0 <- r0
+ 42:     StoreIndexed(v24, v44, v586)
+ 44:     StoreIndexed(v24, v47, v29, NoStoreBarrier)
+ 45:     ParallelMove q0 <- DS-7
+ 46:     v588 <- Box(v363) T{_Double}
+ 47:     ParallelMove r1 <- r2, r0 <- r0
+ 48:     StoreIndexed(v24, v48, v588)
+ 50:     StoreIndexed(v24, v51, v52, NoStoreBarrier)
+ 51:     ParallelMove q0 <- DS-5
+ 52:     v580 <- Box(v21) T{_Double}
+ 53:     ParallelMove r1 <- r2, r0 <- r0
+ 54:     StoreIndexed(v24, v53, v580)
+ 55:     ParallelMove r0 <- r2
+ 56:     v54 <- StringInterpolate:44(v24) T{String}
+ 57:     ParallelMove r0 <- r0
+ 58:     Return:48(v54)
 */
 
   CreateArrayInstr* create_array = nullptr;
@@ -1230,10 +1214,8 @@
       kMatchAndMoveStoreIndexed,
       kMatchAndMoveStoreIndexed,
       kMatchAndMoveStoreIndexed,
-      kMatchAndMoveBox,
       kMatchAndMoveStoreIndexed,
       kMatchAndMoveStoreIndexed,
-      kMatchAndMoveBox,
       kMatchAndMoveStoreIndexed,
       kMatchAndMoveStoreIndexed,
       kMatchAndMoveBox,
diff --git a/runtime/vm/compiler/backend/slot.cc b/runtime/vm/compiler/backend/slot.cc
index d0c4d9e..eaf30b0 100644
--- a/runtime/vm/compiler/backend/slot.cc
+++ b/runtime/vm/compiler/backend/slot.cc
@@ -380,8 +380,8 @@
   }
 }
 
-bool Slot::Equals(const Slot* other) const {
-  if (kind_ != other->kind_) {
+bool Slot::Equals(const Slot& other) const {
+  if (kind_ != other.kind_ || offset_in_bytes_ != other.offset_in_bytes_) {
     return false;
   }
 
@@ -389,18 +389,15 @@
     case Kind::kTypeArguments:
     case Kind::kTypeArgumentsIndex:
     case Kind::kArrayElement:
-      return (offset_in_bytes_ == other->offset_in_bytes_);
+      return true;
 
     case Kind::kCapturedVariable:
-      return (offset_in_bytes_ == other->offset_in_bytes_) &&
-             (flags_ == other->flags_) &&
-             (DataAs<const String>()->ptr() ==
-              other->DataAs<const String>()->ptr());
+      return (flags_ == other.flags_) && (DataAs<const String>()->ptr() ==
+                                          other.DataAs<const String>()->ptr());
 
     case Kind::kDartField:
-      return (offset_in_bytes_ == other->offset_in_bytes_) &&
-             other->DataAs<const Field>()->Original() ==
-                 DataAs<const Field>()->Original();
+      return other.DataAs<const Field>()->Original() ==
+             DataAs<const Field>()->Original();
 
     default:
       UNREACHABLE();
diff --git a/runtime/vm/compiler/backend/slot.h b/runtime/vm/compiler/backend/slot.h
index c2078b7..8dec3c8 100644
--- a/runtime/vm/compiler/backend/slot.h
+++ b/runtime/vm/compiler/backend/slot.h
@@ -264,7 +264,7 @@
     return *DataAs<const Field>();
   }
 
-  bool Equals(const Slot* other) const;
+  bool Equals(const Slot& other) const;
   uword Hash() const;
 
   bool IsIdentical(const Slot& other) const { return this == &other; }
diff --git a/runtime/vm/hash_map.h b/runtime/vm/hash_map.h
index 77a3389..2d6f6a0 100644
--- a/runtime/vm/hash_map.h
+++ b/runtime/vm/hash_map.h
@@ -466,7 +466,7 @@
 
   static inline uword Hash(Key key) { return key->Hash(); }
 
-  static inline bool IsKeyEqual(Pair kv, Key key) { return kv->Equals(key); }
+  static inline bool IsKeyEqual(Pair kv, Key key) { return kv->Equals(*key); }
 };
 
 template <typename T>
diff --git a/runtime/vm/hash_map_test.cc b/runtime/vm/hash_map_test.cc
index 6d02c08..8b5b1ba 100644
--- a/runtime/vm/hash_map_test.cc
+++ b/runtime/vm/hash_map_test.cc
@@ -12,7 +12,7 @@
  public:
   explicit TestValue(intptr_t x) : x_(x) {}
   uword Hash() const { return x_ & 1; }
-  bool Equals(TestValue* other) { return x_ == other->x_; }
+  bool Equals(const TestValue& other) { return x_ == other.x_; }
 
  private:
   intptr_t x_;
diff --git a/runtime/vm/isolate_reload.cc b/runtime/vm/isolate_reload.cc
index a5bd97f..f5cc809 100644
--- a/runtime/vm/isolate_reload.cc
+++ b/runtime/vm/isolate_reload.cc
@@ -2560,20 +2560,20 @@
 
   // Clear the direct subclasses for all classes.
   Class& cls = Class::Handle();
-  GrowableObjectArray& subclasses = GrowableObjectArray::Handle();
+  const GrowableObjectArray& null_list = GrowableObjectArray::Handle();
   for (intptr_t i = 1; i < num_cids; i++) {
     if (class_table->HasValidClassAt(i)) {
       cls = class_table->At(i);
       if (!cls.is_declaration_loaded()) {
         continue;  // Can't have any subclasses or implementors yet.
       }
-      subclasses = cls.direct_subclasses();
-      if (!subclasses.IsNull()) {
-        cls.ClearDirectSubclasses();
+      // Testing for null to prevent attempting to write to read-only classes
+      // in the VM isolate.
+      if (cls.direct_subclasses() != GrowableObjectArray::null()) {
+        cls.set_direct_subclasses(null_list);
       }
-      subclasses = cls.direct_implementors();
-      if (!subclasses.IsNull()) {
-        cls.ClearDirectImplementors();
+      if (cls.direct_implementors() != GrowableObjectArray::null()) {
+        cls.set_direct_implementors(null_list);
       }
     }
   }
diff --git a/runtime/vm/malloc_hooks.h b/runtime/vm/malloc_hooks.h
index 42b9186..2dfbb83 100644
--- a/runtime/vm/malloc_hooks.h
+++ b/runtime/vm/malloc_hooks.h
@@ -30,7 +30,9 @@
   static void set_stack_trace_collection_enabled(bool enabled);
   static void ResetStats();
   static bool Active();
-  static void PrintToJSONObject(JSONObject* jsobj);
+  static bool GetStats(intptr_t* used,
+                       intptr_t* capacity,
+                       const char** implementation);
   static Sample* GetSample(const void* ptr);
 
   static intptr_t allocation_count();
diff --git a/runtime/vm/malloc_hooks_tcmalloc.cc b/runtime/vm/malloc_hooks_tcmalloc.cc
index 787a429..443285e 100644
--- a/runtime/vm/malloc_hooks_tcmalloc.cc
+++ b/runtime/vm/malloc_hooks_tcmalloc.cc
@@ -10,6 +10,8 @@
 
 #include "gperftools/malloc_hook.h"
 
+#include <malloc.h>
+
 #include "platform/assert.h"
 #include "vm/hash_map.h"
 #include "vm/json_stream.h"
@@ -336,29 +338,14 @@
   return MallocHooksState::Active();
 }
 
-void MallocHooks::PrintToJSONObject(JSONObject* jsobj) {
-  if (!FLAG_profiler_native_memory) {
-    return;
-  }
-  intptr_t allocated_memory = 0;
-  intptr_t allocation_count = 0;
-  bool add_usage = false;
-  // AddProperty may call malloc which would result in an attempt
-  // to acquire the lock recursively so we extract the values first
-  // and then add the JSON properties.
-  {
-    MallocLocker ml(MallocHooksState::malloc_hook_mutex(),
-                    MallocHooksState::malloc_hook_mutex_owner());
-    if (MallocHooksState::Active()) {
-      allocated_memory = MallocHooksState::heap_allocated_memory_in_bytes();
-      allocation_count = MallocHooksState::allocation_count();
-      add_usage = true;
-    }
-  }
-  if (add_usage) {
-    jsobj->AddProperty("_heapAllocatedMemoryUsage", allocated_memory);
-    jsobj->AddProperty("_heapAllocationCount", allocation_count);
-  }
+bool MallocHooks::GetStats(intptr_t* used,
+                           intptr_t* capacity,
+                           const char** implementation) {
+  struct mallinfo info = mallinfo();
+  *used = info.uordblks;
+  *capacity = *used + info.fordblks;
+  *implementation = "tcmalloc";
+  return true;
 }
 
 intptr_t MallocHooks::allocation_count() {
diff --git a/runtime/vm/malloc_hooks_unsupported.cc b/runtime/vm/malloc_hooks_unsupported.cc
index b08d138..bf986dc 100644
--- a/runtime/vm/malloc_hooks_unsupported.cc
+++ b/runtime/vm/malloc_hooks_unsupported.cc
@@ -8,6 +8,24 @@
 
 #include "vm/malloc_hooks.h"
 
+#include "vm/json_stream.h"
+
+#if defined(HOST_OS_LINUX) || defined(HOST_OS_ANDROID)
+#include <malloc.h>
+#elif defined(HOST_OS_MACOS)
+#include <malloc/malloc.h>
+#endif
+
+#if !defined(HOST_OS_WINDOWS) && !defined(TARGET_OS_IOS)
+extern "C" {
+__attribute__((weak)) uintptr_t __sanitizer_get_current_allocated_bytes();
+__attribute__((weak)) uintptr_t __sanitizer_get_heap_size();
+__attribute__((weak)) int __sanitizer_install_malloc_and_free_hooks(
+    void (*malloc_hook)(const void*, uintptr_t),
+    void (*free_hook)(const void*));
+}
+#endif
+
 namespace dart {
 
 void MallocHooks::Init() {
@@ -38,8 +56,37 @@
   return false;
 }
 
-void MallocHooks::PrintToJSONObject(JSONObject* jsobj) {
-  // Do nothing.
+bool MallocHooks::GetStats(intptr_t* used,
+                           intptr_t* capacity,
+                           const char** implementation) {
+#if !defined(PRODUCT)
+#if !defined(HOST_OS_WINDOWS) && !defined(TARGET_OS_IOS)
+  if (__sanitizer_get_current_allocated_bytes != nullptr &&
+      __sanitizer_get_heap_size != nullptr) {
+    *used = __sanitizer_get_current_allocated_bytes();
+    *capacity = __sanitizer_get_heap_size();
+    *implementation = "scudo";
+    return true;
+  }
+#endif
+#if defined(HOST_OS_LINUX) || defined(HOST_OS_ANDROID)
+  struct mallinfo info = mallinfo();
+  *used = info.uordblks;
+  *capacity = *used + info.fordblks;
+  *implementation = "unknown";
+  return true;
+#elif defined(HOST_OS_MACOS)
+  struct mstats stats = mstats();
+  *used = stats.bytes_used;
+  *capacity = stats.bytes_total;
+  *implementation = "macos";
+  return true;
+#else
+  return false;
+#endif
+#else
+  return false;
+#endif
 }
 
 Sample* MallocHooks::GetSample(const void* ptr) {
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 2272cf7..08b8d07 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -5088,9 +5088,10 @@
   direct_implementors.Add(implementor, Heap::kOld);
 }
 
-void Class::ClearDirectImplementors() const {
+void Class::set_direct_implementors(
+    const GrowableObjectArray& implementors) const {
   ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
-  untag()->set_direct_implementors(GrowableObjectArray::null());
+  untag()->set_direct_implementors(implementors.ptr());
 }
 
 void Class::AddDirectSubclass(const Class& subclass) const {
@@ -5114,9 +5115,9 @@
   direct_subclasses.Add(subclass, Heap::kOld);
 }
 
-void Class::ClearDirectSubclasses() const {
+void Class::set_direct_subclasses(const GrowableObjectArray& subclasses) const {
   ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
-  untag()->set_direct_subclasses(GrowableObjectArray::null());
+  untag()->set_direct_subclasses(subclasses.ptr());
 }
 
 ArrayPtr Class::constants() const {
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index e5c69e7..9eb6bed 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -1201,8 +1201,11 @@
         IsolateGroup::Current()->program_lock()->IsCurrentThreadReader());
     return untag()->direct_implementors();
   }
+  GrowableObjectArrayPtr direct_implementors_unsafe() const {
+    return untag()->direct_implementors();
+  }
+  void set_direct_implementors(const GrowableObjectArray& implementors) const;
   void AddDirectImplementor(const Class& subclass, bool is_mixin) const;
-  void ClearDirectImplementors() const;
 
   // Returns the list of classes having this class as direct superclass.
   GrowableObjectArrayPtr direct_subclasses() const {
@@ -1213,8 +1216,8 @@
   GrowableObjectArrayPtr direct_subclasses_unsafe() const {
     return untag()->direct_subclasses();
   }
+  void set_direct_subclasses(const GrowableObjectArray& subclasses) const;
   void AddDirectSubclass(const Class& subclass) const;
-  void ClearDirectSubclasses() const;
 
   // Check if this class represents the class of null.
   bool IsNullClass() const { return id() == kNullCid; }
@@ -5741,6 +5744,7 @@
         raw->untag()->flags_and_size_);
   }
 
+  // Methods to allow use with PointerKeyValueTrait to create sets of CSMs.
   bool Equals(const CompressedStackMaps& other) const {
     // All of the table flags and payload size must match.
     if (untag()->flags_and_size_ != other.untag()->flags_and_size_) {
@@ -5749,9 +5753,6 @@
     NoSafepointScope no_safepoint;
     return memcmp(untag(), other.untag(), InstanceSize(payload_size())) == 0;
   }
-
-  // Methods to allow use with PointerKeyValueTrait to create sets of CSMs.
-  bool Equals(const CompressedStackMaps* other) const { return Equals(*other); }
   uword Hash() const;
 
   static intptr_t HeaderSize() { return sizeof(UntaggedCompressedStackMaps); }
diff --git a/runtime/vm/program_visitor.cc b/runtime/vm/program_visitor.cc
index 2e4bb01..c5a7965 100644
--- a/runtime/vm/program_visitor.cc
+++ b/runtime/vm/program_visitor.cc
@@ -485,16 +485,16 @@
     return hash_;
   }
 
-  bool Equals(const StackMapEntry* other) const {
-    if (spill_slot_bit_count_ != other->spill_slot_bit_count_ ||
-        non_spill_slot_bit_count_ != other->non_spill_slot_bit_count_) {
+  bool Equals(const StackMapEntry& other) const {
+    if (spill_slot_bit_count_ != other.spill_slot_bit_count_ ||
+        non_spill_slot_bit_count_ != other.non_spill_slot_bit_count_) {
       return false;
     }
     // Since we ensure that bits in the payload that are not part of the
     // actual stackmap data are cleared, we can just compare payloads by byte
     // instead of calling IsObject for each bit.
     NoSafepointScope scope;
-    return memcmp(PayloadData(), other->PayloadData(), PayloadLength()) == 0;
+    return memcmp(PayloadData(), other.PayloadData(), PayloadLength()) == 0;
   }
 
   // Encodes this StackMapEntry to the given array of bytes and returns the
@@ -556,7 +556,7 @@
   static Key KeyOf(Pair kv) { return kv.key; }
   static Value ValueOf(Pair kv) { return kv.value; }
   static uword Hash(Key key) { return key->Hash(); }
-  static bool IsKeyEqual(Pair kv, Key key) { return key->Equals(kv.key); }
+  static bool IsKeyEqual(Pair kv, Key key) { return key->Equals(*kv.key); }
 };
 
 typedef DirectChainedHashMap<StackMapEntryKeyIntValueTrait> StackMapEntryIntMap;
@@ -938,6 +938,68 @@
     WalkProgram(zone, isolate_group, &deduper);
   }
 }
+
+void ProgramVisitor::PruneSubclasses(Zone* zone, IsolateGroup* isolate_group) {
+  class PruneSubclassesVisitor : public ClassVisitor {
+   public:
+    explicit PruneSubclassesVisitor(Zone* zone)
+        : ClassVisitor(),
+          old_implementors_(GrowableObjectArray::Handle(zone)),
+          new_implementors_(GrowableObjectArray::Handle(zone)),
+          implementor_(Class::Handle(zone)),
+          old_subclasses_(GrowableObjectArray::Handle(zone)),
+          new_subclasses_(GrowableObjectArray::Handle(zone)),
+          subclass_(Class::Handle(zone)),
+          null_list_(GrowableObjectArray::Handle(zone)) {}
+
+    void VisitClass(const Class& klass) {
+      old_implementors_ = klass.direct_implementors_unsafe();
+      if (!old_implementors_.IsNull()) {
+        new_implementors_ = GrowableObjectArray::New();
+        for (intptr_t i = 0; i < old_implementors_.Length(); i++) {
+          implementor_ ^= old_implementors_.At(i);
+          if (implementor_.id() != kIllegalCid) {
+            new_implementors_.Add(implementor_);
+          }
+        }
+        if (new_implementors_.Length() == 0) {
+          klass.set_direct_implementors(null_list_);
+        } else {
+          klass.set_direct_implementors(new_implementors_);
+        }
+      }
+
+      old_subclasses_ = klass.direct_subclasses_unsafe();
+      if (!old_subclasses_.IsNull()) {
+        new_subclasses_ = GrowableObjectArray::New();
+        for (intptr_t i = 0; i < old_subclasses_.Length(); i++) {
+          subclass_ ^= old_subclasses_.At(i);
+          if (subclass_.id() != kIllegalCid) {
+            new_subclasses_.Add(subclass_);
+          }
+        }
+        if (new_subclasses_.Length() == 0) {
+          klass.set_direct_subclasses(null_list_);
+        } else {
+          klass.set_direct_subclasses(new_subclasses_);
+        }
+      }
+    }
+
+   private:
+    GrowableObjectArray& old_implementors_;
+    GrowableObjectArray& new_implementors_;
+    Class& implementor_;
+    GrowableObjectArray& old_subclasses_;
+    GrowableObjectArray& new_subclasses_;
+    Class& subclass_;
+    GrowableObjectArray& null_list_;
+  };
+
+  PruneSubclassesVisitor visitor(zone);
+  SafepointWriteRwLocker ml(Thread::Current(), isolate_group->program_lock());
+  WalkProgram(zone, isolate_group, &visitor);
+}
 #endif  // defined(DART_PRECOMPILER)
 
 class CodeSourceMapKeyValueTrait {
@@ -1304,6 +1366,7 @@
 #if defined(DART_PRECOMPILER)
   DedupCatchEntryMovesMaps(zone, isolate_group);
   DedupUnlinkedCalls(zone, isolate_group);
+  PruneSubclasses(zone, isolate_group);
 #endif
   DedupCodeSourceMaps(zone, isolate_group);
   DedupLists(zone, isolate_group);
diff --git a/runtime/vm/program_visitor.h b/runtime/vm/program_visitor.h
index 06aa481..b310625 100644
--- a/runtime/vm/program_visitor.h
+++ b/runtime/vm/program_visitor.h
@@ -114,6 +114,7 @@
 #if defined(DART_PRECOMPILER)
   static void DedupCatchEntryMovesMaps(Zone* zone, IsolateGroup* isolate_group);
   static void DedupUnlinkedCalls(Zone* zone, IsolateGroup* isolate_group);
+  static void PruneSubclasses(Zone* zone, IsolateGroup* isolate_group);
 #endif
   static void DedupCodeSourceMaps(Zone* zone, IsolateGroup* isolate_group);
   static void DedupLists(Zone* zone, IsolateGroup* isolate_group);
diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h
index 4163c3e..7753a7a 100644
--- a/runtime/vm/raw_object.h
+++ b/runtime/vm/raw_object.h
@@ -934,7 +934,9 @@
   CompressedObjectPtr* to_snapshot(Snapshot::Kind kind) {
     switch (kind) {
       case Snapshot::kFullAOT:
+#if defined(PRODUCT)
         return reinterpret_cast<CompressedObjectPtr*>(&allocation_stub_);
+#endif
       case Snapshot::kFull:
       case Snapshot::kFullCore:
         return reinterpret_cast<CompressedObjectPtr*>(&direct_subclasses_);
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index 8e91315..73cd2e5 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -3109,23 +3109,72 @@
   return true;
 }
 
+static void MarkClasses(const Class& root,
+                        bool include_subclasses,
+                        bool include_implementors) {
+  Thread* thread = Thread::Current();
+  HANDLESCOPE(thread);
+  SharedClassTable* table = thread->isolate()->group()->shared_class_table();
+  GrowableArray<const Class*> worklist;
+  table->SetCollectInstancesFor(root.id(), true);
+  worklist.Add(&root);
+  GrowableObjectArray& subclasses = GrowableObjectArray::Handle();
+  GrowableObjectArray& implementors = GrowableObjectArray::Handle();
+  while (!worklist.is_empty()) {
+    const Class& cls = *worklist.RemoveLast();
+    // All subclasses are implementors, but they are not included in
+    // `direct_implementors`.
+    if (include_subclasses || include_implementors) {
+      subclasses = cls.direct_subclasses_unsafe();
+      if (!subclasses.IsNull()) {
+        for (intptr_t j = 0; j < subclasses.Length(); j++) {
+          Class& subclass = Class::Handle();
+          subclass ^= subclasses.At(j);
+          if (!table->CollectInstancesFor(subclass.id())) {
+            table->SetCollectInstancesFor(subclass.id(), true);
+            worklist.Add(&subclass);
+          }
+        }
+      }
+    }
+    if (include_implementors) {
+      implementors = cls.direct_implementors_unsafe();
+      if (!implementors.IsNull()) {
+        for (intptr_t j = 0; j < implementors.Length(); j++) {
+          Class& implementor = Class::Handle();
+          implementor ^= implementors.At(j);
+          if (!table->CollectInstancesFor(implementor.id())) {
+            table->SetCollectInstancesFor(implementor.id(), true);
+            worklist.Add(&implementor);
+          }
+        }
+      }
+    }
+  }
+}
+
+static void UnmarkClasses() {
+  SharedClassTable* table = IsolateGroup::Current()->shared_class_table();
+  for (intptr_t i = 1; i < table->NumCids(); i++) {
+    table->SetCollectInstancesFor(i, false);
+  }
+}
+
 class GetInstancesVisitor : public ObjectGraph::Visitor {
  public:
-  GetInstancesVisitor(const Class& cls,
-                      ZoneGrowableHandlePtrArray<Object>* storage,
+  GetInstancesVisitor(ZoneGrowableHandlePtrArray<Object>* storage,
                       intptr_t limit)
-      : cls_(cls), storage_(storage), limit_(limit), count_(0) {}
+      : table_(IsolateGroup::Current()->shared_class_table()),
+        storage_(storage),
+        limit_(limit),
+        count_(0) {}
 
   virtual Direction VisitObject(ObjectGraph::StackIterator* it) {
     ObjectPtr raw_obj = it->Get();
     if (raw_obj->IsPseudoObject()) {
       return kProceed;
     }
-    Thread* thread = Thread::Current();
-    REUSABLE_OBJECT_HANDLESCOPE(thread);
-    Object& obj = thread->ObjectHandle();
-    obj = raw_obj;
-    if (obj.GetClassId() == cls_.id()) {
+    if (table_->CollectInstancesFor(raw_obj->GetClassId())) {
       if (count_ < limit_) {
         storage_->Add(Object::Handle(raw_obj));
       }
@@ -3137,7 +3186,7 @@
   intptr_t count() const { return count_; }
 
  private:
-  const Class& cls_;
+  SharedClassTable* const table_;
   ZoneGrowableHandlePtrArray<Object>* storage_;
   const intptr_t limit_;
   intptr_t count_;
@@ -3177,11 +3226,13 @@
   HANDLESCOPE(thread);
 
   ZoneGrowableHandlePtrArray<Object> storage(thread->zone(), limit);
-  GetInstancesVisitor visitor(cls, &storage, limit);
+  GetInstancesVisitor visitor(&storage, limit);
   {
     ObjectGraph graph(thread);
     HeapIterationScope iteration_scope(Thread::Current(), true);
+    MarkClasses(cls, false, false);
     graph.IterateObjects(&visitor);
+    UnmarkClasses();
   }
   intptr_t count = visitor.count();
   JSONObject jsobj(js);
@@ -3196,6 +3247,55 @@
   return true;
 }
 
+static const MethodParameter* get_instances_as_array_params[] = {
+    RUNNABLE_ISOLATE_PARAMETER,
+    NULL,
+};
+
+static bool GetInstancesAsArray(Thread* thread, JSONStream* js) {
+  const char* object_id = js->LookupParam("objectId");
+  if (object_id == NULL) {
+    PrintMissingParamError(js, "objectId");
+    return true;
+  }
+
+  bool include_subclasses =
+      BoolParameter::Parse(js->LookupParam("includeSubclasses"), false);
+  bool include_implementors =
+      BoolParameter::Parse(js->LookupParam("includeImplementors"), false);
+
+  const Object& obj = Object::Handle(LookupHeapObject(thread, object_id, NULL));
+  if (obj.ptr() == Object::sentinel().ptr() || !obj.IsClass()) {
+    PrintInvalidParamError(js, "objectId");
+    return true;
+  }
+  const Class& cls = Class::Cast(obj);
+
+  // Ensure the array and handles created below are promptly destroyed.
+  Array& instances = Array::Handle();
+  {
+    StackZone zone(thread);
+    HANDLESCOPE(thread);
+
+    ZoneGrowableHandlePtrArray<Object> storage(thread->zone(), 1024);
+    GetInstancesVisitor visitor(&storage, kSmiMax);
+    {
+      ObjectGraph graph(thread);
+      HeapIterationScope iteration_scope(Thread::Current(), true);
+      MarkClasses(cls, include_subclasses, include_implementors);
+      graph.IterateObjects(&visitor);
+      UnmarkClasses();
+    }
+    intptr_t count = visitor.count();
+    instances = Array::New(count);
+    for (intptr_t i = 0; i < count; i++) {
+      instances.SetAt(i, storage.At(i));
+    }
+  }
+  instances.PrintJSON(js, /* as_ref */ true);
+  return true;
+}
+
 static const MethodParameter* get_ports_params[] = {
     RUNNABLE_ISOLATE_PARAMETER,
     NULL,
@@ -4229,94 +4329,122 @@
   rss.AddProperty64("size", Service::CurrentRSS());
   JSONArray rss_children(&rss, "children");
 
-  JSONObject vm(&rss_children);
   intptr_t vm_size = 0;
   {
-    JSONArray vm_children(&vm, "children");
+    JSONObject vm(&rss_children);
+    {
+      JSONArray vm_children(&vm, "children");
+
+      {
+        JSONObject profiler(&vm_children);
+        profiler.AddProperty("name", "Profiler");
+        profiler.AddProperty("description",
+                             "Samples from the Dart VM's profiler");
+        intptr_t size = Profiler::Size();
+        vm_size += size;
+        profiler.AddProperty64("size", size);
+        JSONArray(&profiler, "children");
+      }
+
+      {
+        JSONObject timeline(&vm_children);
+        timeline.AddProperty("name", "Timeline");
+        timeline.AddProperty(
+            "description",
+            "Timeline events from dart:developer and Dart_TimelineEvent");
+        intptr_t size = Timeline::recorder()->Size();
+        vm_size += size;
+        timeline.AddProperty64("size", size);
+        JSONArray(&timeline, "children");
+      }
+
+      {
+        JSONObject zone(&vm_children);
+        zone.AddProperty("name", "Zone");
+        zone.AddProperty("description", "Arena allocation in the Dart VM");
+        intptr_t size = Zone::Size();
+        vm_size += size;
+        zone.AddProperty64("size", size);
+        JSONArray(&zone, "children");
+      }
+
+      {
+        JSONObject semi(&vm_children);
+        semi.AddProperty("name", "SemiSpace Cache");
+        semi.AddProperty("description", "Cached heap regions");
+        intptr_t size = SemiSpace::CachedSize();
+        vm_size += size;
+        semi.AddProperty64("size", size);
+        JSONArray(&semi, "children");
+      }
+
+      IsolateGroup::ForEach([&vm_children,
+                             &vm_size](IsolateGroup* isolate_group) {
+        // Note: new_space()->CapacityInWords() includes memory that hasn't been
+        // allocated from the OS yet.
+        int64_t capacity =
+            (isolate_group->heap()->new_space()->UsedInWords() +
+             isolate_group->heap()->old_space()->CapacityInWords()) *
+            kWordSize;
+        int64_t used = isolate_group->heap()->TotalUsedInWords() * kWordSize;
+        int64_t free = capacity - used;
+
+        JSONObject group(&vm_children);
+        group.AddPropertyF("name", "IsolateGroup %s",
+                           isolate_group->source()->name);
+        group.AddProperty("description", "Dart heap capacity");
+        vm_size += capacity;
+        group.AddProperty64("size", capacity);
+        JSONArray group_children(&group, "children");
+
+        {
+          JSONObject jsused(&group_children);
+          jsused.AddProperty("name", "Used");
+          jsused.AddProperty("description", "");
+          jsused.AddProperty64("size", used);
+          JSONArray(&jsused, "children");
+        }
+
+        {
+          JSONObject jsfree(&group_children);
+          jsfree.AddProperty("name", "Free");
+          jsfree.AddProperty("description", "");
+          jsfree.AddProperty64("size", free);
+          JSONArray(&jsfree, "children");
+        }
+      });
+    }  // vm_children
+
+    vm.AddProperty("name", "Dart VM");
+    vm.AddProperty("description", "");
+    vm.AddProperty64("size", vm_size);
+  }
+
+  intptr_t used, capacity;
+  const char* implementation;
+  if (MallocHooks::GetStats(&used, &capacity, &implementation)) {
+    JSONObject malloc(&rss_children);
+    malloc.AddPropertyF("name", "Malloc (%s)", implementation);
+    malloc.AddProperty("description", "");
+    malloc.AddProperty64("size", capacity);
+    JSONArray malloc_children(&malloc, "children");
 
     {
-      JSONObject profiler(&vm_children);
-      profiler.AddProperty("name", "Profiler");
-      profiler.AddProperty("description",
-                           "Samples from the Dart VM's profiler");
-      intptr_t size = Profiler::Size();
-      vm_size += size;
-      profiler.AddProperty64("size", size);
-      JSONArray(&profiler, "children");
+      JSONObject malloc_used(&malloc_children);
+      malloc_used.AddProperty("name", "Used");
+      malloc_used.AddProperty("description", "");
+      malloc_used.AddProperty64("size", used);
+      JSONArray(&malloc_used, "children");
     }
 
     {
-      JSONObject timeline(&vm_children);
-      timeline.AddProperty("name", "Timeline");
-      timeline.AddProperty(
-          "description",
-          "Timeline events from dart:developer and Dart_TimelineEvent");
-      intptr_t size = Timeline::recorder()->Size();
-      vm_size += size;
-      timeline.AddProperty64("size", size);
-      JSONArray(&timeline, "children");
+      JSONObject malloc_free(&malloc_children);
+      malloc_free.AddProperty("name", "Free");
+      malloc_free.AddProperty("description", "");
+      malloc_free.AddProperty64("size", capacity - used);
+      JSONArray(&malloc_free, "children");
     }
-
-    {
-      JSONObject zone(&vm_children);
-      zone.AddProperty("name", "Zone");
-      zone.AddProperty("description", "Arena allocation in the Dart VM");
-      intptr_t size = Zone::Size();
-      vm_size += size;
-      zone.AddProperty64("size", size);
-      JSONArray(&zone, "children");
-    }
-
-    {
-      JSONObject semi(&vm_children);
-      semi.AddProperty("name", "SemiSpace Cache");
-      semi.AddProperty("description", "Cached heap regions");
-      intptr_t size = SemiSpace::CachedSize();
-      vm_size += size;
-      semi.AddProperty64("size", size);
-      JSONArray(&semi, "children");
-    }
-
-    IsolateGroup::ForEach(
-        [&vm_children, &vm_size](IsolateGroup* isolate_group) {
-          // Note: new_space()->CapacityInWords() includes memory that hasn't
-          // been allocated from the OS yet.
-          int64_t capacity =
-              (isolate_group->heap()->new_space()->UsedInWords() +
-               isolate_group->heap()->old_space()->CapacityInWords()) *
-              kWordSize;
-          int64_t used = isolate_group->heap()->TotalUsedInWords() * kWordSize;
-          int64_t free = capacity - used;
-
-          JSONObject group(&vm_children);
-          group.AddPropertyF("name", "IsolateGroup %s",
-                             isolate_group->source()->name);
-          group.AddProperty("description", "Dart heap capacity");
-          vm_size += capacity;
-          group.AddProperty64("size", capacity);
-          JSONArray group_children(&group, "children");
-
-          {
-            JSONObject jsused(&group_children);
-            jsused.AddProperty("name", "Used");
-            jsused.AddProperty("description", "");
-            jsused.AddProperty64("size", used);
-            JSONArray(&jsused, "children");
-          }
-
-          {
-            JSONObject jsfree(&group_children);
-            jsfree.AddProperty("name", "Free");
-            jsfree.AddProperty("description", "");
-            jsfree.AddProperty64("size", free);
-            JSONArray(&jsfree, "children");
-          }
-        });
-  }  // vm_children
-
-  vm.AddProperty("name", "Dart VM");
-  vm.AddProperty("description", "");
-  vm.AddProperty64("size", vm_size);
+  }
 
   return vm_size;
 }
@@ -4748,7 +4876,15 @@
   jsobj.AddProperty64("pid", OS::ProcessId());
   jsobj.AddPropertyTimeMillis(
       "startTime", OS::GetCurrentTimeMillis() - Dart::UptimeMillis());
-  MallocHooks::PrintToJSONObject(&jsobj);
+  {
+    intptr_t used, capacity;
+    const char* implementation;
+    if (MallocHooks::GetStats(&used, &capacity, &implementation)) {
+      jsobj.AddProperty("_mallocUsed", used);
+      jsobj.AddProperty("_mallocCapacity", capacity);
+      jsobj.AddProperty("_mallocImplementation", implementation);
+    }
+  }
   PrintJSONForEmbedderInformation(&jsobj);
   // Construct the isolate and isolate_groups list.
   {
@@ -5176,6 +5312,8 @@
     get_inbound_references_params },
   { "getInstances", GetInstances,
     get_instances_params },
+  { "_getInstancesAsArray", GetInstancesAsArray,
+    get_instances_as_array_params },
   { "getPorts", GetPorts,
     get_ports_params },
   { "getIsolate", GetIsolate,
diff --git a/tests/language/const_functions/const_functions_list_error_test.dart b/tests/language/const_functions/const_functions_list_error_test.dart
new file mode 100644
index 0000000..64a05e7
--- /dev/null
+++ b/tests/language/const_functions/const_functions_list_error_test.dart
@@ -0,0 +1,56 @@
+// 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.
+
+// Tests erroneous list usage with const functions.
+
+// SharedOptions=--enable-experiment=const-functions
+
+import "package:expect/expect.dart";
+
+const firstException = firstExceptionFn();
+//                     ^^^^^^^^^^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
+// [cfe] Constant evaluation error:
+int firstExceptionFn() {
+  const List<int> x = [];
+  return x.first;
+}
+
+const lastException = lastExceptionFn();
+//                    ^^^^^^^^^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
+// [cfe] Constant evaluation error:
+int lastExceptionFn() {
+  const List<int> x = [];
+  return x.last;
+}
+
+const singleException = singleExceptionFn();
+//                      ^^^^^^^^^^^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
+// [cfe] Constant evaluation error:
+int singleExceptionFn() {
+  const List<int> x = [];
+  return x.single;
+}
+
+const singleExceptionMulti = singleExceptionMultiFn();
+//                           ^^^^^^^^^^^^^^^^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
+// [cfe] Constant evaluation error:
+int singleExceptionMultiFn() {
+  const List<int> x = [1, 2];
+  return x.single;
+}
+
+const invalidProperty = invalidPropertyFn();
+//                      ^^^^^^^^^^^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
+int invalidPropertyFn() {
+  const List<int> x = [1, 2];
+  return x.invalidProperty;
+  //       ^^^^^^^^^^^^^^^
+  // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER
+  // [cfe] The getter 'invalidProperty' isn't defined for the class 'List<int>'.
+}
diff --git a/tests/language/const_functions/const_functions_list_test.dart b/tests/language/const_functions/const_functions_list_test.dart
new file mode 100644
index 0000000..0810d57
--- /dev/null
+++ b/tests/language/const_functions/const_functions_list_test.dart
@@ -0,0 +1,153 @@
+// 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.
+
+// Tests lists with const functions.
+
+// SharedOptions=--enable-experiment=const-functions
+
+import "package:expect/expect.dart";
+
+const firstVar = firstFn();
+//               ^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
+// [web] Constant evaluation error:
+int firstFn() {
+  const List<int> x = [1, 2];
+  return x.first;
+}
+
+const firstCatchVar = firstCatchFn();
+//                    ^^^^^^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
+// [web] Constant evaluation error:
+int firstCatchFn() {
+  try {
+    const List<int> x = [];
+    var v = x.first;
+  } on StateError {
+    return 0;
+  }
+  return 1;
+}
+
+const hashCodeVar = hashCodeFn();
+//                  ^^^^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
+// [web] Constant evaluation error:
+int hashCodeFn() {
+  const List<int> x = [1, 2];
+  return x.hashCode;
+}
+
+const isEmptyVar = isEmptyFn();
+//                 ^^^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
+// [web] Constant evaluation error:
+bool isEmptyFn() {
+  const List<int> x = [1, 2];
+  return x.isEmpty;
+}
+
+const isNotEmptyVar = isNotEmptyFn();
+//                    ^^^^^^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
+// [web] Constant evaluation error:
+bool isNotEmptyFn() {
+  const List<int> x = [1, 2];
+  return x.isNotEmpty;
+}
+
+const lastVar = lastFn();
+//              ^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
+// [web] Constant evaluation error:
+int lastFn() {
+  const List<int> x = [1, 2];
+  return x.last;
+}
+
+const lastCatchVar = lastCatchFn();
+//                   ^^^^^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
+// [web] Constant evaluation error:
+int lastCatchFn() {
+  try {
+    const List<int> x = [];
+    var v = x.last;
+  } on StateError {
+    return 0;
+  }
+  return 1;
+}
+
+const lengthVar = lengthFn();
+//                ^^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
+// [web] Constant evaluation error:
+int lengthFn() {
+  const List<int> x = [1, 2];
+  return x.length;
+}
+
+const singleVar = singleFn();
+//                ^^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
+// [web] Constant evaluation error:
+int singleFn() {
+  const List<int> x = [1];
+  return x.single;
+}
+
+const singleCatchVar = singleCatchFn();
+//                     ^^^^^^^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
+// [web] Constant evaluation error:
+int singleCatchFn() {
+  try {
+    const List<int> x = [];
+    var v = x.single;
+  } on StateError {
+    return 0;
+  }
+  return 1;
+}
+
+const singleCatchVar2 = singleCatchFn2();
+//                      ^^^^^^^^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
+// [web] Constant evaluation error:
+int singleCatchFn2() {
+  try {
+    const List<int> x = [1, 2];
+    var v = x.single;
+  } on StateError {
+    return 0;
+  }
+  return 1;
+}
+
+const typeExample = int;
+const typeVar = typeFn();
+//              ^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
+// [web] Constant evaluation error:
+Type typeFn() {
+  const List<int> x = [1, 2];
+  return x.runtimeType;
+}
+
+void main() {
+  Expect.equals(firstVar, 1);
+  Expect.equals(firstCatchVar, 0);
+  Expect.type<int>(hashCodeVar);
+  Expect.equals(isEmptyVar, false);
+  Expect.equals(isNotEmptyVar, true);
+  Expect.equals(lastVar, 2);
+  Expect.equals(lastCatchVar, 0);
+  Expect.equals(lengthVar, 2);
+  Expect.equals(singleVar, 1);
+  Expect.equals(singleCatchVar, 0);
+  Expect.equals(singleCatchVar2, 0);
+  Expect.equals(typeVar, int);
+}
diff --git a/tests/language/vm/regress_45674_test.dart b/tests/language/vm/regress_45674_test.dart
new file mode 100644
index 0000000..9ae6128
--- /dev/null
+++ b/tests/language/vm/regress_45674_test.dart
@@ -0,0 +1,35 @@
+// Copyright (c) 2021, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "package:expect/expect.dart";
+
+// Reduced from
+
+// The Dart Project Fuzz Tester (1.89).
+// Program generated as:
+//   dart dartfuzz.dart --seed 3586617624 --no-fp --no-ffi --flat
+
+import 'dart:typed_data';
+
+Int32x4List var14 = Int32x4List(5);
+Map<bool, int> var58 = {false: -5, true: -16, false: 22};
+
+bool foo3_Extension1() {
+  try {
+    print(var14[((Int32x4.wyxw as int) >> var58[true]!)]);
+    return true;
+  } catch (e) {
+    return false;
+  }
+}
+
+main() {
+  var r;
+  try {
+    r = foo3_Extension1();
+  } catch (e) {
+    Expect.fail("Exception should have been caught sooner");
+  }
+  Expect.equals(false, r);
+}
diff --git a/tests/language_2/vm/regress_45674_test.dart b/tests/language_2/vm/regress_45674_test.dart
new file mode 100644
index 0000000..bbfc20a
--- /dev/null
+++ b/tests/language_2/vm/regress_45674_test.dart
@@ -0,0 +1,35 @@
+// Copyright (c) 2021, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "package:expect/expect.dart";
+
+// Reduced from
+
+// The Dart Project Fuzz Tester (1.89).
+// Program generated as:
+//   dart dartfuzz.dart --seed 3586617624 --no-fp --no-ffi --flat
+
+import 'dart:typed_data';
+
+Int32x4List var14 = Int32x4List(5);
+Map<bool, int> var58 = {false: -5, true: -16, false: 22};
+
+bool foo3_Extension1() {
+  try {
+    print(var14[((Int32x4.wyxw as int) >> var58[true])]);
+    return true;
+  } catch (e) {
+    return false;
+  }
+}
+
+main() {
+  var r;
+  try {
+    r = foo3_Extension1();
+  } catch (e) {
+    Expect.fail("Exception should have been caught sooner");
+  }
+  Expect.equals(false, r);
+}
diff --git a/tools/VERSION b/tools/VERSION
index e26d75d..ce86f3f 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
 MAJOR 2
 MINOR 14
 PATCH 0
-PRERELEASE 4
+PRERELEASE 5
 PRERELEASE_PATCH 0
\ No newline at end of file