getCurrentDevice method
Gets the current audio output device
Returns the currently active AudioDeviceInfo immediately.
Implementation
@override
Future<AudioDeviceInfo> getCurrentDevice() async {
try {
final result = await methodChannel.invokeMethod<Map>('getCurrentDevice');
if (result == null) {
return const AudioDeviceInfo(
type: AudioDeviceType.unknown,
name: 'Unknown device',
);
}
return AudioDeviceInfo.fromMap(result);
} catch (e) {
debugPrint('Error getting current device: $e');
return const AudioDeviceInfo(
type: AudioDeviceType.unknown,
name: 'Unknown device',
);
}
}