@@ -478,6 +478,10 @@ abstract class PrimaryRoleManager {
478478 element.style.position = 'absolute' ;
479479 element.setAttribute ('id' , 'flt-semantic-node-${semanticsObject .id }' );
480480
481+ if (semanticsObject.hasIdentifier) {
482+ element.setAttribute ('semantic-identifier' , semanticsObject.identifier! );
483+ }
484+
481485 // The root node has some properties that other nodes do not.
482486 if (semanticsObject.id == 0 && ! configuration.debugShowSemanticsNodes) {
483487 // Make all semantics transparent. Use `filter` instead of `opacity`
@@ -1085,6 +1089,21 @@ class SemanticsObject {
10851089 _dirtyFields | = _platformViewIdIndex;
10861090 }
10871091
1092+ /// See [ui.SemanticsUpdateBuilder.updateNode] .
1093+ String ? get identifier => _identifier;
1094+ String ? _identifier;
1095+
1096+ bool get hasIdentifier => _identifier != null && _identifier! .isNotEmpty;
1097+
1098+ static const int _identifierIndex = 1 << 24 ;
1099+
1100+ /// Whether the [identifier] field has been updated but has not been
1101+ /// applied to the DOM yet.
1102+ bool get isIdentifierDirty => _isDirty (_identifierIndex);
1103+ void _markIdentifierDirty () {
1104+ _dirtyFields | = _identifierIndex;
1105+ }
1106+
10881107 /// A unique permanent identifier of the semantics node in the tree.
10891108 final int id;
10901109
@@ -1241,6 +1260,11 @@ class SemanticsObject {
12411260 _markFlagsDirty ();
12421261 }
12431262
1263+ if (_identifier != update.identifier) {
1264+ _identifier = update.identifier;
1265+ _markIdentifierDirty ();
1266+ }
1267+
12441268 if (_value != update.value) {
12451269 _value = update.value;
12461270 _markValueDirty ();
0 commit comments