anchor.diff:  
         await iosDevices.stopPolling();
   
  -      expect(eventStream.hasListener, isFalse);
  +      expect(xcdevice.deviceEventController.hasListener, isFalse);
       });
   
       testWithoutContext('polling can be restarted if stream is closed', () async {
         final IOSDevices iosDevices = IOSDevices(
           platform: macPlatform,
  -        xcdevice: mockXcdevice,
  -        iosWorkflow: mockIosWorkflow,
  -        logger: logger,
  -      );
  -      when(mockXcdevice.isInstalled).thenReturn(true);
  -
  -      when(mockXcdevice.getAvailableIOSDevices())
  -        .thenAnswer((Invocation invocation) => Future<List<IOSDevice>>.value(<IOSDevice>[]));
  -
  -      final StreamController<Map<XCDeviceEvent, String>> eventStream = StreamController<Map<XCDeviceEvent, String>>();
  +        xcdevice: xcdevice,
  +        iosWorkflow: iosWorkflow,
  +        logger: logger,
  +      );
  +      xcdevice.isInstalled = true;
  +      xcdevice.devices.add(<IOSDevice>[]);
  +      xcdevice.devices.add(<IOSDevice>[]);
  +
         final StreamController<Map<XCDeviceEvent, String>> rescheduledStream = StreamController<Map<XCDeviceEvent, String>>();
   
  -      bool reschedule = false;
  -      when(mockXcdevice.observedDeviceEvents()).thenAnswer((Invocation invocation) {
  -        if (!reschedule) {
  -          reschedule = true;
  -          return eventStream.stream;
  -        }
  -        return rescheduledStream.stream;
  -      });
  +      unawaited(xcdevice.deviceEventController.done.whenComplete(() {
  +        xcdevice.deviceEventController = rescheduledStream;
  +      }));
   
         await iosDevices.startPolling();
  -      expect(eventStream.hasListener, isTrue);
  -      verify(mockXcdevice.getAvailableIOSDevices()).called(1);
  +      expect(xcdevice.deviceEventController.hasListener, isTrue);
  +      expect(xcdevice.getAvailableIOSDevicesCount, 1);
   
         // Pretend xcdevice crashed.
  -      await eventStream.close();
  +      await xcdevice.deviceEventController.close();
         expect(logger.traceText, contains('xcdevice observe stopped'));
   
         // Confirm a restart still gets streamed events.
         await iosDevices.startPolling();
   
  -      expect(eventStream.hasListener, isFalse);
         expect(rescheduledStream.hasListener, isTrue);
   
         await iosDevices.stopPolling();
  
positive.code:       testWithoutContext('pollingGetDevices throws Unsupported Operation exception on ${unsupportedPlatform.operatingSystem}', () async {
          final IOSDevices iosDevices = IOSDevices(
            platform: unsupportedPlatform,
            xcdevice: mockXcdevice,
            iosWorkflow: mockIosWorkflow,
            logger: logger,
          );
          when(mockXcdevice.isInstalled).thenReturn(false);
          expect(
            () async { await iosDevices.pollingGetDevices(); },
            throwsUnsupportedError,
  
negative.code: 
      group('.dispose()', () {
        IOSDevice device;
        FakeIOSApp appPackage1;
        FakeIOSApp appPackage2;
        IOSDeviceLogReader logReader1;
        IOSDeviceLogReader logReader2;
        FakeProcess process1;
        FakeProcess process2;
        FakeProcess process3;
        IOSDevicePortForwarder portForwarder;
        ForwardedPort forwardedPort;
        Cache cache;
  