getMics static method

Future<List<MicrophoneDeviceInfo>?> getMics()

Every microphone and speaker the platform reports. Speakers share this type: Android and iOS route audio as one device.

Implementation

static Future<List<MicrophoneDeviceInfo>?> getMics() async {
  final raw = await _channel.invokeMethod<List<dynamic>>('getAudioDevices');
  return (raw ?? const [])
      .map((e) => Map<dynamic, dynamic>.from(e as Map))
      .map((m) => MicrophoneDeviceInfo(
            deviceId: m['deviceId'] as String? ?? '',
            label: m['label'] as String? ?? '',
            kind: m['kind'] as String? ?? 'audiooutput',
          ))
      .toList(growable: false);
}