getCurrentMicrophone method
Gets the currently active microphone / audio input device, or null if none/unknown.
Implementation
@override
Future<AudioInputDevice?> getCurrentMicrophone() async {
final mics = await getAvailableMicrophones();
return mics.firstWhere(
(d) => d.isSelected,
orElse: () => mics.isNotEmpty
? mics.first
: const AudioInputDevice(
id: 'default',
name: 'Default Microphone',
type: AudioInputType.builtInMic,
isSelected: true,
),
);
}