getCurrentAudioOutput method

  1. @override
Future<AudioOutputDevice?> getCurrentAudioOutput()
override

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

Implementation

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