getCurrentMicrophone method

  1. @override
Future<AudioInputDevice?> getCurrentMicrophone()
override

Gets the currently active microphone / audio input device, or null if none/unknown.

Implementation

@override
Future<AudioInputDevice?> getCurrentMicrophone() async {
  try {
    final map = await methodChannel
        .invokeMapMethod<dynamic, dynamic>('getCurrentMicrophone')
        .timeout(methodTimeout);
    if (map == null) return null;
    return AudioInputDevice.fromMap(map);
  } catch (e, stack) {
    debugPrint('AudioPicker: getCurrentMicrophone error: $e\n$stack');
    return null;
  }
}