[ VM / Service ] Remove required from constructor params
The required keyword means that adding a field to a class is a breaking
change, and needs a major version bump instead of a minor one. All the
fields are already nullable, and the constructors all use named
parameters, so removing this keyword is a minor (non-breaking) change.
Bug: https://github.com/dart-lang/coverage/pull/412
Bug: https://buganizer.corp.google.com/issues/236964692
Change-Id: I410d0f4359c003696570dfb11e3e2f7f179fb9ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251443
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
diff --git a/pkg/vm_service/CHANGELOG.md b/pkg/vm_service/CHANGELOG.md
index 5de2a68..727e2cd 100644
--- a/pkg/vm_service/CHANGELOG.md
+++ b/pkg/vm_service/CHANGELOG.md
@@ -1,5 +1,9 @@
# Changelog
+## 9.1.0
+- Remove `required` keyword from most of the named parameters in the
+ constructors of the Dart API objects.
+
## 9.0.0
- Update to version `3.58` of the spec.
- Added optional `local` parameter to `lookupResolvedPackageUris` RPC.
diff --git a/pkg/vm_service/lib/src/vm_service.dart b/pkg/vm_service/lib/src/vm_service.dart
index 7d79815..1533b40 100644
--- a/pkg/vm_service/lib/src/vm_service.dart
+++ b/pkg/vm_service/lib/src/vm_service.dart
@@ -2845,8 +2845,8 @@
int? dateLastServiceGC;
AllocationProfile({
- required this.members,
- required this.memoryUsage,
+ this.members,
+ this.memoryUsage,
this.dateLastAccumulatorReset,
this.dateLastServiceGC,
});
@@ -2906,8 +2906,8 @@
dynamic value;
BoundField({
- required this.decl,
- required this.value,
+ this.decl,
+ this.value,
});
BoundField._fromJson(Map<String, dynamic> json) {
@@ -2959,11 +2959,11 @@
int? scopeEndTokenPos;
BoundVariable({
- required this.name,
- required this.value,
- required this.declarationTokenPos,
- required this.scopeStartTokenPos,
- required this.scopeEndTokenPos,
+ this.name,
+ this.value,
+ this.declarationTokenPos,
+ this.scopeStartTokenPos,
+ this.scopeEndTokenPos,
});
BoundVariable._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
@@ -3028,10 +3028,10 @@
dynamic location;
Breakpoint({
- required this.breakpointNumber,
- required this.enabled,
- required this.resolved,
- required this.location,
+ this.breakpointNumber,
+ this.enabled,
+ this.resolved,
+ this.location,
required String id,
this.isSyntheticAsyncContinuation,
}) : super(
@@ -3096,8 +3096,8 @@
List<InstanceRef>? typeParameters;
ClassRef({
- required this.name,
- required this.library,
+ this.name,
+ this.library,
required String id,
this.location,
this.typeParameters,
@@ -3209,15 +3209,15 @@
List<ClassRef>? subclasses;
Class({
- required this.name,
- required this.library,
- required this.isAbstract,
- required this.isConst,
- required this.traceAllocations,
- required this.interfaces,
- required this.fields,
- required this.functions,
- required this.subclasses,
+ this.name,
+ this.library,
+ this.isAbstract,
+ this.isConst,
+ this.traceAllocations,
+ this.interfaces,
+ this.fields,
+ this.functions,
+ this.subclasses,
required String id,
this.location,
this.typeParameters,
@@ -3321,11 +3321,11 @@
int? instancesCurrent;
ClassHeapStats({
- required this.classRef,
- required this.accumulatedSize,
- required this.bytesCurrent,
- required this.instancesAccumulated,
- required this.instancesCurrent,
+ this.classRef,
+ this.accumulatedSize,
+ this.bytesCurrent,
+ this.instancesAccumulated,
+ this.instancesCurrent,
});
ClassHeapStats._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
@@ -3366,7 +3366,7 @@
List<ClassRef>? classes;
ClassList({
- required this.classes,
+ this.classes,
});
ClassList._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
@@ -3403,8 +3403,8 @@
/*CodeKind*/ String? kind;
CodeRef({
- required this.name,
- required this.kind,
+ this.name,
+ this.kind,
required String id,
}) : super(
id: id,
@@ -3448,8 +3448,8 @@
/*CodeKind*/ String? kind;
Code({
- required this.name,
- required this.kind,
+ this.name,
+ this.kind,
required String id,
}) : super(
id: id,
@@ -3489,7 +3489,7 @@
int? length;
ContextRef({
- required this.length,
+ this.length,
required String id,
}) : super(
id: id,
@@ -3536,8 +3536,8 @@
List<ContextElement>? variables;
Context({
- required this.length,
- required this.variables,
+ this.length,
+ this.variables,
required String id,
this.parent,
}) : super(
@@ -3585,7 +3585,7 @@
dynamic value;
ContextElement({
- required this.value,
+ this.value,
});
ContextElement._fromJson(Map<String, dynamic> json) {
@@ -3637,8 +3637,8 @@
int? pid;
/// A list of functions seen in the relevant samples. These references can be
- /// looked up using the indicies provided in a `CpuSample` `stack` to
- /// determine which function was on the stack.
+ /// looked up using the indices provided in a `CpuSample` `stack` to determine
+ /// which function was on the stack.
List<ProfileFunction>? functions;
/// A list of samples collected in the range `[timeOriginMicros,
@@ -3646,15 +3646,15 @@
List<CpuSample>? samples;
CpuSamples({
- required this.samplePeriod,
- required this.maxStackDepth,
- required this.sampleCount,
- required this.timeSpan,
- required this.timeOriginMicros,
- required this.timeExtentMicros,
- required this.pid,
- required this.functions,
- required this.samples,
+ this.samplePeriod,
+ this.maxStackDepth,
+ this.sampleCount,
+ this.timeSpan,
+ this.timeOriginMicros,
+ this.timeExtentMicros,
+ this.pid,
+ this.functions,
+ this.samples,
});
CpuSamples._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
@@ -3738,15 +3738,15 @@
List<CpuSample>? samples;
CpuSamplesEvent({
- required this.samplePeriod,
- required this.maxStackDepth,
- required this.sampleCount,
- required this.timeSpan,
- required this.timeOriginMicros,
- required this.timeExtentMicros,
- required this.pid,
- required this.functions,
- required this.samples,
+ this.samplePeriod,
+ this.maxStackDepth,
+ this.sampleCount,
+ this.timeSpan,
+ this.timeOriginMicros,
+ this.timeExtentMicros,
+ this.pid,
+ this.functions,
+ this.samples,
});
CpuSamplesEvent._fromJson(Map<String, dynamic> json) {
@@ -3833,9 +3833,9 @@
int? classId;
CpuSample({
- required this.tid,
- required this.timestamp,
- required this.stack,
+ this.tid,
+ this.timestamp,
+ this.stack,
this.vmTag,
this.userTag,
this.truncated,
@@ -3885,8 +3885,8 @@
String? message;
ErrorRef({
- required this.kind,
- required this.message,
+ this.kind,
+ this.message,
required String id,
}) : super(
id: id,
@@ -3942,8 +3942,8 @@
InstanceRef? stacktrace;
Error({
- required this.kind,
- required this.message,
+ this.kind,
+ this.message,
required String id,
this.exception,
this.stacktrace,
@@ -4187,8 +4187,8 @@
ByteData? data;
Event({
- required this.kind,
- required this.timestamp,
+ this.kind,
+ this.timestamp,
this.isolate,
this.vm,
this.breakpoint,
@@ -4347,12 +4347,12 @@
SourceLocation? location;
FieldRef({
- required this.name,
- required this.owner,
- required this.declaredType,
- required this.isConst,
- required this.isFinal,
- required this.isStatic,
+ this.name,
+ this.owner,
+ this.declaredType,
+ this.isConst,
+ this.isFinal,
+ this.isStatic,
required String id,
this.location,
}) : super(
@@ -4444,12 +4444,12 @@
dynamic staticValue;
Field({
- required this.name,
- required this.owner,
- required this.declaredType,
- required this.isConst,
- required this.isFinal,
- required this.isStatic,
+ this.name,
+ this.owner,
+ this.declaredType,
+ this.isConst,
+ this.isFinal,
+ this.isStatic,
required String id,
this.location,
this.staticValue,
@@ -4522,9 +4522,9 @@
String? valueAsString;
Flag({
- required this.name,
- required this.comment,
- required this.modified,
+ this.name,
+ this.comment,
+ this.modified,
this.valueAsString,
});
@@ -4559,7 +4559,7 @@
List<Flag>? flags;
FlagList({
- required this.flags,
+ this.flags,
});
FlagList._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
@@ -4605,7 +4605,7 @@
/*FrameKind*/ String? kind;
Frame({
- required this.index,
+ this.index,
this.function,
this.code,
this.location,
@@ -4684,11 +4684,11 @@
SourceLocation? location;
FuncRef({
- required this.name,
- required this.owner,
- required this.isStatic,
- required this.isConst,
- required this.implicit,
+ this.name,
+ this.owner,
+ this.isStatic,
+ this.isConst,
+ this.implicit,
required String id,
this.location,
}) : super(
@@ -4775,12 +4775,12 @@
CodeRef? code;
Func({
- required this.name,
- required this.owner,
- required this.isStatic,
- required this.isConst,
- required this.implicit,
- required this.signature,
+ this.name,
+ this.owner,
+ this.isStatic,
+ this.isConst,
+ this.implicit,
+ this.signature,
required String id,
this.location,
this.code,
@@ -4980,9 +4980,9 @@
String? debugName;
InstanceRef({
- required this.kind,
- required this.identityHashCode,
- required this.classRef,
+ this.kind,
+ this.identityHashCode,
+ this.classRef,
required String id,
this.valueAsString,
this.valueAsStringIsTruncated,
@@ -5389,9 +5389,9 @@
String? debugName;
Instance({
- required this.kind,
- required this.identityHashCode,
- required this.classRef,
+ this.kind,
+ this.identityHashCode,
+ this.classRef,
required String id,
this.valueAsString,
this.valueAsStringIsTruncated,
@@ -5579,10 +5579,10 @@
bool? isSystemIsolate;
IsolateRef({
- required this.id,
- required this.number,
- required this.name,
- required this.isSystemIsolate,
+ this.id,
+ this.number,
+ this.name,
+ this.isSystemIsolate,
});
IsolateRef._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
@@ -5683,19 +5683,19 @@
List<String>? extensionRPCs;
Isolate({
- required this.id,
- required this.number,
- required this.name,
- required this.isSystemIsolate,
- required this.isolateFlags,
- required this.startTime,
- required this.runnable,
- required this.livePorts,
- required this.pauseOnExit,
- required this.pauseEvent,
- required this.libraries,
- required this.breakpoints,
- required this.exceptionPauseMode,
+ this.id,
+ this.number,
+ this.name,
+ this.isSystemIsolate,
+ this.isolateFlags,
+ this.startTime,
+ this.runnable,
+ this.livePorts,
+ this.pauseOnExit,
+ this.pauseEvent,
+ this.libraries,
+ this.breakpoints,
+ this.exceptionPauseMode,
this.rootLib,
this.error,
this.extensionRPCs,
@@ -5779,8 +5779,8 @@
String? valueAsString;
IsolateFlag({
- required this.name,
- required this.valueAsString,
+ this.name,
+ this.valueAsString,
});
IsolateFlag._fromJson(Map<String, dynamic> json) {
@@ -5821,10 +5821,10 @@
bool? isSystemIsolateGroup;
IsolateGroupRef({
- required this.id,
- required this.number,
- required this.name,
- required this.isSystemIsolateGroup,
+ this.id,
+ this.number,
+ this.name,
+ this.isSystemIsolateGroup,
});
IsolateGroupRef._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
@@ -5881,11 +5881,11 @@
List<IsolateRef>? isolates;
IsolateGroup({
- required this.id,
- required this.number,
- required this.name,
- required this.isSystemIsolateGroup,
- required this.isolates,
+ this.id,
+ this.number,
+ this.name,
+ this.isSystemIsolateGroup,
+ this.isolates,
});
IsolateGroup._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
@@ -5933,7 +5933,7 @@
List<InboundReference>? references;
InboundReferences({
- required this.references,
+ this.references,
});
InboundReferences._fromJson(Map<String, dynamic> json)
@@ -5979,7 +5979,7 @@
FieldRef? parentField;
InboundReference({
- required this.source,
+ this.source,
this.parentListIndex,
this.parentField,
});
@@ -6016,8 +6016,8 @@
List<ObjRef>? instances;
InstanceSet({
- required this.totalCount,
- required this.instances,
+ this.totalCount,
+ this.instances,
});
InstanceSet._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
@@ -6057,8 +6057,8 @@
String? uri;
LibraryRef({
- required this.name,
- required this.uri,
+ this.name,
+ this.uri,
required String id,
}) : super(
id: id,
@@ -6122,14 +6122,14 @@
List<ClassRef>? classes;
Library({
- required this.name,
- required this.uri,
- required this.debuggable,
- required this.dependencies,
- required this.scripts,
- required this.variables,
- required this.functions,
- required this.classes,
+ this.name,
+ this.uri,
+ this.debuggable,
+ this.dependencies,
+ this.scripts,
+ this.variables,
+ this.functions,
+ this.classes,
required String id,
}) : super(
id: id,
@@ -6208,10 +6208,10 @@
List<String>? hides;
LibraryDependency({
- required this.isImport,
- required this.isDeferred,
- required this.prefix,
- required this.target,
+ this.isImport,
+ this.isDeferred,
+ this.prefix,
+ this.target,
this.shows,
this.hides,
});
@@ -6276,14 +6276,14 @@
InstanceRef? stackTrace;
LogRecord({
- required this.message,
- required this.time,
- required this.level,
- required this.sequenceNumber,
- required this.loggerName,
- required this.zone,
- required this.error,
- required this.stackTrace,
+ this.message,
+ this.time,
+ this.level,
+ this.sequenceNumber,
+ this.loggerName,
+ this.zone,
+ this.error,
+ this.stackTrace,
});
LogRecord._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
@@ -6336,8 +6336,8 @@
dynamic value;
MapAssociation({
- required this.key,
- required this.value,
+ this.key,
+ this.value,
});
MapAssociation._fromJson(Map<String, dynamic> json) {
@@ -6383,9 +6383,9 @@
int? heapUsage;
MemoryUsage({
- required this.externalUsage,
- required this.heapCapacity,
- required this.heapUsage,
+ this.externalUsage,
+ this.heapCapacity,
+ this.heapUsage,
});
MemoryUsage._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
@@ -6443,10 +6443,10 @@
SourceLocation? location;
Message({
- required this.index,
- required this.name,
- required this.messageObjectId,
- required this.size,
+ this.index,
+ this.name,
+ this.messageObjectId,
+ this.size,
this.handler,
this.location,
});
@@ -6495,7 +6495,7 @@
String? name;
NativeFunction({
- required this.name,
+ this.name,
});
NativeFunction._fromJson(Map<String, dynamic> json) {
@@ -6523,7 +6523,7 @@
String? valueAsString;
NullValRef({
- required this.valueAsString,
+ this.valueAsString,
}) : super(
id: 'instance/null',
identityHashCode: 0,
@@ -6575,7 +6575,7 @@
String? valueAsString;
NullVal({
- required this.valueAsString,
+ this.valueAsString,
}) : super(
id: 'instance/null',
identityHashCode: 0,
@@ -6633,7 +6633,7 @@
bool? fixedId;
ObjRef({
- required this.id,
+ this.id,
this.fixedId,
});
@@ -6702,7 +6702,7 @@
int? size;
Obj({
- required this.id,
+ this.id,
this.fixedId,
this.classRef,
this.size,
@@ -6761,8 +6761,8 @@
bool? required;
Parameter({
- required this.parameterType,
- required this.fixed,
+ this.parameterType,
+ this.fixed,
this.name,
this.required,
});
@@ -6801,7 +6801,7 @@
List<InstanceRef>? ports;
PortList({
- required this.ports,
+ this.ports,
});
PortList._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
@@ -6851,11 +6851,11 @@
dynamic function;
ProfileFunction({
- required this.kind,
- required this.inclusiveTicks,
- required this.exclusiveTicks,
- required this.resolvedUrl,
- required this.function,
+ this.kind,
+ this.inclusiveTicks,
+ this.exclusiveTicks,
+ this.resolvedUrl,
+ this.function,
});
ProfileFunction._fromJson(Map<String, dynamic> json) {
@@ -6896,7 +6896,7 @@
List<Protocol>? protocols;
ProtocolList({
- required this.protocols,
+ this.protocols,
});
ProtocolList._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
@@ -6936,9 +6936,9 @@
int? minor;
Protocol({
- required this.protocolName,
- required this.major,
- required this.minor,
+ this.protocolName,
+ this.major,
+ this.minor,
});
Protocol._fromJson(Map<String, dynamic> json) {
@@ -6969,7 +6969,7 @@
ProcessMemoryItem? root;
ProcessMemoryUsage({
- required this.root,
+ this.root,
});
ProcessMemoryUsage._fromJson(Map<String, dynamic> json)
@@ -7012,10 +7012,10 @@
List<ProcessMemoryItem>? children;
ProcessMemoryItem({
- required this.name,
- required this.description,
- required this.size,
- required this.children,
+ this.name,
+ this.description,
+ this.size,
+ this.children,
});
ProcessMemoryItem._fromJson(Map<String, dynamic> json) {
@@ -7052,7 +7052,7 @@
bool? success;
ReloadReport({
- required this.success,
+ this.success,
});
ReloadReport._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
@@ -7096,7 +7096,7 @@
String? parentField;
RetainingObject({
- required this.value,
+ this.value,
this.parentListIndex,
this.parentMapKey,
this.parentField,
@@ -7141,9 +7141,9 @@
List<RetainingObject>? elements;
RetainingPath({
- required this.length,
- required this.gcRootType,
- required this.elements,
+ this.length,
+ this.gcRootType,
+ this.elements,
});
RetainingPath._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
@@ -7216,8 +7216,8 @@
String? valueAsString;
Sentinel({
- required this.kind,
- required this.valueAsString,
+ this.kind,
+ this.valueAsString,
});
Sentinel._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
@@ -7252,7 +7252,7 @@
String? uri;
ScriptRef({
- required this.uri,
+ this.uri,
required String id,
}) : super(
id: id,
@@ -7338,8 +7338,8 @@
List<List<int>>? tokenPosTable;
Script({
- required this.uri,
- required this.library,
+ this.uri,
+ this.library,
required String id,
this.lineOffset,
this.columnOffset,
@@ -7424,7 +7424,7 @@
List<ScriptRef>? scripts;
ScriptList({
- required this.scripts,
+ this.scripts,
});
ScriptList._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
@@ -7476,8 +7476,8 @@
int? column;
SourceLocation({
- required this.script,
- required this.tokenPos,
+ this.script,
+ this.tokenPos,
this.endTokenPos,
this.line,
this.column,
@@ -7533,8 +7533,8 @@
List<ScriptRef>? scripts;
SourceReport({
- required this.ranges,
- required this.scripts,
+ this.ranges,
+ this.scripts,
});
SourceReport._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
@@ -7580,8 +7580,8 @@
List<int>? misses;
SourceReportCoverage({
- required this.hits,
- required this.misses,
+ this.hits,
+ this.misses,
});
SourceReportCoverage._fromJson(Map<String, dynamic> json) {
@@ -7648,10 +7648,10 @@
SourceReportCoverage? branchCoverage;
SourceReportRange({
- required this.scriptIndex,
- required this.startPos,
- required this.endPos,
- required this.compiled,
+ this.scriptIndex,
+ this.startPos,
+ this.endPos,
+ this.compiled,
this.error,
this.coverage,
this.possibleBreakpoints,
@@ -7726,9 +7726,9 @@
bool? truncated;
Stack({
- required this.frames,
- required this.messages,
- required this.truncated,
+ this.frames,
+ this.messages,
+ this.truncated,
this.asyncCausalFrames,
this.awaiterFrames,
});
@@ -7814,9 +7814,9 @@
int? timeExtentMicros;
Timeline({
- required this.traceEvents,
- required this.timeOriginMicros,
- required this.timeExtentMicros,
+ this.traceEvents,
+ this.timeOriginMicros,
+ this.timeExtentMicros,
});
Timeline._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
@@ -7888,9 +7888,9 @@
List<String>? recordedStreams;
TimelineFlags({
- required this.recorderName,
- required this.availableStreams,
- required this.recordedStreams,
+ this.recorderName,
+ this.availableStreams,
+ this.recordedStreams,
});
TimelineFlags._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
@@ -7927,7 +7927,7 @@
int? timestamp;
Timestamp({
- required this.timestamp,
+ this.timestamp,
});
Timestamp._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
@@ -7959,7 +7959,7 @@
String? name;
TypeArgumentsRef({
- required this.name,
+ this.name,
required String id,
}) : super(
id: id,
@@ -8006,8 +8006,8 @@
List<InstanceRef>? types;
TypeArguments({
- required this.name,
- required this.types,
+ this.name,
+ this.types,
required String id,
}) : super(
id: id,
@@ -8058,9 +8058,9 @@
TypeArgumentsRef? defaults;
TypeParameters({
- required this.names,
- required this.bounds,
- required this.defaults,
+ this.names,
+ this.bounds,
+ this.defaults,
});
TypeParameters._fromJson(Map<String, dynamic> json) {
@@ -8167,7 +8167,7 @@
List<String?>? uris;
UriList({
- required this.uris,
+ this.uris,
});
UriList._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
@@ -8204,8 +8204,8 @@
int? minor;
Version({
- required this.major,
- required this.minor,
+ this.major,
+ this.minor,
});
Version._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
@@ -8239,7 +8239,7 @@
String? name;
VMRef({
- required this.name,
+ this.name,
});
VMRef._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
@@ -8305,18 +8305,18 @@
List<IsolateGroupRef>? systemIsolateGroups;
VM({
- required this.name,
- required this.architectureBits,
- required this.hostCPU,
- required this.operatingSystem,
- required this.targetCPU,
- required this.version,
- required this.pid,
- required this.startTime,
- required this.isolates,
- required this.isolateGroups,
- required this.systemIsolates,
- required this.systemIsolateGroups,
+ this.name,
+ this.architectureBits,
+ this.hostCPU,
+ this.operatingSystem,
+ this.targetCPU,
+ this.version,
+ this.pid,
+ this.startTime,
+ this.isolates,
+ this.isolateGroups,
+ this.systemIsolates,
+ this.systemIsolateGroups,
});
VM._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
diff --git a/pkg/vm_service/pubspec.yaml b/pkg/vm_service/pubspec.yaml
index 68572038..0f11496 100644
--- a/pkg/vm_service/pubspec.yaml
+++ b/pkg/vm_service/pubspec.yaml
@@ -1,5 +1,5 @@
name: vm_service
-version: 9.0.0
+version: 9.1.0
description: >-
A library to communicate with a service implementing the Dart VM
service protocol.
diff --git a/pkg/vm_service/tool/dart/generate_dart.dart b/pkg/vm_service/tool/dart/generate_dart.dart
index e15328c..ee8df6c 100644
--- a/pkg/vm_service/tool/dart/generate_dart.dart
+++ b/pkg/vm_service/tool/dart/generate_dart.dart
@@ -1829,13 +1829,10 @@
}
void generateNamedParameter(DartGenerator gen, {bool fromParent = false}) {
- if (!optional) {
- gen.write('required ');
- }
if (fromParent) {
String? typeName =
api.isEnumName(type.name) ? '/*${type.name}*/ String' : type.name;
- gen.writeStatement('$typeName ${generatableName},');
+ gen.writeStatement('required $typeName ${generatableName},');
} else {
gen.writeStatement('this.${generatableName},');
}