audioPrefer static method

Future<String> audioPrefer()

Implementation

static Future<String> audioPrefer() async {
  final audioOutput = await Helper.audiooutputs;
  final preferBluetooth =
      audioOutput.where((item) => item.deviceId == 'bluetooth');
  if (preferBluetooth.isNotEmpty) {
    return 'bluetooth';
  }
  final preferWiredHeadset =
      audioOutput.where((item) => item.deviceId == 'wired-headset');
  if (preferWiredHeadset.isNotEmpty) {
    return 'wired-headset';
  }
  return 'earpiece';
}