onDeviceChange property

Stream<List<DeviceDetails>> get onDeviceChange

Returns a Stream of the DeviceDetails changes.

Implementation

Stream<List<DeviceDetails>> get onDeviceChange {
  if (_devicesController == null) {
    _devicesController = StreamController.broadcast();

    Future(() async {
      (await _mediaManager)?.onDeviceChange(() async {
        _devicesController?.add(
          (await enumerateDevices())
              .where((e) => e.deviceId().isNotEmpty)
              .toList(),
        );
      });
    });
  }

  return _devicesController!.stream;
}