anchor.diff:        expect(nodes[3].runtimeType, StringProperty);
       }, skip: !WidgetInspectorService.instance.isWidgetCreationTracked());  // [intended] Test requires --track-widget-creation flag.
   
  -    testWidgets('WidgetInspectorService setPubRootDirectories', (WidgetTester tester) async {
  -      await tester.pumpWidget(
  -        Directionality(
  -          textDirection: TextDirection.ltr,
  -          child: Stack(
  -            children: const <Widget>[
  -              Text('a'),
  -              Text('b', textDirection: TextDirection.ltr),
  -              Text('c', textDirection: TextDirection.ltr),
  -            ],
  -          ),
  -        ),
  -      );
  -      final Element elementA = find.text('a').evaluate().first;
  -
  -      service.disposeAllGroups();
  -      service.setPubRootDirectories(<String>[]);
  -      service.setSelection(elementA, 'my-group');
  -      Map<String, Object?> jsonObject = json.decode(service.getSelectedWidget(null, 'my-group')) as Map<String, Object?>;
  -      Map<String, Object?> creationLocation = jsonObject['creationLocation']! as Map<String, Object?>;
  -      expect(creationLocation, isNotNull);
  -      final String fileA = creationLocation['file']! as String;
  -      expect(fileA, endsWith('widget_inspector_test.dart'));
  -      expect(jsonObject, isNot(contains('createdByLocalProject')));
  -      final List<String> segments = Uri.parse(fileA).pathSegments;
  -      // Strip a couple subdirectories away to generate a plausible pub root
  -      // directory.
  -      final String pubRootTest = '/${segments.take(segments.length - 2).join('/')}';
  -      service.setPubRootDirectories(<String>[pubRootTest]);
  -
  -      service.setSelection(elementA, 'my-group');
  -      expect(json.decode(service.getSelectedWidget(null, 'my-group')), contains('createdByLocalProject'));
  -
  -      service.setPubRootDirectories(<String>['/invalid/$pubRootTest']);
  -      expect(json.decode(service.getSelectedWidget(null, 'my-group')), isNot(contains('createdByLocalProject')));
  -
  -      service.setPubRootDirectories(<String>['file://$pubRootTest']);
  -      expect(json.decode(service.getSelectedWidget(null, 'my-group')), contains('createdByLocalProject'));
  -
  -      service.setPubRootDirectories(<String>['$pubRootTest/different']);
  -      expect(json.decode(service.getSelectedWidget(null, 'my-group')), isNot(contains('createdByLocalProject')));
  -
  -      service.setPubRootDirectories(<String>[
  -        '/invalid/$pubRootTest',
  -        pubRootTest,
  -      ]);
  -      expect(json.decode(service.getSelectedWidget(null, 'my-group')), contains('createdByLocalProject'));
  -
  -      // The RichText child of the Text widget is created by the core framework
  -      // not the current package.
  -      final Element richText = find.descendant(
  -        of: find.text('a'),
  -        matching: find.byType(RichText),
  -      ).evaluate().first;
  -      service.setSelection(richText, 'my-group');
  -      service.setPubRootDirectories(<String>[pubRootTest]);
  -      jsonObject = json.decode(service.getSelectedWidget(null, 'my-group')) as Map<String, Object?>;
  -      expect(jsonObject, isNot(contains('createdByLocalProject')));
  -      creationLocation = jsonObject['creationLocation']! as Map<String, Object?>;
  -      expect(creationLocation, isNotNull);
  -      // This RichText widget is created by the build method of the Text widget
  -      // thus the creation location is in text.dart not basic.dart
  -      final List<String> pathSegmentsFramework = Uri.parse(creationLocation['file']! as String).pathSegments;
  -      expect(pathSegmentsFramework.join('/'), endsWith('/flutter/lib/src/widgets/text.dart'));
  -
  -      // Strip off /src/widgets/text.dart.
  -      final String pubRootFramework = '/${pathSegmentsFramework.take(pathSegmentsFramework.length - 3).join('/')}';
  -      service.setPubRootDirectories(<String>[pubRootFramework]);
  -      expect(json.decode(service.getSelectedWidget(null, 'my-group')), contains('createdByLocalProject'));
  -      service.setSelection(elementA, 'my-group');
  -      expect(json.decode(service.getSelectedWidget(null, 'my-group')), isNot(contains('createdByLocalProject')));
  -
  -      service.setPubRootDirectories(<String>[pubRootFramework, pubRootTest]);
  -      service.setSelection(elementA, 'my-group');
  -      expect(json.decode(service.getSelectedWidget(null, 'my-group')), contains('createdByLocalProject'));
  -      service.setSelection(richText, 'my-group');
  -      expect(json.decode(service.getSelectedWidget(null, 'my-group')), contains('createdByLocalProject'));
  -    }, skip: !WidgetInspectorService.instance.isWidgetCreationTracked()); // [intended] Test requires --track-widget-creation flag.
  +    group(
  +      'WidgetInspectorService',
  +      () {
  +        group('setPubRootDirectories', () {
  +          late final String pubRootTest;
  +
  +          setUpAll(() {
  +            pubRootTest = generateTestPubRootDirectory(service);
  +          });
  +
  +          setUp(() {
  +            service.disposeAllGroups();
  +            service.setPubRootDirectories(<String>[]);
  +          });
  +
  +          testWidgets(
  +            'does not have createdByLocalProject when there are no pubRootDirectories',
  +            (WidgetTester tester) async {
  +              final Widget widget = Directionality(
  +                textDirection: TextDirection.ltr,
  +                child: Stack(
  +                  children: const <Widget>[
  +                    Text('a'),
  +                    Text('b', textDirection: TextDirection.ltr),
  +                    Text('c', textDirection: TextDirection.ltr),
  +                  ],
  +                ),
  +              );
  +              await tester.pumpWidget(widget);
  +              final Element elementA = find.text('a').evaluate().first;
  +              service.setSelection(elementA, 'my-group');
  +
  +              final Map<String, Object?> jsonObject =
  +                  json.decode(service.getSelectedWidget(null, 'my-group'))
  +                      as Map<String, Object?>;
  +              final Map<String, Object?> creationLocation =
  +                  jsonObject['creationLocation']! as Map<String, Object?>;
  +
  +              expect(creationLocation, isNotNull);
  +              final String fileA = creationLocation['file']! as String;
  +              expect(fileA, endsWith('widget_inspector_test.dart'));
  +              expect(jsonObject, isNot(contains('createdByLocalProject')));
  +            },
  +          );
  +
  +          testWidgets(
  +            'has createdByLocalProject when the element is part of the pubRootDirectory',
  +            (WidgetTester tester) async {
  +              final Widget widget = Directionality(
  +                textDirection: TextDirection.ltr,
  +                child: Stack(
  +                  children: const <Widget>[
  +                    Text('a'),
  +                    Text('b', textDirection: TextDirection.ltr),
  +                    Text('c', textDirection: TextDirection.ltr),
  +                  ],
  +                ),
  +              );
  +              await tester.pumpWidget(widget);
  +              final Element elementA = find.text('a').evaluate().first;
  +
  +              service.setPubRootDirectories(<String>[pubRootTest]);
  +
  +              service.setSelection(elementA, 'my-group');
  +              expect(
  +                json.decode(service.getSelectedWidget(null, 'my-group')),
  +                contains('createdByLocalProject'),
  +              );
  +            },
  +          );
  +
  +          testWidgets(
  +            'does not have createdByLocalProject when widget package directory is a suffix of a pubRootDirectory',
  +            (WidgetTester tester) async {
  +              final Widget widget = Directionality(
  +                textDirection: TextDirection.ltr,
  +                child: Stack(
  +                  children: const <Widget>[
  +                    Text('a'),
  +                    Text('b', textDirection: TextDirection.ltr),
  +                    Text('c', textDirection: TextDirection.ltr),
  +                  ],
  +                ),
  +              );
  +              await tester.pumpWidget(widget);
  +              final Element elementA = find.text('a').evaluate().first;
  +              service.setSelection(elementA, 'my-group');
  +
  +              service.setPubRootDirectories(<String>['/invalid/$pubRootTest']);
  +              expect(
  +                json.decode(service.getSelectedWidget(null, 'my-group')),
  +                isNot(contains('createdByLocalProject')),
  +              );
  +            },
  +          );
  +
  +          testWidgets(
  +            'has createdByLocalProject when the pubRootDirectory is prefixed with file://',
  +            (WidgetTester tester) async {
  +              final Widget widget = Directionality(
  +                textDirection: TextDirection.ltr,
  +                child: Stack(
  +                  children: const <Widget>[
  +                    Text('a'),
  +                    Text('b', textDirection: TextDirection.ltr),
  +                    Text('c', textDirection: TextDirection.ltr),
  +                  ],
  +                ),
  +              );
  +              await tester.pumpWidget(widget);
  +              final Element elementA = find.text('a').evaluate().first;
  +              service.setSelection(elementA, 'my-group');
  +
  +              service.setPubRootDirectories(<String>['file://$pubRootTest']);
  +              expect(
  +                json.decode(service.getSelectedWidget(null, 'my-group')),
  +                contains('createdByLocalProject'),
  +              );
  +            },
  +          );
  +
  +          testWidgets(
  +            'does not have createdByLocalProject when thePubRootDirecty has a different suffix',
  +            (WidgetTester tester) async {
  +              final Widget widget = Directionality(
  +                textDirection: TextDirection.ltr,
  +                child: Stack(
  +                  children: const <Widget>[
  +                    Text('a'),
  +                    Text('b', textDirection: TextDirection.ltr),
  +                    Text('c', textDirection: TextDirection.ltr),
  +                  ],
  +                ),
  +              );
  +              await tester.pumpWidget(widget);
  +              final Element elementA = find.text('a').evaluate().first;
  +              service.setSelection(elementA, 'my-group');
  +
  +              service.setPubRootDirectories(<String>['$pubRootTest/different']);
  +              expect(
  +                json.decode(service.getSelectedWidget(null, 'my-group')),
  +                isNot(contains('createdByLocalProject')),
  +              );
  +            },
  +          );
  +
  +          testWidgets(
  +            'has createdByLocalProject even if another pubRootDirectory does not match',
  +            (WidgetTester tester) async {
  +              final Widget widget = Directionality(
  +                textDirection: TextDirection.ltr,
  +                child: Stack(
  +                  children: const <Widget>[
  +                    Text('a'),
  +                    Text('b', textDirection: TextDirection.ltr),
  +                    Text('c', textDirection: TextDirection.ltr),
  +                  ],
  +                ),
  +              );
  +              await tester.pumpWidget(widget);
  +              final Element elementA = find.text('a').evaluate().first;
  +              service.setSelection(elementA, 'my-group');
  +
  +              service.setPubRootDirectories(<String>[
  +                '/invalid/$pubRootTest',
  +                pubRootTest,
  +              ]);
  +              expect(
  +                json.decode(service.getSelectedWidget(null, 'my-group')),
  +                contains('createdByLocalProject'),
  +              );
  +            },
  +          );
  +
  +          testWidgets(
  +            'widget is part of core framework and is the child of a widget in the package pubRootDirectories',
  +            (WidgetTester tester) async {
  +              final Widget widget = Directionality(
  +                textDirection: TextDirection.ltr,
  +                child: Stack(
  +                  children: const <Widget>[
  +                    Text('a'),
  +                    Text('b', textDirection: TextDirection.ltr),
  +                    Text('c', textDirection: TextDirection.ltr),
  +                  ],
  +                ),
  +              );
  +              await tester.pumpWidget(widget);
  +              final Element elementA = find.text('a').evaluate().first;
  +              final Element richText = find
  +                  .descendant(
  +                    of: find.text('a'),
  +                    matching: find.byType(RichText),
  +                  )
  +                  .evaluate()
  +                  .first;
  +              service.setSelection(richText, 'my-group');
  +              service.setPubRootDirectories(<String>[pubRootTest]);
  +
  +              final Map<String, Object?> jsonObject =
  +                  json.decode(service.getSelectedWidget(null, 'my-group'))
  +                      as Map<String, Object?>;
  +              expect(jsonObject, isNot(contains('createdByLocalProject')));
  +              final Map<String, Object?> creationLocation =
  +                  jsonObject['creationLocation']! as Map<String, Object?>;
  +              expect(creationLocation, isNotNull);
  +              // This RichText widget is created by the build method of the Text widget
  +              // thus the creation location is in text.dart not basic.dart
  +              final List<String> pathSegmentsFramework =
  +                  Uri.parse(creationLocation['file']! as String).pathSegments;
  +              expect(
  +                pathSegmentsFramework.join('/'),
  +                endsWith('/flutter/lib/src/widgets/text.dart'),
  +              );
  +
  +              // Strip off /src/widgets/text.dart.
  +              final String pubRootFramework =
  +                  '/${pathSegmentsFramework.take(pathSegmentsFramework.length - 3).join('/')}';
  +              service.setPubRootDirectories(<String>[pubRootFramework]);
  +              expect(
  +                json.decode(service.getSelectedWidget(null, 'my-group')),
  +                contains('createdByLocalProject'),
  +              );
  +              service.setSelection(elementA, 'my-group');
  +              expect(
  +                json.decode(service.getSelectedWidget(null, 'my-group')),
  +                isNot(contains('createdByLocalProject')),
  +              );
  +
  +              service
  +                  .setPubRootDirectories(<String>[pubRootFramework, pubRootTest]);
  +              service.setSelection(elementA, 'my-group');
  +              expect(
  +                json.decode(service.getSelectedWidget(null, 'my-group')),
  +                contains('createdByLocalProject'),
  +              );
  +              service.setSelection(richText, 'my-group');
  +              expect(
  +                json.decode(service.getSelectedWidget(null, 'my-group')),
  +                contains('createdByLocalProject'),
  +              );
  +            },
  +          );
  +        });
  +      },
  +      skip: !WidgetInspectorService.instance.isWidgetCreationTracked(), // [intended] Test requires --track-widget-creation flag.
  +    );
   
       test('ext.flutter.inspector.disposeGroup', () async {
         final Object a = Object();
  
positive.code:     });
    }
  
    static void setupDefaultPubRootDirectory(TestWidgetInspectorService service) {
      final Map<String, Object?> jsonObject = const SizedBox().toDiagnosticsNode().toJsonMap(InspectorSerializationDelegate(service: service));
      final Map<String, Object?> creationLocation = jsonObject['creationLocation']! as Map<String, Object?>;
      expect(creationLocation, isNotNull);
  
negative.code:       expect(columnA, equals(columnB));
      }, skip: !WidgetInspectorService.instance.isWidgetCreationTracked()); // [intended] Test requires --track-widget-creation flag.
  
      group(
        'ext.flutter.inspector.setPubRootDirectories group',
        () {
          late final String pubRootTest;
  
          setUpAll(() async {
            pubRootTest = generateTestPubRootDirectory(service);
          });
  
          testWidgets(
            'has createdByLocalProject when the widget is in the pubRootDirectory',
            (WidgetTester tester) async {
              await tester.pumpWidget(
                Directionality(
                  textDirection: TextDirection.ltr,
                  child: Stack(
                    children: const <Widget>[
                      Text('a'),
                      Text('b', textDirection: TextDirection.ltr),
                      Text('c', textDirection: TextDirection.ltr),
                    ],
                  ),
                ),
              );
  
              final Element elementA = find.text('a').evaluate().first;
              service.setSelection(elementA, 'my-group');
  
              await service.testExtension(
                'setPubRootDirectories',
                <String, String>{'arg0': pubRootTest},
              );
              expect(
                await service.testExtension(
                  'getSelectedWidget',
                  <String, String>{'objectGroup': 'my-group'},
                ),
                contains('createdByLocalProject'),
              );
            },
          );
  
          testWidgets(
            'does not have createdByLocalProject if the prefix of the pubRootDirectory is different',
            (WidgetTester tester) async {
              await tester.pumpWidget(
                Directionality(
                  textDirection: TextDirection.ltr,
                  child: Stack(
                    children: const <Widget>[
                      Text('a'),
                      Text('b', textDirection: TextDirection.ltr),
                      Text('c', textDirection: TextDirection.ltr),
                    ],
                  ),
                ),
              );
  
              final Element elementA = find.text('a').evaluate().first;
              service.setSelection(elementA, 'my-group');
  
              await service.testExtension(
                'setPubRootDirectories',
                <String, String>{'arg0': '/invalid/$pubRootTest'},
              );
              expect(
                await service.testExtension(
                  'getSelectedWidget',
                  <String, String>{'objectGroup': 'my-group'},
                ),
                isNot(contains('createdByLocalProject')),
              );
            },
          );
  
          testWidgets(
            'has createdByLocalProject if the pubRootDirectory is prefixed with file://',
            (WidgetTester tester) async {
              await tester.pumpWidget(
                Directionality(
                  textDirection: TextDirection.ltr,
                  child: Stack(
                    children: const <Widget>[
                      Text('a'),
                      Text('b', textDirection: TextDirection.ltr),
                      Text('c', textDirection: TextDirection.ltr),
                    ],
                  ),
                ),
              );
  
              final Element elementA = find.text('a').evaluate().first;
              service.setSelection(elementA, 'my-group');
  
              await service.testExtension(
                'setPubRootDirectories',
                <String, String>{'arg0': 'file://$pubRootTest'},
              );
              expect(
                await service.testExtension(
                  'getSelectedWidget',
                  <String, String>{'objectGroup': 'my-group'},
                ),
                contains('createdByLocalProject'),
              );
            },
          );
  
          testWidgets(
            'does not have createdByLocalProject if the pubRootDirectory has a different suffix',
            (WidgetTester tester) async {
              await tester.pumpWidget(
                Directionality(
                  textDirection: TextDirection.ltr,
                  child: Stack(
                    children: const <Widget>[
                      Text('a'),
                      Text('b', textDirection: TextDirection.ltr),
                      Text('c', textDirection: TextDirection.ltr),
                    ],
                  ),
                ),
              );
  
              final Element elementA = find.text('a').evaluate().first;
              service.setSelection(elementA, 'my-group');
  
              await service.testExtension(
                'setPubRootDirectories',
                <String, String>{'arg0': '$pubRootTest/different'},
              );
              expect(
                await service.testExtension(
                  'getSelectedWidget',
                  <String, String>{'objectGroup': 'my-group'},
                ),
                isNot(contains('createdByLocalProject')),
              );
            },
          );
  
          testWidgets(
            'has createdByLocalProject if at least one of the pubRootDirectories matches',
            (WidgetTester tester) async {
              await tester.pumpWidget(
                Directionality(
                  textDirection: TextDirection.ltr,
                  child: Stack(
                    children: const <Widget>[
                      Text('a'),
                      Text('b', textDirection: TextDirection.ltr),
                      Text('c', textDirection: TextDirection.ltr),
                    ],
                  ),
                ),
              );
  
              final Element elementA = find.text('a').evaluate().first;
              service.setSelection(elementA, 'my-group');
  
              await service.testExtension('setPubRootDirectories', <String, String>{
                'arg0': '/unrelated/$pubRootTest',
                'arg1': 'file://$pubRootTest',
              });
  
              expect(
                await service.testExtension(
                  'getSelectedWidget',
                  <String, String>{'objectGroup': 'my-group'},
                ),
                contains('createdByLocalProject'),
              );
            },
          );
  
          testWidgets(
            'widget is part of core framework and is the child of a widget in the package pubRootDirectories',
            (WidgetTester tester) async {
              await tester.pumpWidget(
                Directionality(
                  textDirection: TextDirection.ltr,
                  child: Stack(
                    children: const <Widget>[
                      Text('a'),
                      Text('b', textDirection: TextDirection.ltr),
                      Text('c', textDirection: TextDirection.ltr),
                    ],
                  ),
                ),
              );
              final Element elementA = find.text('a').evaluate().first;
  
              // The RichText child of the Text widget is created by the core framework
              // not the current package.
              final Element richText = find
                  .descendant(
                    of: find.text('a'),
                    matching: find.byType(RichText),
                  )
                  .evaluate()
                  .first;
              service.setSelection(richText, 'my-group');
              service.setPubRootDirectories(<String>[pubRootTest]);
              final Map<String, Object?> jsonObject =
                  json.decode(service.getSelectedWidget(null, 'my-group'))
                      as Map<String, Object?>;
              expect(jsonObject, isNot(contains('createdByLocalProject')));
              final Map<String, Object?> creationLocation =
                  jsonObject['creationLocation']! as Map<String, Object?>;
              expect(creationLocation, isNotNull);
              // This RichText widget is created by the build method of the Text widget
              // thus the creation location is in text.dart not basic.dart
              final List<String> pathSegmentsFramework =
                  Uri.parse(creationLocation['file']! as String).pathSegments;
              expect(
                pathSegmentsFramework.join('/'),
                endsWith('/flutter/lib/src/widgets/text.dart'),
              );
  
              // Strip off /src/widgets/text.dart.
              final String pubRootFramework =
                  '/${pathSegmentsFramework.take(pathSegmentsFramework.length - 3).join('/')}';
              await service.testExtension(
                'setPubRootDirectories',
                <String, String>{'arg0': pubRootFramework},
              );
              expect(
                await service.testExtension(
                  'getSelectedWidget',
                  <String, String>{'objectGroup': 'my-group'},
                ),
                contains('createdByLocalProject'),
              );
              service.setSelection(elementA, 'my-group');
              expect(
                await service.testExtension(
                  'getSelectedWidget',
                  <String, String>{'objectGroup': 'my-group'},
                ),
                isNot(contains('createdByLocalProject')),
              );
  
              await service.testExtension(
                'setPubRootDirectories',
                <String, String>{'arg0': pubRootFramework, 'arg1': pubRootTest},
              );
              service.setSelection(elementA, 'my-group');
              expect(
                await service.testExtension(
                  'getSelectedWidget',
                  <String, String>{'objectGroup': 'my-group'},
                ),
                contains('createdByLocalProject'),
              );
              service.setSelection(richText, 'my-group');
              expect(
                await service.testExtension(
                  'getSelectedWidget',
                  <String, String>{'objectGroup': 'my-group'},
                ),
                contains('createdByLocalProject'),
              );
            },
          );
        },
        skip: !WidgetInspectorService.instance.isWidgetCreationTracked(), // [intended] Test requires --track-widget-creation flag.
      );
  
      group(
        'ext.flutter.inspector.setPubRootDirectories extra args regression test',
        () {
          // Ensure that passing the isolate id as an argument won't break
          // setPubRootDirectories command.
  
          late final String pubRootTest;
  
          setUpAll(() {
            pubRootTest = generateTestPubRootDirectory(service);
          });
  
          testWidgets(
            'has createdByLocalProject when the widget is in the pubRootDirectory',
            (WidgetTester tester) async {
              await tester.pumpWidget(
                Directionality(
                  textDirection: TextDirection.ltr,
                  child: Stack(
                    children: const <Widget>[
                      Text('a'),
                      Text('b', textDirection: TextDirection.ltr),
                      Text('c', textDirection: TextDirection.ltr),
                    ],
                  ),
                ),
              );
              final Element elementA = find.text('a').evaluate().first;
              service.setSelection(elementA, 'my-group');
  
              await service.testExtension(
                'setPubRootDirectories',
                <String, String>{'arg0': pubRootTest, 'isolateId': '34'},
              );
              expect(
                await service.testExtension(
                  'getSelectedWidget',
                  <String, String>{'objectGroup': 'my-group'},
                ),
                contains('createdByLocalProject'),
              );
            },
          );
  
          testWidgets(
            'does not have createdByLocalProject if the prefix of the pubRootDirectory is different',
            (WidgetTester tester) async {
              await tester.pumpWidget(
                Directionality(
                  textDirection: TextDirection.ltr,
                  child: Stack(
                    children: const <Widget>[
                      Text('a'),
                      Text('b', textDirection: TextDirection.ltr),
                      Text('c', textDirection: TextDirection.ltr),
                    ],
                  ),
                ),
              );
              final Element elementA = find.text('a').evaluate().first;
              service.setSelection(elementA, 'my-group');
  
              await service.testExtension('setPubRootDirectories', <String, String>{
                'arg0': '/invalid/$pubRootTest',
                'isolateId': '34'
              });
              expect(
                await service.testExtension(
                  'getSelectedWidget',
                  <String, String>{'objectGroup': 'my-group'},
                ),
                isNot(contains('createdByLocalProject')),
              );
            },
          );
  
          testWidgets(
            'has createdByLocalProject if the pubRootDirectory is prefixed with file://',
            (WidgetTester tester) async {
              await tester.pumpWidget(
                Directionality(
                  textDirection: TextDirection.ltr,
                  child: Stack(
                    children: const <Widget>[
                      Text('a'),
                      Text('b', textDirection: TextDirection.ltr),
                      Text('c', textDirection: TextDirection.ltr),
                    ],
                  ),
                ),
              );
              final Element elementA = find.text('a').evaluate().first;
              service.setSelection(elementA, 'my-group');
  
              await service.testExtension(
                'setPubRootDirectories',
                <String, String>{'arg0': 'file://$pubRootTest', 'isolateId': '34'},
              );
              expect(
                await service.testExtension(
                  'getSelectedWidget',
                  <String, String>{'objectGroup': 'my-group'},
                ),
                contains('createdByLocalProject'),
              );
            },
          );
  
          testWidgets(
            'does not have createdByLocalProject if the pubRootDirectory has a different suffix',
            (WidgetTester tester) async {
              await tester.pumpWidget(
                Directionality(
                  textDirection: TextDirection.ltr,
                  child: Stack(
                    children: const <Widget>[
                      Text('a'),
                      Text('b', textDirection: TextDirection.ltr),
                      Text('c', textDirection: TextDirection.ltr),
                    ],
                  ),
                ),
              );
              final Element elementA = find.text('a').evaluate().first;
              service.setSelection(elementA, 'my-group');
  
              await service.testExtension('setPubRootDirectories', <String, String>{
                'arg0': '$pubRootTest/different',
                'isolateId': '34'
              });
              expect(
                await service.testExtension(
                  'getSelectedWidget',
                  <String, String>{'objectGroup': 'my-group'},
                ),
                isNot(contains('createdByLocalProject')),
              );
            },
          );
  
          testWidgets(
            'has createdByLocalProject if at least one of the pubRootDirectories matchesE',
            (WidgetTester tester) async {
              await tester.pumpWidget(
                Directionality(
                  textDirection: TextDirection.ltr,
                  child: Stack(
                    children: const <Widget>[
                      Text('a'),
                      Text('b', textDirection: TextDirection.ltr),
                      Text('c', textDirection: TextDirection.ltr),
                    ],
                  ),
                ),
              );
              final Element elementA = find.text('a').evaluate().first;
              service.setSelection(elementA, 'my-group');
  
              await service.testExtension('setPubRootDirectories', <String, String>{
                'arg0': '/unrelated/$pubRootTest',
                'isolateId': '34',
                'arg1': 'file://$pubRootTest',
              });
  
              expect(
                await service.testExtension(
                  'getSelectedWidget',
                  <String, String>{'objectGroup': 'my-group'},
                ),
                contains('createdByLocalProject'),
              );
            },
          );
        },
        skip: !WidgetInspectorService.instance.isWidgetCreationTracked(), // [intended] Test requires --track-widget-creation flag.
      );
  
      Map<Object, Object?> removeLastEvent(List<Map<Object, Object?>> events) {
        final Map<Object, Object?> event = events.removeLast();
  