sources method

  1. @override
Future<List<XAudioSource>> sources()
override

What this host can tap right now: the hardware inputs the OS names, plus device playback where the platform taps it — macOS, and Android 10 and newer in an app whose pubspec sets ux: enable_media_projection: true. iOS lists microphones alone. Empty where supported is false.

Implementation

@override
Future<List<XAudioSource>> sources() async {
  if (!supported) return const [];
  final List<Object?>? raw;
  try {
    raw = await _methods.invokeListMethod<Object?>('sources');
  } on PlatformException catch (e) {
    throw XAudioCaptureException(e.code, e.message);
  }
  if (raw == null) {
    throw const XAudioCaptureException('invalid_response', 'sources: null');
  }
  return raw.map(_decodeSource).toList(growable: false);
}