Skip to content

Commit 4f22819

Browse files
authored
Preliminary support for record types when vm_service <10.0.0 (#5028)
1 parent d1c2880 commit 4f22819

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

packages/devtools_app/lib/src/shared/object_tree.dart

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -783,15 +783,24 @@ List<DartObjectNode> _createVariablesForFields(
783783
}) {
784784
final variables = <DartObjectNode>[];
785785
for (var field in instance.fields!) {
786-
final name = field.decl!.name;
787-
if (existingNames != null && existingNames.contains(name)) continue;
788-
variables.add(
789-
DartObjectNode.fromValue(
790-
name: name,
791-
value: field.value,
792-
isolateRef: isolateRef,
793-
),
794-
);
786+
final name = field.decl?.name;
787+
if (name == null) {
788+
variables.add(
789+
DartObjectNode.fromValue(
790+
value: field.value,
791+
isolateRef: isolateRef,
792+
),
793+
);
794+
} else {
795+
if (existingNames != null && existingNames.contains(name)) continue;
796+
variables.add(
797+
DartObjectNode.fromValue(
798+
name: name,
799+
value: field.value,
800+
isolateRef: isolateRef,
801+
),
802+
);
803+
}
795804
}
796805
return variables;
797806
}
@@ -1026,6 +1035,9 @@ class DartObjectNode extends TreeNode<DartObjectNode> {
10261035
if (kind == InstanceKind.kStackTrace) {
10271036
final depth = children.length;
10281037
valueStr = 'StackTrace ($depth ${pluralize('frame', depth)})';
1038+
} else if (kind == 'Record') {
1039+
// TODO(elliette): Compare against InstanceKind.kRecord when vm_service >= 10.0.0.
1040+
valueStr = 'Record';
10291041
} else if (value.valueAsString == null) {
10301042
valueStr = value.classRef?.name ?? '';
10311043
} else {

0 commit comments

Comments
 (0)