list method

  1. @override
Future<List<XScreenSource>> list({
  1. required Set<String> allowedDisplayIds,
  2. required Set<String> allowedWindowIds,
  3. int thumbnailWidth = 320,
  4. int thumbnailHeight = 180,
})
override

The allowed sources present right now, each with a thumbnailWidth × thumbnailHeight aspect-fit PNG.

A source whose thumbnail fails to render comes back with a null XScreenSource.thumbnailPng; thumbnail_failed is thrown only when no requested source renders at all.

Both dimensions must be between 1 and 4096, or this throws ArgumentError without reaching the platform.

Implementation

@override
Future<List<XScreenSource>> list({
  required Set<String> allowedDisplayIds,
  required Set<String> allowedWindowIds,
  int thumbnailWidth = 320,
  int thumbnailHeight = 180,
}) async {
  _requireMode(XScreenCaptureMode.pickerDriven);
  _requireEdge(thumbnailWidth, 'thumbnailWidth');
  _requireEdge(thumbnailHeight, 'thumbnailHeight');
  final raw = await _invoke<List<Object?>>('list', {
    'allowedDisplayIds': allowedDisplayIds.toList(growable: false),
    'allowedWindowIds': allowedWindowIds.toList(growable: false),
    'thumbnailWidth': thumbnailWidth,
    'thumbnailHeight': thumbnailHeight,
  });
  return raw.map(_decodeSource).toList(growable: false);
}