enumerateDevices method

Future<void> enumerateDevices({
  1. bool media = true,
  2. bool screen = true,
})

Populates devices with a list of DeviceDetails objects representing available media input devices, such as microphones, cameras, and so forth.

Implementation

Future<void> enumerateDevices({bool media = true, bool screen = true}) async {
  Log.debug('enumerateDevices($media, $screen)', '$runtimeType');

  try {
    if (media) {
      devices.value = await MediaUtils.enumerateDevices();
    }

    if (screen && PlatformUtils.isDesktop && !PlatformUtils.isWeb) {
      displays.value = await MediaUtils.enumerateDisplays();
    }
  } on EnumerateDevicesException catch (e) {
    addError('Failed to enumerate devices: $e');
    rethrow;
  }
}